Skip to content

Commit

Permalink
Merge pull request #162 from zacharygoodwin/PROC-1479
Browse files Browse the repository at this point in the history
PROC-1479: Add force logging field
  • Loading branch information
zacharygoodwin committed Apr 11, 2024
2 parents e3b0c8e + 1a50cc4 commit 39e0924
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class ConsumableTestDefinition {
private boolean evaluateForIncognitoUsers = false;
private boolean enableUnitlessAllocations = false;
private boolean containsUnitlessAllocation = false;
private boolean forceLogging = false;

public ConsumableTestDefinition() {
/* intentionally empty */
Expand Down Expand Up @@ -139,7 +140,8 @@ private ConsumableTestDefinition(
@Nullable final TestDependency dependsOn,
final boolean evaluateForIncognitoUsers,
final boolean enableUnitlessAllocations,
final boolean containsUnitlessAllocation) {
final boolean containsUnitlessAllocation,
final boolean forceLogging) {
this.constants = constants;
this.version = version;
this.salt = salt;
Expand All @@ -154,6 +156,7 @@ private ConsumableTestDefinition(
this.evaluateForIncognitoUsers = evaluateForIncognitoUsers;
this.enableUnitlessAllocations = enableUnitlessAllocations;
this.containsUnitlessAllocation = containsUnitlessAllocation;
this.forceLogging = forceLogging;
}

@Nonnull
Expand Down Expand Up @@ -287,6 +290,14 @@ public void setContainsUnitlessAllocation(final boolean containsUnitlessAllocati
this.containsUnitlessAllocation = containsUnitlessAllocation;
}

public boolean getForceLogging() {
return forceLogging;
}

public void setForceLogging(final boolean forceLogging) {
this.forceLogging = forceLogging;
}

@Nonnull
public static ConsumableTestDefinition fromTestDefinition(@Nonnull final TestDefinition td) {
final Map<String, Object> specialConstants = td.getSpecialConstants();
Expand Down Expand Up @@ -342,6 +353,7 @@ public static ConsumableTestDefinition fromTestDefinition(@Nonnull final TestDef
td.getDependsOn(),
td.getEvaluateForIncognitoUsers(),
td.getEnableUnitlessAllocations(),
containsUnitlessAllocation);
containsUnitlessAllocation,
td.getForceLogging());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class TestDefinition {

private boolean enableUnitlessAllocations;

private boolean forceLogging;

public TestDefinition() {
/* intentionally empty */
}
Expand Down Expand Up @@ -138,6 +140,7 @@ public TestDefinition(
this.description = description;
this.metaTags = metaTags;
this.evaluateForIncognitoUsers = false;
this.forceLogging = false;
}

public TestDefinition(@Nonnull final TestDefinition other) {
Expand All @@ -159,6 +162,7 @@ private TestDefinition(@Nonnull final Builder builder) {
dependsOn = builder.dependsOn;
evaluateForIncognitoUsers = builder.evaluateForIncognitoUsers;
enableUnitlessAllocations = builder.enableUnitlessAllocations;
forceLogging = builder.forceLogging;
}

public static Builder builder() {
Expand Down Expand Up @@ -324,6 +328,10 @@ public boolean getEnableUnitlessAllocations() {
return enableUnitlessAllocations;
}

public boolean getForceLogging() {
return forceLogging;
}

@Override
public String toString() {
return "TestDefinition{"
Expand Down Expand Up @@ -359,6 +367,8 @@ public String toString() {
+ evaluateForIncognitoUsers
+ ", enableUnitlessAllocations="
+ enableUnitlessAllocations
+ ", forceLogging="
+ forceLogging
+ '}';
}

Expand Down Expand Up @@ -392,7 +402,8 @@ public int hashCode() {
metaTags,
dependsOn,
evaluateForIncognitoUsers,
enableUnitlessAllocations);
enableUnitlessAllocations,
forceLogging);
}

/**
Expand Down Expand Up @@ -424,7 +435,8 @@ && bucketListEqual(buckets, that.buckets)
&& Objects.equals(metaTags, that.metaTags)
&& Objects.equals(dependsOn, that.dependsOn)
&& Objects.equals(evaluateForIncognitoUsers, that.evaluateForIncognitoUsers)
&& Objects.equals(enableUnitlessAllocations, that.enableUnitlessAllocations);
&& Objects.equals(enableUnitlessAllocations, that.enableUnitlessAllocations)
&& Objects.equals(forceLogging, that.forceLogging);
}

@VisibleForTesting
Expand Down Expand Up @@ -465,6 +477,7 @@ public static class Builder {
private TestDependency dependsOn;
private boolean evaluateForIncognitoUsers;
private boolean enableUnitlessAllocations;
private boolean forceLogging;

public Builder from(@Nonnull final TestDefinition other) {
setVersion(other.version);
Expand All @@ -481,6 +494,7 @@ public Builder from(@Nonnull final TestDefinition other) {
setDependsOn(other.dependsOn);
setEvaluateForIncognitoUsers(other.evaluateForIncognitoUsers);
setEnableUnitlessAllocations(other.enableUnitlessAllocations);
setForceLogging(other.forceLogging);
return this;
}

Expand Down Expand Up @@ -589,6 +603,11 @@ public Builder setEnableUnitlessAllocations(final boolean enableUnitlessAllocati
return this;
}

public Builder setForceLogging(final boolean forceLogging) {
this.forceLogging = forceLogging;
return this;
}

public TestDefinition build() {
return new TestDefinition(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public void testBuilder() {
.setMetaTags(metatags)
.setDependsOn(dependsOn)
.setEvaluateForIncognitoUsers(incognito)
.setForceLogging(true)
.build();

final TestDefinition definition2 = TestDefinition.builder().from(definition1).build();
Expand All @@ -292,6 +293,7 @@ public void testBuilder() {
assertThat(definition.getMetaTags()).isEqualTo(metatags);
assertThat(definition.getDependsOn()).isEqualTo(dependsOn);
assertThat(definition.getEvaluateForIncognitoUsers()).isEqualTo(incognito);
assertThat(definition.getEvaluateForIncognitoUsers()).isEqualTo(true);
}
}
}

0 comments on commit 39e0924

Please sign in to comment.