diff --git a/backend/pom.xml b/backend/pom.xml
index 7ce2744d1..479db4cf3 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -239,8 +239,7 @@
jersey-media-multipart
${jersey2-version}
-
+
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Filters.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Filters.java
index 68a83e9f0..e4988bb9e 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Filters.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Filters.java
@@ -48,11 +48,6 @@ public Filters copy() {
return new Filters().maintainer(maintainer).mapsheet(mapsheet).polygon(polygon).polygonId(polygonId);
}
- public Filters maintainer(String maintainer) {
- this.maintainer = maintainer;
- return this;
- }
-
/**
* only those polygons with the specified maintainer will be considered for inclusion in the output
*
@@ -63,13 +58,13 @@ public String getMaintainer() {
return maintainer;
}
- public void setMaintainer(String maintainer) {
- this.maintainer = maintainer;
+ public Filters maintainer(String maintainer) {
+ setMaintainer(maintainer);
+ return this;
}
- public Filters mapsheet(String mapsheet) {
- this.mapsheet = mapsheet;
- return this;
+ public void setMaintainer(String maintainer) {
+ this.maintainer = maintainer;
}
/**
@@ -82,13 +77,13 @@ public String getMapsheet() {
return mapsheet;
}
- public void setMapsheet(String mapsheet) {
- this.mapsheet = mapsheet;
+ public Filters mapsheet(String mapsheet) {
+ setMapsheet(mapsheet);
+ return this;
}
- public Filters polygon(String polygon) {
- this.polygon = polygon;
- return this;
+ public void setMapsheet(String mapsheet) {
+ this.mapsheet = mapsheet;
}
/**
@@ -101,13 +96,13 @@ public String getPolygon() {
return polygon;
}
- public void setPolygon(String polygon) {
- this.polygon = polygon;
+ public Filters polygon(String polygon) {
+ setPolygon(polygon);
+ return this;
}
- public Filters polygonId(String polygonId) {
- this.polygonId = polygonId;
- return this;
+ public void setPolygon(String polygon) {
+ this.polygon = polygon;
}
/**
@@ -120,6 +115,11 @@ public String getPolygonId() {
return polygonId;
}
+ public Filters polygonId(String polygonId) {
+ setPolygonId(polygonId);
+ return this;
+ }
+
public void setPolygonId(String polygonId) {
this.polygonId = polygonId;
}
@@ -146,7 +146,6 @@ public int hashCode() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Filters {\n");
-
sb.append(" maintainer: ").append(toIndentedString(maintainer)).append("\n");
sb.append(" mapsheet: ").append(toIndentedString(mapsheet)).append("\n");
sb.append(" polygon: ").append(toIndentedString(polygon)).append("\n");
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Parameters.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Parameters.java
index 0367110bf..4536548e7 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Parameters.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/Parameters.java
@@ -86,9 +86,7 @@ public class Parameters {
public static final String JSON_PROPERTY_FILTERS = "filters";
@JsonProperty(JSON_PROPERTY_FILTERS)
- // protected because this parameter requires no validation and therefore isn't in ValidatedParameters.
- // This is the only such parameter
- protected Filters filters;
+ public Filters filters;
public static final String JSON_PROPERTY_UTILS = "utils";
@JsonProperty(JSON_PROPERTY_UTILS)
@@ -375,15 +373,6 @@ public List getSelectedExecutionOptions() {
return selectedExecutionOptions;
}
- public void setSelectedExecutionOptions(List selectedExecutionOptions) {
- if (selectedExecutionOptions == null) {
- this.selectedExecutionOptions.clear();
- } else {
- this.selectedExecutionOptions = new ArrayList();
- selectedExecutionOptions.stream().forEach(o -> this.selectedExecutionOptions.add(o.getValue()));
- }
- }
-
public Parameters selectedExecutionOptions(List selectedExecutionOptions) {
setSelectedExecutionOptions(selectedExecutionOptions);
return this;
@@ -394,6 +383,15 @@ public Parameters addSelectedExecutionOptionsItem(ExecutionOption selectedExecut
return this;
}
+ public void setSelectedExecutionOptions(List selectedExecutionOptions) {
+ if (selectedExecutionOptions == null) {
+ this.selectedExecutionOptions.clear();
+ } else {
+ this.selectedExecutionOptions = new ArrayList();
+ selectedExecutionOptions.stream().forEach(o -> this.selectedExecutionOptions.add(o.getValue()));
+ }
+ }
+
public Parameters addSelectedExecutionOptionsItem(String selectedExecutionOptionsItemText) {
if (selectedExecutionOptionsItemText != null) {
this.selectedExecutionOptions.add(selectedExecutionOptionsItemText);
@@ -426,12 +424,15 @@ public Parameters selectedDebugOptions(List selectedDebugOptions) {
}
public Parameters addSelectedDebugOptionsItem(DebugOption selectedDebugOptionsItem) {
+ if (selectedDebugOptions == null) {
+ selectedDebugOptions = new ArrayList<>();
+ }
this.selectedDebugOptions.add(selectedDebugOptionsItem.getValue());
return this;
}
public Parameters addSelectedDebugOptionsItem(String selectedDebugOptionsItemText) {
- if (selectedDebugOptionsItemText != null) {
+ if (selectedDebugOptionsItemText != null) {
this.selectedDebugOptions.add(selectedDebugOptionsItemText);
}
return this;
@@ -632,7 +633,7 @@ public Parameters combineAgeYearRange(String combineAgeYearRangeText) {
public void setCombineAgeYearRange(String combineAgeYearRangeText) {
this.combineAgeYearRange = combineAgeYearRangeText;
}
-
+
/**
* Get progressFrequency
*
@@ -715,12 +716,12 @@ public Filters getFilters() {
}
public Parameters filters(Filters filters) {
- this.filters = filters;
+ setFilters(filters);
return this;
}
public void setFilters(Filters filters) {
- this.filters = filters;
+ this.filters = filters == null ? null : filters.copy();
}
/**
@@ -740,7 +741,8 @@ public Parameters utils(List utils) {
public Parameters addUtilsItem(ValidatedUtilizationParameter utilsItem) {
this.utils.add(
- new UtilizationParameter().speciesName(utilsItem.getSpeciesName()).utilizationClass(utilsItem.getUtilizationClass().getValue())
+ new UtilizationParameter().speciesName(utilsItem.getSpeciesName())
+ .utilizationClass(utilsItem.getUtilizationClass().getValue())
);
return this;
}
@@ -750,13 +752,12 @@ public void setUtils(List utils) {
this.utils = null;
} else {
this.utils = new ArrayList<>();
- utils.stream()
- .forEach(
- u -> this.utils.add(
- new UtilizationParameter().speciesName(u.getSpeciesName())
- .utilizationClass(u.getUtilizationClass().getValue())
- )
- );
+ utils.stream().forEach(
+ u -> this.utils.add(
+ new UtilizationParameter().speciesName(u.getSpeciesName())
+ .utilizationClass(u.getUtilizationClass().getValue())
+ )
+ );
}
}
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ProgressFrequency.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ProgressFrequency.java
index d37c65c36..9a582393f 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ProgressFrequency.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ProgressFrequency.java
@@ -53,7 +53,7 @@ public enum FrequencyKind {
public String toString() {
return getValue();
}
-
+
@JsonValue
public String getValue() {
return value;
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/UtilizationParameter.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/UtilizationParameter.java
index 70c56260a..7ea273fbf 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/UtilizationParameter.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/model/v1/UtilizationParameter.java
@@ -24,15 +24,17 @@
/**
* This class records a utilization class for a given sp0 (species group) name.
*/
-@JsonPropertyOrder({ UtilizationParameter.JSON_PROPERTY_SPECIES_NAME, UtilizationParameter.JSON_PROPERTY_VALUE })
+@JsonPropertyOrder(
+ { UtilizationParameter.JSON_PROPERTY_SPECIES_NAME, UtilizationParameter.JSON_PROPERTY_UTILIZATION_CLASS }
+)
@RegisterForReflection
public class UtilizationParameter {
public static final String JSON_PROPERTY_SPECIES_NAME = "speciesName";
@JsonProperty(JSON_PROPERTY_SPECIES_NAME)
private String speciesName;
- public static final String JSON_PROPERTY_VALUE = "value";
- @JsonProperty(JSON_PROPERTY_VALUE)
+ public static final String JSON_PROPERTY_UTILIZATION_CLASS = "utilizationClass";
+ @JsonProperty(JSON_PROPERTY_UTILIZATION_CLASS)
private String utilizationClass;
/**
@@ -61,7 +63,7 @@ public enum UtilizationClass {
public String toString() {
return getValue();
}
-
+
@JsonValue
public String getValue() {
return value;
@@ -78,22 +80,21 @@ public static UtilizationClass fromValue(String value) {
}
}
- public UtilizationParameter speciesName(String speciesName) {
- this.speciesName = speciesName;
- return this;
- }
-
/**
* Get speciesName
*
* @return speciesName
**/
- @JsonProperty(value = "speciesName")
-
+ @JsonProperty(value = JSON_PROPERTY_SPECIES_NAME)
public String getSpeciesName() {
return speciesName;
}
+ public UtilizationParameter speciesName(String speciesName) {
+ setSpeciesName(speciesName);
+ return this;
+ }
+
public void setSpeciesName(String speciesName) {
this.speciesName = speciesName;
}
@@ -103,7 +104,7 @@ public void setSpeciesName(String speciesName) {
*
* @return value
**/
- @JsonProperty(value = "utilizationClass")
+ @JsonProperty(value = JSON_PROPERTY_UTILIZATION_CLASS)
public String getUtilizationClass() {
return utilizationClass;
}
@@ -135,7 +136,8 @@ public boolean equals(Object o) {
return false;
}
UtilizationParameter up = (UtilizationParameter) o;
- return Objects.equals(this.speciesName, up.speciesName) && Objects.equals(this.utilizationClass, up.utilizationClass);
+ return Objects.equals(this.speciesName, up.speciesName)
+ && Objects.equals(this.utilizationClass, up.utilizationClass);
}
@Override
@@ -149,7 +151,7 @@ public String toString() {
sb.append("class ");
sb.append(UtilizationParameter.class.getSimpleName());
sb.append(" {\n speciesName: ").append(toIndentedString(speciesName)).append("\n");
- sb.append(" value: ").append(toIndentedString(utilizationClass)).append("\n");
+ sb.append(" utilizationClass: ").append(toIndentedString(utilizationClass)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/LoggingParameters.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/LoggingParameters.java
index 032beb5fa..3966a8a8c 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/LoggingParameters.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/LoggingParameters.java
@@ -15,14 +15,14 @@ public class LoggingParameters {
public static final LoggingParameters DEFAULT;
- public boolean doEnableErrorLogging;
- public boolean doEnableProgressLogging;
- public boolean doEnableDebugLogging;
+ private boolean doEnableErrorLogging;
+ private boolean doEnableProgressLogging;
+ private boolean doEnableDebugLogging;
- public boolean doIncludeDebugTimestamps;
- public boolean doIncludeDebugRoutineNames;
- public boolean doIncludeDebugEntryExit;
- public boolean doIncludeDebugIndentBlocks;
+ private boolean doIncludeDebugTimestamps;
+ private boolean doIncludeDebugRoutineNames;
+ private boolean doIncludeDebugEntryExit;
+ private boolean doIncludeDebugIndentBlocks;
private LoggingParameters(Parameters params) {
@@ -32,50 +32,43 @@ private LoggingParameters(Parameters params) {
.selectedDebugOptions(new ArrayList());
}
- if (params.getSelectedExecutionOptions()
- .contains(ExecutionOption.DO_ENABLE_ERROR_LOGGING.toString())) {
+ if (params.getSelectedExecutionOptions().contains(ExecutionOption.DO_ENABLE_ERROR_LOGGING.toString())) {
doEnableErrorLogging = true;
} else {
doEnableErrorLogging = LoggingParameters.DEFAULT.doEnableErrorLogging;
}
- if (params.getSelectedExecutionOptions()
- .contains(ExecutionOption.DO_ENABLE_PROGRESS_LOGGING.toString())) {
+ if (params.getSelectedExecutionOptions().contains(ExecutionOption.DO_ENABLE_PROGRESS_LOGGING.toString())) {
doEnableProgressLogging = true;
} else {
doEnableProgressLogging = LoggingParameters.DEFAULT.doEnableProgressLogging;
}
- if (params.getSelectedExecutionOptions()
- .contains(ExecutionOption.DO_ENABLE_DEBUG_LOGGING.toString())) {
+ if (params.getSelectedExecutionOptions().contains(ExecutionOption.DO_ENABLE_DEBUG_LOGGING.toString())) {
doEnableDebugLogging = true;
} else {
doEnableDebugLogging = LoggingParameters.DEFAULT.doEnableDebugLogging;
}
- if (params.getSelectedDebugOptions()
- .contains(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT.toString())) {
+ if (params.getSelectedDebugOptions().contains(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT.toString())) {
doIncludeDebugEntryExit = true;
} else {
doIncludeDebugEntryExit = LoggingParameters.DEFAULT.doIncludeDebugEntryExit;
}
- if (params.getSelectedDebugOptions()
- .contains(DebugOption.DO_INCLUDE_DEBUG_INDENT_BLOCKS.toString())) {
+ if (params.getSelectedDebugOptions().contains(DebugOption.DO_INCLUDE_DEBUG_INDENT_BLOCKS.toString())) {
doIncludeDebugIndentBlocks = true;
} else {
doIncludeDebugIndentBlocks = LoggingParameters.DEFAULT.doIncludeDebugIndentBlocks;
}
- if (params.getSelectedDebugOptions()
- .contains(DebugOption.DO_INCLUDE_DEBUG_ROUTINE_NAMES.toString())) {
+ if (params.getSelectedDebugOptions().contains(DebugOption.DO_INCLUDE_DEBUG_ROUTINE_NAMES.toString())) {
doIncludeDebugRoutineNames = true;
} else {
doIncludeDebugRoutineNames = LoggingParameters.DEFAULT.doIncludeDebugRoutineNames;
}
- if (params.getSelectedDebugOptions()
- .contains(DebugOption.DO_INCLUDE_DEBUG_TIMESTAMPS.toString())) {
+ if (params.getSelectedDebugOptions().contains(DebugOption.DO_INCLUDE_DEBUG_TIMESTAMPS.toString())) {
doIncludeDebugTimestamps = true;
} else {
doIncludeDebugTimestamps = LoggingParameters.DEFAULT.doIncludeDebugTimestamps;
@@ -89,31 +82,46 @@ public static LoggingParameters of(Parameters params) {
return new LoggingParameters(params);
}
- public boolean isDoEnableErrorLogging() {
+ public LoggingParameters copy() {
+ var copy = new LoggingParameters();
+
+ copy.doEnableErrorLogging = doEnableErrorLogging;
+ copy.doEnableProgressLogging = doEnableProgressLogging;
+ copy.doEnableDebugLogging = doEnableDebugLogging;
+
+ copy.doIncludeDebugTimestamps = doIncludeDebugTimestamps;
+ copy.doIncludeDebugRoutineNames = doIncludeDebugRoutineNames;
+ copy.doIncludeDebugEntryExit = doIncludeDebugEntryExit;
+ copy.doIncludeDebugIndentBlocks = doIncludeDebugIndentBlocks;
+
+ return copy;
+ }
+
+ public boolean doEnableErrorLogging() {
return doEnableErrorLogging;
}
- public boolean isDoEnableProgressLogging() {
+ public boolean doEnableProgressLogging() {
return doEnableProgressLogging;
}
- public boolean isDoEnableDebugLogging() {
+ public boolean doEnableDebugLogging() {
return doEnableDebugLogging;
}
- public boolean isDoIncludeDebugTimestamps() {
+ public boolean doIncludeDebugTimestamps() {
return doIncludeDebugTimestamps;
}
- public boolean isDoIncludeDebugRoutineNames() {
+ public boolean doIncludeDebugRoutineNames() {
return doIncludeDebugRoutineNames;
}
- public boolean isDoIncludeDebugEntryExit() {
+ public boolean doIncludeDebugEntryExit() {
return doIncludeDebugEntryExit;
}
- public boolean isDoIncludeDebugIndentBlocks() {
+ public boolean doIncludeDebugIndentBlocks() {
return doIncludeDebugIndentBlocks;
}
@@ -149,18 +157,17 @@ void setDoIncludeDebugIndentBlocks(boolean doIncludeDebugIndentBlocks) {
public boolean equals(Object o) {
if (this == o) {
return true;
- }
- if (o == null || getClass() != o.getClass()) {
+ } else if (o instanceof LoggingParameters that) {
+ return this.doEnableDebugLogging == that.doEnableDebugLogging
+ && this.doEnableErrorLogging == that.doEnableErrorLogging
+ && this.doEnableProgressLogging == that.doEnableProgressLogging
+ && this.doIncludeDebugEntryExit == that.doIncludeDebugEntryExit
+ && this.doIncludeDebugIndentBlocks == that.doIncludeDebugIndentBlocks
+ && this.doIncludeDebugRoutineNames == that.doIncludeDebugRoutineNames
+ && this.doIncludeDebugTimestamps == that.doIncludeDebugTimestamps;
+ } else {
return false;
}
- LoggingParameters that = (LoggingParameters) o;
- return this.doEnableDebugLogging == that.doEnableDebugLogging
- && this.doEnableErrorLogging == that.doEnableErrorLogging
- && this.doEnableProgressLogging == that.doEnableProgressLogging
- && this.doIncludeDebugEntryExit == that.doIncludeDebugEntryExit
- && this.doIncludeDebugIndentBlocks == that.doIncludeDebugIndentBlocks
- && this.doIncludeDebugRoutineNames == that.doIncludeDebugRoutineNames
- && this.doIncludeDebugTimestamps == that.doIncludeDebugTimestamps;
}
@Override
@@ -174,29 +181,18 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("class Parameters {\n");
-
- sb.append(" doEnableErrorLogging: ").append(toIndentedString(doEnableErrorLogging)).append("\n");
- sb.append(" doEnableProgressLogging: ").append(toIndentedString(doEnableProgressLogging)).append("\n");
- sb.append(" doEnableDebugLogging: ").append(toIndentedString(doEnableDebugLogging)).append("\n");
- sb.append(" doIncludeDebugTimestamps: ").append(toIndentedString(doIncludeDebugTimestamps)).append("\n");
- sb.append(" doIncludeDebugRoutineNames: ").append(toIndentedString(doIncludeDebugRoutineNames)).append("\n");
- sb.append(" doIncludeDebugEntryExit: ").append(toIndentedString(doIncludeDebugEntryExit)).append("\n");
- sb.append(" doIncludeDebugIndentBlocks: ").append(toIndentedString(doIncludeDebugIndentBlocks)).append("\n");
+ sb.append("class LoggingParameters {\n");
+ sb.append(" doEnableErrorLogging: ").append(doEnableErrorLogging).append("\n");
+ sb.append(" doEnableProgressLogging: ").append(doEnableProgressLogging).append("\n");
+ sb.append(" doEnableDebugLogging: ").append(doEnableDebugLogging).append("\n");
+ sb.append(" doIncludeDebugTimestamps: ").append(doIncludeDebugTimestamps).append("\n");
+ sb.append(" doIncludeDebugRoutineNames: ").append(doIncludeDebugRoutineNames).append("\n");
+ sb.append(" doIncludeDebugEntryExit: ").append(doIncludeDebugEntryExit).append("\n");
+ sb.append(" doIncludeDebugIndentBlocks: ").append(doIncludeDebugIndentBlocks).append("\n");
sb.append("}");
return sb.toString();
}
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first line).
- */
- private String toIndentedString(Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-
static {
DEFAULT = new LoggingParameters();
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionRequestValidator.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionRequestValidator.java
index 76f3351ea..cc53a699f 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionRequestValidator.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionRequestValidator.java
@@ -202,7 +202,9 @@ private void validateRequestParametersIndividually(ProjectionState state) {
// Parameters.JSON_PROPERTY_FILTERS
if (params.getFilters() == null) {
- params.setFilters(DEFAULT.getFilters().copy());
+ vparams.setFilters(DEFAULT.getFilters().copy());
+ } else {
+ vparams.setFilters(params.getFilters());
}
// Parameters.JSON_PROPERTY_UTILS
@@ -232,6 +234,7 @@ private void validateRequestParametersIndividually(ProjectionState state) {
);
}
}
+ vparams.setUtils(upList);
}
state.setValidatedParams(vparams);
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionState.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionState.java
index bc44d8175..d5e064271 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionState.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ProjectionState.java
@@ -37,13 +37,13 @@ public ProjectionState(ProjectionRequestKind kind, String projectionId, Paramete
var loggingParams = LoggingParameters.of(params);
- if (loggingParams.doEnableErrorLogging) {
+ if (loggingParams.doEnableErrorLogging()) {
errorLog = new MessageLog(Level.ERROR);
} else {
errorLog = new NullMessageLog(Level.ERROR);
}
- if (loggingParams.doEnableProgressLogging) {
+ if (loggingParams.doEnableProgressLogging()) {
progressLog = new MessageLog(Level.INFO);
} else {
progressLog = new NullMessageLog(Level.INFO);
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedParameters.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedParameters.java
index 793c27a18..0f742f441 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedParameters.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedParameters.java
@@ -90,11 +90,6 @@ public boolean containsOption(DebugOption option) {
return selectedDebugOptions.contains(option);
}
- public ValidatedParameters outputFormat(OutputFormat outputFormat) {
- this.outputFormat = outputFormat;
- return this;
- }
-
/**
* Identifies the output file format. Default: YieldTable
*
@@ -104,22 +99,13 @@ public OutputFormat getOutputFormat() {
return outputFormat;
}
- public void setOutputFormat(OutputFormat outputFormat) {
+ public ValidatedParameters outputFormat(OutputFormat outputFormat) {
this.outputFormat = outputFormat;
- }
-
- public ValidatedParameters selectedExecutionOptions(List selectedExecutionOptions) {
- this.selectedExecutionOptions = selectedExecutionOptions;
return this;
}
- public ValidatedParameters
- addSelectedExecutionOptionsItem(ExecutionOption selectedExecutionOptionsItem) {
- if (this.selectedExecutionOptions == null) {
- this.selectedExecutionOptions = new ArrayList<>();
- }
- this.selectedExecutionOptions.add(selectedExecutionOptionsItem);
- return this;
+ public void setOutputFormat(OutputFormat outputFormat) {
+ this.outputFormat = outputFormat;
}
/**
@@ -131,21 +117,24 @@ public List getSelectedExecutionOptions() {
return Collections.unmodifiableList(selectedExecutionOptions);
}
- public void setSelectedExecutionOptions(List selectedExecutionOptions) {
- this.selectedExecutionOptions = selectedExecutionOptions;
+ public ValidatedParameters selectedExecutionOptions(List selectedExecutionOptions) {
+ setSelectedExecutionOptions(selectedExecutionOptions);
+ return this;
}
- public ValidatedParameters selectedDebugOptions(List selectedDebugOptions) {
- this.selectedDebugOptions = selectedDebugOptions;
+ public ValidatedParameters addSelectedExecutionOptionsItem(ExecutionOption selectedExecutionOptionsItem) {
+ if (this.selectedExecutionOptions == null) {
+ this.selectedExecutionOptions = new ArrayList<>();
+ }
+ this.selectedExecutionOptions.add(selectedExecutionOptionsItem);
return this;
}
- public ValidatedParameters addSelectedDebugOptionsItem(DebugOption selectedDebugOptionsItem) {
- if (this.selectedDebugOptions == null) {
- this.selectedDebugOptions = new ArrayList<>();
+ public void setSelectedExecutionOptions(List selectedExecutionOptions) {
+ this.selectedExecutionOptions = new ArrayList<>();
+ if (selectedExecutionOptions != null) {
+ selectedExecutionOptions.stream().forEach(o -> this.selectedExecutionOptions.add(o));
}
- this.selectedDebugOptions.add(selectedDebugOptionsItem);
- return this;
}
/**
@@ -157,15 +146,26 @@ public List getSelectedDebugOptions() {
return Collections.unmodifiableList(selectedDebugOptions);
}
- public void setSelectedDebugOptions(List selectedDebugOptions) {
- this.selectedDebugOptions = selectedDebugOptions;
+ public ValidatedParameters selectedDebugOptions(List selectedDebugOptions) {
+ setSelectedDebugOptions(selectedDebugOptions);
+ return this;
}
- public ValidatedParameters ageStart(Integer ageStart) {
- this.ageStart = ageStart;
+ public ValidatedParameters addSelectedDebugOptionsItem(DebugOption selectedDebugOptionsItem) {
+ if (this.selectedDebugOptions == null) {
+ this.selectedDebugOptions = new ArrayList<>();
+ }
+ this.selectedDebugOptions.add(selectedDebugOptionsItem);
return this;
}
+ public void setSelectedDebugOptions(List selectedDebugOptions) {
+ this.selectedDebugOptions = new ArrayList<>();
+ if (selectedDebugOptions != null) {
+ selectedDebugOptions.stream().forEach(o -> this.selectedDebugOptions.add(o));
+ }
+ }
+
/**
* The starting age value for the Age Range for generated yield tables.
*
@@ -175,39 +175,39 @@ public Integer getAgeStart() {
return ageStart;
}
- public void setAgeStart(Integer ageStart) {
- this.ageStart = ageStart;
+ public ValidatedParameters ageStart(Integer ageStart) {
+ setAgeStart(ageStart);
+ return this;
}
- ValidatedParameters minAgeStart(Integer minAgeStart) {
- this.minAgeStart = minAgeStart;
- return this;
+ public void setAgeStart(Integer ageStart) {
+ this.ageStart = ageStart;
}
Integer getMinAgeStart() {
return minAgeStart;
}
- void setMinAgeStart(Integer minAgeStart) {
- this.minAgeStart = minAgeStart;
+ ValidatedParameters minAgeStart(Integer minAgeStart) {
+ setMinAgeStart(minAgeStart);
+ return this;
}
- ValidatedParameters maxAgeStart(Integer maxAgeStart) {
- this.maxAgeStart = maxAgeStart;
- return this;
+ void setMinAgeStart(Integer minAgeStart) {
+ this.minAgeStart = minAgeStart;
}
Integer getMaxAgeStart() {
return maxAgeStart;
}
- void setMaxAgeStart(Integer maxAgeStart) {
- this.maxAgeStart = maxAgeStart;
+ ValidatedParameters maxAgeStart(Integer maxAgeStart) {
+ setMaxAgeStart(maxAgeStart);
+ return this;
}
- public ValidatedParameters ageEnd(Integer ageEnd) {
- this.ageEnd = ageEnd;
- return this;
+ void setMaxAgeStart(Integer maxAgeStart) {
+ this.maxAgeStart = maxAgeStart;
}
/**
@@ -219,39 +219,39 @@ public Integer getAgeEnd() {
return ageEnd;
}
- public void setAgeEnd(Integer ageEnd) {
- this.ageEnd = ageEnd;
+ public ValidatedParameters ageEnd(Integer ageEnd) {
+ setAgeEnd(ageEnd);
+ return this;
}
- ValidatedParameters minAgeEnd(Integer minAgeEnd) {
- this.minAgeEnd = minAgeEnd;
- return this;
+ public void setAgeEnd(Integer ageEnd) {
+ this.ageEnd = ageEnd;
}
Integer getMinAgeEnd() {
return minAgeEnd;
}
- void setMinAgeEnd(Integer minAgeEnd) {
- this.minAgeEnd = minAgeEnd;
+ ValidatedParameters minAgeEnd(Integer minAgeEnd) {
+ setMinAgeEnd(minAgeEnd);
+ return this;
}
- ValidatedParameters maxAgeEnd(Integer maxAgeEnd) {
- this.maxAgeEnd = maxAgeEnd;
- return this;
+ void setMinAgeEnd(Integer minAgeEnd) {
+ this.minAgeEnd = minAgeEnd;
}
Integer getMaxAgeEnd() {
return maxAgeEnd;
}
- void setMaxAgeEnd(Integer maxAgeEnd) {
- this.maxAgeEnd = maxAgeEnd;
+ ValidatedParameters maxAgeEnd(Integer maxAgeEnd) {
+ setMaxAgeEnd(maxAgeEnd);
+ return this;
}
- public ValidatedParameters yearStart(Integer yearStart) {
- this.yearStart = yearStart;
- return this;
+ void setMaxAgeEnd(Integer maxAgeEnd) {
+ this.maxAgeEnd = maxAgeEnd;
}
/**
@@ -263,39 +263,39 @@ public Integer getYearStart() {
return yearStart;
}
- public void setYearStart(Integer yearStart) {
- this.yearStart = yearStart;
+ public ValidatedParameters yearStart(Integer yearStart) {
+ setYearStart(yearStart);
+ return this;
}
- ValidatedParameters minYearStart(Integer minYearStart) {
- this.minYearStart = minYearStart;
- return this;
+ public void setYearStart(Integer yearStart) {
+ this.yearStart = yearStart;
}
Integer getMinYearStart() {
return minYearStart;
}
- void setMinYearStart(Integer minYearStart) {
- this.minYearStart = minYearStart;
+ ValidatedParameters minYearStart(Integer minYearStart) {
+ setMinYearStart(minYearStart);
+ return this;
}
- ValidatedParameters maxYearStart(Integer maxYearStart) {
- this.maxYearStart = maxYearStart;
- return this;
+ void setMinYearStart(Integer minYearStart) {
+ this.minYearStart = minYearStart;
}
Integer getMaxYearStart() {
return maxYearStart;
}
- void setMaxYearStart(Integer maxYearStart) {
- this.maxYearStart = maxYearStart;
+ ValidatedParameters maxYearStart(Integer maxYearStart) {
+ setMaxYearStart(maxYearStart);
+ return this;
}
- public ValidatedParameters yearEnd(Integer yearEnd) {
- this.yearEnd = yearEnd;
- return this;
+ void setMaxYearStart(Integer maxYearStart) {
+ this.maxYearStart = maxYearStart;
}
/**
@@ -307,6 +307,11 @@ public Integer getYearEnd() {
return yearEnd;
}
+ public ValidatedParameters yearEnd(Integer yearEnd) {
+ setYearEnd(yearEnd);
+ return this;
+ }
+
public void setYearEnd(Integer yearEnd) {
this.yearEnd = yearEnd;
}
@@ -337,11 +342,6 @@ void setMaxYearEnd(Integer maxYearEnd) {
this.maxYearEnd = maxYearEnd;
}
- public ValidatedParameters forceYear(Integer forceYear) {
- this.forceYear = forceYear;
- return this;
- }
-
/**
* Forces the inclusion of the specified calendar year in Yield tables.
*
@@ -351,13 +351,13 @@ public Integer getForceYear() {
return forceYear;
}
- public void setForceYear(Integer forceYear) {
- this.forceYear = forceYear;
+ public ValidatedParameters forceYear(Integer forceYear) {
+ setForceYear(forceYear);
+ return this;
}
- public ValidatedParameters ageIncrement(Integer ageIncrement) {
- this.ageIncrement = ageIncrement;
- return this;
+ public void setForceYear(Integer forceYear) {
+ this.forceYear = forceYear;
}
/**
@@ -369,13 +369,13 @@ public Integer getAgeIncrement() {
return ageIncrement;
}
- public void setAgeIncrement(Integer ageIncrement) {
- this.ageIncrement = ageIncrement;
+ public ValidatedParameters ageIncrement(Integer ageIncrement) {
+ setAgeIncrement(ageIncrement);
+ return this;
}
- public ValidatedParameters minAgeIncrement(Integer minAgeIncrement) {
- this.minAgeIncrement = minAgeIncrement;
- return this;
+ public void setAgeIncrement(Integer ageIncrement) {
+ this.ageIncrement = ageIncrement;
}
/**
@@ -387,13 +387,13 @@ public Integer getMinAgeIncrement() {
return minAgeIncrement;
}
- public void setMinAgeIncrement(Integer minAgeIncrement) {
- this.minAgeIncrement = minAgeIncrement;
+ public ValidatedParameters minAgeIncrement(Integer minAgeIncrement) {
+ setMinAgeIncrement(minAgeIncrement);
+ return this;
}
- public ValidatedParameters maxAgeIncrement(Integer maxAgeIncrement) {
- this.maxAgeIncrement = maxAgeIncrement;
- return this;
+ public void setMinAgeIncrement(Integer minAgeIncrement) {
+ this.minAgeIncrement = minAgeIncrement;
}
/**
@@ -405,13 +405,13 @@ public Integer getMaxAgeIncrement() {
return maxAgeIncrement;
}
- public void setMaxAgeIncrement(Integer maxAgeIncrement) {
- this.maxAgeIncrement = maxAgeIncrement;
+ public ValidatedParameters maxAgeIncrement(Integer maxAgeIncrement) {
+ setMaxAgeIncrement(maxAgeIncrement);
+ return this;
}
- public ValidatedParameters combineAgeYearRange(AgeYearRangeCombinationKind combineAgeYearRange) {
- this.combineAgeYearRange = combineAgeYearRange;
- return this;
+ public void setMaxAgeIncrement(Integer maxAgeIncrement) {
+ this.maxAgeIncrement = maxAgeIncrement;
}
/**
@@ -423,13 +423,13 @@ public AgeYearRangeCombinationKind getCombineAgeYearRange() {
return combineAgeYearRange;
}
- public void setCombineAgeYearRange(AgeYearRangeCombinationKind combineAgeYearRange) {
- this.combineAgeYearRange = combineAgeYearRange;
+ public ValidatedParameters combineAgeYearRange(AgeYearRangeCombinationKind combineAgeYearRange) {
+ setCombineAgeYearRange(combineAgeYearRange);
+ return this;
}
- public ValidatedParameters progressFrequency(ProgressFrequency progressFrequency) {
- this.progressFrequency = progressFrequency;
- return this;
+ public void setCombineAgeYearRange(AgeYearRangeCombinationKind combineAgeYearRange) {
+ this.combineAgeYearRange = combineAgeYearRange;
}
/**
@@ -441,13 +441,13 @@ public ProgressFrequency getProgressFrequency() {
return progressFrequency;
}
- public void setProgressFrequency(ProgressFrequency progressFrequency) {
- this.progressFrequency = progressFrequency.copy();
+ public ValidatedParameters progressFrequency(ProgressFrequency progressFrequency) {
+ setProgressFrequency(progressFrequency);
+ return this;
}
- public ValidatedParameters metadataToOutput(MetadataToOutputDirective metadataToOutput) {
- this.metadataToOutput = metadataToOutput;
- return this;
+ public void setProgressFrequency(ProgressFrequency progressFrequency) {
+ this.progressFrequency = progressFrequency == null ? null : progressFrequency.copy();
}
/**
@@ -459,13 +459,13 @@ public MetadataToOutputDirective getMetadataToOutput() {
return metadataToOutput;
}
- public void setMetadataToOutput(MetadataToOutputDirective metadataToOutput) {
- this.metadataToOutput = metadataToOutput;
+ public ValidatedParameters metadataToOutput(MetadataToOutputDirective metadataToOutput) {
+ setMetadataToOutput(metadataToOutput);
+ return this;
}
- public ValidatedParameters filters(Filters filters) {
- this.filters = filters;
- return this;
+ public void setMetadataToOutput(MetadataToOutputDirective metadataToOutput) {
+ this.metadataToOutput = metadataToOutput;
}
/**
@@ -477,12 +477,26 @@ public Filters getFilters() {
return filters;
}
+ public ValidatedParameters filters(Filters filters) {
+ setFilters(filters);
+ return this;
+ }
+
public void setFilters(Filters filters) {
- this.filters = filters;
+ this.filters = filters == null ? null : filters.copy();
+ }
+
+ /**
+ * Get utils
+ *
+ * @return utils
+ */
+ public List getUtils() {
+ return Collections.unmodifiableList(utils);
}
public ValidatedParameters utils(List utils) {
- this.utils = utils;
+ setUtils(utils);
return this;
}
@@ -494,17 +508,11 @@ public ValidatedParameters addUtilsItem(ValidatedUtilizationParameter utilsItem)
return this;
}
- /**
- * Get utils
- *
- * @return utils
- */
- public List getUtils() {
- return Collections.unmodifiableList(utils);
- }
-
public void setUtils(List utils) {
- this.utils = utils;
+ this.utils = new ArrayList<>();
+ if (utils != null) {
+ utils.stream().forEach(u -> this.utils.add(u));
+ }
}
@Override
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedUtilizationParameter.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedUtilizationParameter.java
index 946e1aeeb..876571cc9 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedUtilizationParameter.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/projection/ValidatedUtilizationParameter.java
@@ -24,7 +24,8 @@
* This class records a utilization class for a given sp0 (species group) name.
*/
@JsonPropertyOrder(
- { ValidatedUtilizationParameter.JSON_PROPERTY_SPECIES_NAME, ValidatedUtilizationParameter.JSON_PROPERTY_UTILIZATION_CLASS }
+ { ValidatedUtilizationParameter.JSON_PROPERTY_SPECIES_NAME,
+ ValidatedUtilizationParameter.JSON_PROPERTY_UTILIZATION_CLASS }
)
@RegisterForReflection
public class ValidatedUtilizationParameter {
@@ -46,8 +47,7 @@ public ValidatedUtilizationParameter speciesName(String speciesName) {
*
* @return speciesName
**/
- @JsonProperty(value = "speciesName")
-
+ @JsonProperty(value = JSON_PROPERTY_SPECIES_NAME)
public String getSpeciesName() {
return speciesName;
}
@@ -61,7 +61,7 @@ public void setSpeciesName(String speciesName) {
*
* @return utilizationClass
**/
- @JsonProperty(value = "utilizationClass")
+ @JsonProperty(value = JSON_PROPERTY_UTILIZATION_CLASS)
public UtilizationParameter.UtilizationClass getUtilizationClass() {
return utilizationClass;
}
@@ -84,7 +84,8 @@ public boolean equals(Object o) {
return false;
}
ValidatedUtilizationParameter up = (ValidatedUtilizationParameter) o;
- return Objects.equals(this.speciesName, up.speciesName) && Objects.equals(this.utilizationClass, up.utilizationClass);
+ return Objects.equals(this.speciesName, up.speciesName)
+ && Objects.equals(this.utilizationClass, up.utilizationClass);
}
@Override
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/services/HelpService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/services/HelpService.java
index 9ca18810d..fd22220d1 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/services/HelpService.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/services/HelpService.java
@@ -264,9 +264,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"If present, a column indicating how the yield table row was projected is included in Yield Tables.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_PROJECTION_MODE_IN_YIELD_TABLE
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_PROJECTION_MODE_IN_YIELD_TABLE)
)
)
);
@@ -279,9 +278,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"Includes or excludes age rows of the Age Range in the Yield Table.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_AGE_ROWS_IN_YIELD_TABLE
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_AGE_ROWS_IN_YIELD_TABLE)
)
)
);
@@ -294,9 +292,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"If true, the year rows of the Year Range are included in the Yield Table.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_YEAR_ROWS_IN_YIELD_TABLE
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_YEAR_ROWS_IN_YIELD_TABLE)
)
)
);
@@ -413,9 +410,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"If present, projected values are summarized at the polygon level.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_POLYGON
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_POLYGON)
)
)
);
@@ -428,9 +424,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"If present, projected values are summarized at the layer level.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_LAYER
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_LAYER)
)
)
);
@@ -457,9 +452,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"Indicate whether MoF projected volumes are included in the output.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_PROJECTED_MOF_VOLUMES
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_PROJECTED_MOF_VOLUMES)
)
)
);
@@ -472,9 +466,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"Indicate whether projected MoF biomass is included in the output.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_PROJECTED_MOF_BIOMASS
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_PROJECTED_MOF_BIOMASS)
)
)
);
@@ -487,9 +480,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"Indicate whether projected CFS biomass is included in the output.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
)
)
);
@@ -502,9 +494,8 @@ public HelpResource helpGet(UriInfo uriInfo, SecurityContext securityContext) th
"true if present", //
"Indicate whether formatted yield tables will include column headers or not.", //
Boolean.toString(
- ValidatedParameters.DEFAULT.getSelectedExecutionOptions().contains(
- Parameters.ExecutionOption.DO_INCLUDE_COLUMN_HEADERS_IN_YIELD_TABLE
- )
+ ValidatedParameters.DEFAULT.getSelectedExecutionOptions()
+ .contains(Parameters.ExecutionOption.DO_INCLUDE_COLUMN_HEADERS_IN_YIELD_TABLE)
)
)
);
diff --git a/backend/src/test/java/ca/bc/gov/nrs/api/helpers/TestHelper.java b/backend/src/test/java/ca/bc/gov/nrs/api/helpers/TestHelper.java
index 558f1082b..e32bbaab1 100644
--- a/backend/src/test/java/ca/bc/gov/nrs/api/helpers/TestHelper.java
+++ b/backend/src/test/java/ca/bc/gov/nrs/api/helpers/TestHelper.java
@@ -50,8 +50,7 @@ public InputStream buildTestFile() throws IOException {
return new ByteArrayInputStream("Test data".getBytes());
}
- public Parameters
- addSelectedOptions(Parameters params, Parameters.ExecutionOption... executionOptions) {
+ public Parameters addSelectedOptions(Parameters params, Parameters.ExecutionOption... executionOptions) {
params.setSelectedExecutionOptions(List.of(executionOptions));
diff --git a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/endpoints/v1/HcsvProjectionEndpointTest.java b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/endpoints/v1/HcsvProjectionEndpointTest.java
index 8de98050a..7c0147216 100644
--- a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/endpoints/v1/HcsvProjectionEndpointTest.java
+++ b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/endpoints/v1/HcsvProjectionEndpointTest.java
@@ -1,8 +1,7 @@
package ca.bc.gov.nrs.vdyp.backend.endpoints.v1;
import static io.restassured.RestAssured.given;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.io.IOException;
import java.io.InputStream;
@@ -16,6 +15,8 @@
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import ca.bc.gov.nrs.api.helpers.TestHelper;
import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters;
@@ -26,6 +27,8 @@
@QuarkusTest
class HcsvProjectionEndpointTest {
+ private static final Logger logger = LoggerFactory.getLogger(HcsvProjectionEndpointTest.class);
+
private final TestHelper testHelper;
@Inject
@@ -40,6 +43,8 @@ void setup() {
@Test
void testProjectionHscv_shouldReturnStatusOK() throws IOException {
+ logger.info("Starting testProjectionHscv_shouldReturnStatusOK");
+
Path resourceFolderPath = Path.of("VDYP7Console-sample-files", "hcsv", "vdyp-240");
Parameters parameters = testHelper.addSelectedOptions(
diff --git a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ParametersTest.java b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ParametersTest.java
index 547cea9bf..7b2a43599 100644
--- a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ParametersTest.java
+++ b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/model/v1/ParametersTest.java
@@ -38,15 +38,9 @@ public void testParametersProvider() throws WebApplicationException, IOException
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_DEBUG_LOGGING);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_ERROR_LOGGING);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_PROGRESS_LOGGING);
- op.addSelectedExecutionOptionsItem(
- ExecutionOption.DO_FORCE_CALENDAR_YEAR_INCLUSION_IN_YIELD_TABLES
- );
- op.addSelectedExecutionOptionsItem(
- ExecutionOption.DO_FORCE_CURRENT_YEAR_INCLUSION_IN_YIELD_TABLES
- );
- op.addSelectedExecutionOptionsItem(
- ExecutionOption.DO_FORCE_REFERENCE_YEAR_INCLUSION_IN_YIELD_TABLES
- );
+ op.addSelectedExecutionOptionsItem(ExecutionOption.DO_FORCE_CALENDAR_YEAR_INCLUSION_IN_YIELD_TABLES);
+ op.addSelectedExecutionOptionsItem(ExecutionOption.DO_FORCE_CURRENT_YEAR_INCLUSION_IN_YIELD_TABLES);
+ op.addSelectedExecutionOptionsItem(ExecutionOption.DO_FORCE_REFERENCE_YEAR_INCLUSION_IN_YIELD_TABLES);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_AGE_ROWS_IN_YIELD_TABLE);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_COLUMN_HEADERS_IN_YIELD_TABLE);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_FILE_HEADER);
@@ -55,9 +49,7 @@ public void testParametersProvider() throws WebApplicationException, IOException
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_BIOMASS);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_VOLUMES);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTION_MODE_IN_YIELD_TABLE);
- op.addSelectedExecutionOptionsItem(
- ExecutionOption.DO_INCLUDE_SECONDARY_SPECIES_DOMINANT_HEIGHT_IN_YIELD_TABLE
- );
+ op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_SECONDARY_SPECIES_DOMINANT_HEIGHT_IN_YIELD_TABLE);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_SPECIES_PROJECTION);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_YEAR_ROWS_IN_YIELD_TABLE);
op.addSelectedExecutionOptionsItem(ExecutionOption.DO_SAVE_INTERMEDIATE_FILES);
@@ -126,7 +118,9 @@ void testProgressFrequency() {
new ProgressFrequency(ProgressFrequency.FrequencyKind.MAPSHEET).getEnumValue()
);
- Assert.assertThrows(IllegalArgumentException.class, () -> ProgressFrequency.FrequencyKind.fromValue("not a value"));
+ Assert.assertThrows(
+ IllegalArgumentException.class, () -> ProgressFrequency.FrequencyKind.fromValue("not a value")
+ );
ProgressFrequency pf1 = new ProgressFrequency(12);
ProgressFrequency pf2 = new ProgressFrequency(ProgressFrequency.FrequencyKind.MAPSHEET);
@@ -143,15 +137,17 @@ void testProgressFrequency() {
@Test
void testUtilizationParameter() {
Assert.assertEquals(
- "AL", new ValidatedUtilizationParameter().speciesName("AL").utilizationClass(UtilizationClass._12_5).getSpeciesName()
+ "AL",
+ new ValidatedUtilizationParameter().speciesName("AL").utilizationClass(UtilizationClass._12_5)
+ .getSpeciesName()
);
Assert.assertEquals(
- UtilizationClass._17_5, new ValidatedUtilizationParameter().speciesName("AL").utilizationClass(UtilizationClass._17_5).getUtilizationClass()
+ UtilizationClass._17_5,
+ new ValidatedUtilizationParameter().speciesName("AL").utilizationClass(UtilizationClass._17_5)
+ .getUtilizationClass()
);
- Assert.assertThrows(
- IllegalArgumentException.class, () -> UtilizationClass.fromValue("ZZZ")
- );
+ Assert.assertThrows(IllegalArgumentException.class, () -> UtilizationClass.fromValue("ZZZ"));
var up1 = new ValidatedUtilizationParameter().speciesName("AL").utilizationClass(UtilizationClass._12_5);
var up2 = new ValidatedUtilizationParameter().speciesName("C").utilizationClass(UtilizationClass._12_5);
@@ -163,6 +159,6 @@ UtilizationClass._17_5, new ValidatedUtilizationParameter().speciesName("AL").ut
Assert.assertFalse(up2.equals("C"));
Assert.assertTrue(up1.toString().indexOf("speciesName: AL") != -1);
- Assert.assertTrue(up1.toString().indexOf("value: 12.5") != -1);
+ Assert.assertTrue(up1.toString().indexOf("utilizationClass: 12.5") != -1);
}
}
diff --git a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/ParameterValidationTest.java b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/ParameterValidationTest.java
index 8d4fb0ba6..029ebe9e4 100644
--- a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/ParameterValidationTest.java
+++ b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/ParameterValidationTest.java
@@ -10,11 +10,15 @@
import org.junit.Assert;
import org.junit.jupiter.api.Test;
+import ca.bc.gov.nrs.vdyp.backend.model.v1.Filters;
import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters;
+import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.AgeYearRangeCombinationKind;
import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.DebugOption;
import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.ExecutionOption;
+import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.MetadataToOutputDirective;
import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.OutputFormat;
import ca.bc.gov.nrs.vdyp.backend.model.v1.ProgressFrequency;
+import ca.bc.gov.nrs.vdyp.backend.model.v1.ProgressFrequency.FrequencyKind;
import ca.bc.gov.nrs.vdyp.backend.model.v1.ProjectionRequestKind;
import ca.bc.gov.nrs.vdyp.backend.model.v1.UtilizationParameter;
import ca.bc.gov.nrs.vdyp.backend.model.v1.UtilizationParameter.UtilizationClass;
@@ -22,13 +26,16 @@
import ca.bc.gov.nrs.vdyp.backend.model.v1.ValidationMessageKind;
import jakarta.ws.rs.WebApplicationException;
-public class ParameterValidationTest {
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+
+class ParameterValidationTest {
@Test
- public void testNoParametersSupplied() throws WebApplicationException, IOException {
+ void testNoParametersSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -36,10 +43,10 @@ public void testNoParametersSupplied() throws WebApplicationException, IOExcepti
}
@Test
- public void testOnlyAgeStartParameterSupplied() throws WebApplicationException, IOException {
+ void testOnlyAgeStartParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageStart(1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageStart(1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -47,10 +54,10 @@ public void testOnlyAgeStartParameterSupplied() throws WebApplicationException,
}
@Test
- public void testAgeStartTooLowParameterSupplied() throws WebApplicationException, IOException {
+ void testAgeStartTooLowParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageEnd(400).ageStart(ValidatedParameters.DEFAULT.getMinAgeStart() - 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageEnd(400).ageStart(ValidatedParameters.DEFAULT.getMinAgeStart() - 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -58,10 +65,10 @@ public void testAgeStartTooLowParameterSupplied() throws WebApplicationException
}
@Test
- public void testAgeStartTooHighParameterSupplied() throws WebApplicationException, IOException {
+ void testAgeStartTooHighParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageEnd(400).ageStart(ValidatedParameters.DEFAULT.getMaxAgeStart() + 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageEnd(400).ageStart(ValidatedParameters.DEFAULT.getMaxAgeStart() + 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -69,10 +76,10 @@ public void testAgeStartTooHighParameterSupplied() throws WebApplicationExceptio
}
@Test
- public void testOnlyYearStartParameterSupplied() throws WebApplicationException, IOException {
+ void testOnlyYearStartParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().yearStart(ValidatedParameters.DEFAULT.getMinYearStart());
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().yearStart(ValidatedParameters.DEFAULT.getMinYearStart());
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -80,10 +87,10 @@ public void testOnlyYearStartParameterSupplied() throws WebApplicationException,
}
@Test
- public void testYearStartTooLowParameterSupplied() throws WebApplicationException, IOException {
+ void testYearStartTooLowParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageEnd(400).yearStart(ValidatedParameters.DEFAULT.getMinYearStart() - 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageEnd(400).yearStart(ValidatedParameters.DEFAULT.getMinYearStart() - 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -91,10 +98,10 @@ public void testYearStartTooLowParameterSupplied() throws WebApplicationExceptio
}
@Test
- public void testYearStartTooHighParameterSupplied() throws WebApplicationException, IOException {
+ void testYearStartTooHighParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageEnd(400).yearStart(ValidatedParameters.DEFAULT.getMaxYearStart() + 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageEnd(400).yearStart(ValidatedParameters.DEFAULT.getMaxYearStart() + 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -102,10 +109,10 @@ public void testYearStartTooHighParameterSupplied() throws WebApplicationExcepti
}
@Test
- public void testOnlyAgeEndParameterSupplied() throws WebApplicationException, IOException {
+ void testOnlyAgeEndParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageEnd(400);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageEnd(400);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -113,10 +120,10 @@ public void testOnlyAgeEndParameterSupplied() throws WebApplicationException, IO
}
@Test
- public void testAgeEndTooLowParameterSupplied() throws WebApplicationException, IOException {
+ void testAgeEndTooLowParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageStart(1).ageEnd(ValidatedParameters.DEFAULT.getMinAgeEnd() - 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageStart(1).ageEnd(ValidatedParameters.DEFAULT.getMinAgeEnd() - 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -124,10 +131,10 @@ public void testAgeEndTooLowParameterSupplied() throws WebApplicationException,
}
@Test
- public void testAgeEndTooHighParameterSupplied() throws WebApplicationException, IOException {
+ void testAgeEndTooHighParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().ageStart(1).ageEnd(ValidatedParameters.DEFAULT.getMaxAgeEnd() + 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().ageStart(1).ageEnd(ValidatedParameters.DEFAULT.getMaxAgeEnd() + 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -135,10 +142,10 @@ public void testAgeEndTooHighParameterSupplied() throws WebApplicationException,
}
@Test
- public void testOnlyYearEndParameterSupplied() throws WebApplicationException, IOException {
+ void testOnlyYearEndParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().yearEnd(1500);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().yearEnd(1500);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -146,10 +153,10 @@ public void testOnlyYearEndParameterSupplied() throws WebApplicationException, I
}
@Test
- public void testYearEndTooLowParameterSupplied() throws WebApplicationException, IOException {
+ void testYearEndTooLowParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().yearStart(1500).yearEnd(ValidatedParameters.DEFAULT.getMinYearEnd() - 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().yearStart(1500).yearEnd(ValidatedParameters.DEFAULT.getMinYearEnd() - 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -157,10 +164,10 @@ public void testYearEndTooLowParameterSupplied() throws WebApplicationException,
}
@Test
- public void testYearEndTooHighParameterSupplied() throws WebApplicationException, IOException {
+ void testYearEndTooHighParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().yearStart(1500).yearEnd(ValidatedParameters.DEFAULT.getMaxYearEnd() + 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().yearStart(1500).yearEnd(ValidatedParameters.DEFAULT.getMaxYearEnd() + 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -168,10 +175,10 @@ public void testYearEndTooHighParameterSupplied() throws WebApplicationException
}
@Test
- public void testAgeIncrementTooLowParameterSupplied() throws WebApplicationException, IOException {
+ void testAgeIncrementTooLowParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject().ageIncrement(ValidatedParameters.DEFAULT.getMinAgeIncrement() - 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject().ageIncrement(ValidatedParameters.DEFAULT.getMinAgeIncrement() - 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -179,10 +186,10 @@ public void testAgeIncrementTooLowParameterSupplied() throws WebApplicationExcep
}
@Test
- public void testAgeIncrementTooHighParameterSupplied() throws WebApplicationException, IOException {
+ void testAgeIncrementTooHighParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject().ageIncrement(ValidatedParameters.DEFAULT.getMaxAgeIncrement() + 1);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject().ageIncrement(ValidatedParameters.DEFAULT.getMaxAgeIncrement() + 1);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -190,10 +197,10 @@ public void testAgeIncrementTooHighParameterSupplied() throws WebApplicationExce
}
@Test
- public void testValidAgeIncrementSupplied() throws WebApplicationException, IOException {
+ void testValidAgeIncrementSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject().ageIncrement(ValidatedParameters.DEFAULT.getMaxAgeIncrement());
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject().ageIncrement(ValidatedParameters.DEFAULT.getMaxAgeIncrement());
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -201,10 +208,10 @@ public void testValidAgeIncrementSupplied() throws WebApplicationException, IOEx
}
@Test
- public void testValidAgeStartAndEndParameterSupplied() throws WebApplicationException, IOException {
+ void testValidAgeStartAndEndParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -212,10 +219,10 @@ public void testValidAgeStartAndEndParameterSupplied() throws WebApplicationExce
}
@Test
- public void testValidYearStartAndEndParameterSupplied() throws WebApplicationException, IOException {
+ void testValidYearStartAndEndParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = new Parameters().yearStart(1600).yearEnd(2100);
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = new Parameters().yearStart(1600).yearEnd(2100);
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -223,12 +230,12 @@ public void testValidYearStartAndEndParameterSupplied() throws WebApplicationExc
}
@Test
- public void testInvalidOutputFormatOptionSupplied() throws WebApplicationException, IOException {
+ void testInvalidOutputFormatOptionSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setOutputFormat("bad output format");
+ p.setOutputFormat("bad output format");
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -236,12 +243,12 @@ public void testInvalidOutputFormatOptionSupplied() throws WebApplicationExcepti
}
@Test
- public void testValidOutputFormatOptionSupplied() throws WebApplicationException, IOException {
+ void testValidOutputFormatOptionSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setOutputFormat(Parameters.OutputFormat.CSV_YIELD_TABLE);
+ p.setOutputFormat(Parameters.OutputFormat.CSV_YIELD_TABLE);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -249,12 +256,12 @@ public void testValidOutputFormatOptionSupplied() throws WebApplicationException
}
@Test
- public void testInvalidCombineAgeYearRangeOptionSupplied() throws WebApplicationException, IOException {
+ void testInvalidCombineAgeYearRangeOptionSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setCombineAgeYearRange("bad option");
+ p.setCombineAgeYearRange("bad option");
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -262,12 +269,12 @@ public void testInvalidCombineAgeYearRangeOptionSupplied() throws WebApplication
}
@Test
- public void testValidCombineAgeYearRangeOptionSupplied() throws WebApplicationException, IOException {
+ void testValidCombineAgeYearRangeOptionSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setCombineAgeYearRange(Parameters.AgeYearRangeCombinationKind.INTERSECT);
+ p.setCombineAgeYearRange(Parameters.AgeYearRangeCombinationKind.INTERSECT);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -275,12 +282,12 @@ public void testValidCombineAgeYearRangeOptionSupplied() throws WebApplicationEx
}
@Test
- public void testInvalidProcessFrequencySupplied() throws WebApplicationException, IOException {
+ void testInvalidProcessFrequencySupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setProgressFrequency("bad option");
+ p.setProgressFrequency("bad option");
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -288,12 +295,12 @@ public void testInvalidProcessFrequencySupplied() throws WebApplicationException
}
@Test
- public void testValidProcessFrequencySupplied1() throws WebApplicationException, IOException {
+ void testValidProcessFrequencySupplied1() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setProgressFrequency(ProgressFrequency.FrequencyKind.MAPSHEET);
+ p.setProgressFrequency(ProgressFrequency.FrequencyKind.MAPSHEET);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -301,12 +308,12 @@ public void testValidProcessFrequencySupplied1() throws WebApplicationException,
}
@Test
- public void testValidProcessFrequencySupplied2() throws WebApplicationException, IOException {
+ void testValidProcessFrequencySupplied2() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setProgressFrequency(100);
+ p.setProgressFrequency(100);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -314,12 +321,12 @@ public void testValidProcessFrequencySupplied2() throws WebApplicationException,
}
@Test
- public void testInvalidMetadataToOutputValueSupplied() throws WebApplicationException, IOException {
+ void testInvalidMetadataToOutputValueSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.setMetadataToOutput("bad option");
+ p.setMetadataToOutput("bad option");
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -327,12 +334,12 @@ public void testInvalidMetadataToOutputValueSupplied() throws WebApplicationExce
}
@Test
- public void testInvalidExecutionOptionSupplied() throws WebApplicationException, IOException {
+ void testInvalidExecutionOptionSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.addSelectedExecutionOptionsItem(ExecutionOption.BACK_GROW_ENABLED)
+ p.addSelectedExecutionOptionsItem(ExecutionOption.BACK_GROW_ENABLED)
.addSelectedExecutionOptionsItem("bad option");
var validator = new ProjectionRequestValidator();
@@ -341,12 +348,12 @@ public void testInvalidExecutionOptionSupplied() throws WebApplicationException,
}
@Test
- public void testInvalidDebugOptionSupplied() throws WebApplicationException, IOException {
+ void testInvalidDebugOptionSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT)
+ p.addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT)
.addSelectedDebugOptionsItem("bad option");
var validator = new ProjectionRequestValidator();
@@ -355,14 +362,14 @@ public void testInvalidDebugOptionSupplied() throws WebApplicationException, IOE
}
@Test
- public void testBadUtilizationParameterSpeciesSupplied() throws WebApplicationException, IOException {
+ void testBadUtilizationParameterSpeciesSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var up = new UtilizationParameter().speciesName("bad species name")
.utilizationClass(UtilizationParameter.UtilizationClass._12_5.getValue());
- p1.addUtilsItem(up);
+ p.addUtilsItem(up);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -370,13 +377,13 @@ public void testBadUtilizationParameterSpeciesSupplied() throws WebApplicationEx
}
@Test
- public void testBadUtilizationParameterUtilizationClassSupplied() throws WebApplicationException, IOException {
+ void testBadUtilizationParameterUtilizationClassSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var up = new UtilizationParameter().speciesName("D").utilizationClass("bad utilization class");
- p1.addUtilsItem(up);
+ p.addUtilsItem(up);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -384,13 +391,13 @@ public void testBadUtilizationParameterUtilizationClassSupplied() throws WebAppl
}
@Test
- public void testBadUtilizationParameterSupplied() throws WebApplicationException, IOException {
+ void testBadUtilizationParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var up = new UtilizationParameter().speciesName("bad species name").utilizationClass("bad utilization class");
- p1.addUtilsItem(up);
+ p.addUtilsItem(up);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -400,13 +407,13 @@ public void testBadUtilizationParameterSupplied() throws WebApplicationException
}
@Test
- public void testValidUtilizationParameterSupplied() throws WebApplicationException, IOException {
+ void testValidUtilizationParameterSupplied() throws WebApplicationException, IOException {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
var up = new UtilizationParameter().speciesName("D").utilizationClass(UtilizationClass._12_5);
- p1.addUtilsItem(up);
+ p.addUtilsItem(up);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -414,12 +421,12 @@ public void testValidUtilizationParameterSupplied() throws WebApplicationExcepti
}
@Test
- public void testInvalidForceYear() {
+ void testInvalidForceYear() {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.forceYear("bad year");
+ p.forceYear("bad year");
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -427,12 +434,12 @@ public void testInvalidForceYear() {
}
@Test
- public void testValidForceYear() {
+ void testValidForceYear() {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.forceYear(2020);
+ p.forceYear(2020);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -440,12 +447,12 @@ public void testValidForceYear() {
}
@Test
- public void testDCSVIssues() {
+ void testDCSVIssues() {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.outputFormat(OutputFormat.DCSV);
+ p.outputFormat(OutputFormat.DCSV);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -456,12 +463,12 @@ public void testDCSVIssues() {
}
@Test
- public void testDCSVIssues2() {
+ void testDCSVIssues2() {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.outputFormat(OutputFormat.DCSV).forceYear(2020);
+ p.outputFormat(OutputFormat.DCSV).forceYear(2020);
var validator = new ProjectionRequestValidator();
validator.validateState(s1);
@@ -471,12 +478,12 @@ public void testDCSVIssues2() {
}
@Test
- public void testCSFBiomassIssues1() {
+ void testCSFBiomassIssues1() {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
+ p.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_BIOMASS);
var validator = new ProjectionRequestValidator();
@@ -488,12 +495,12 @@ public void testCSFBiomassIssues1() {
}
@Test
- public void testCSFBiomassIssues2() {
+ void testCSFBiomassIssues2() {
- Parameters p1 = buildValidParametersObject();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p1);
+ Parameters p = buildValidParametersObject();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
- p1.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
+ p.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_VOLUMES);
var validator = new ProjectionRequestValidator();
@@ -502,12 +509,12 @@ public void testCSFBiomassIssues2() {
}
@Test
- public void testCSFBiomassIssues3() {
+ void testCSFBiomassIssues3() {
- Parameters p1 = new Parameters();
- ProjectionState s1 = new ProjectionState(ProjectionRequestKind.DCSV, "id", p1);
+ Parameters p = new Parameters();
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.DCSV, "id", p);
- p1.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
+ p.addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_CFS_BIOMASS)
.outputFormat(OutputFormat.DCSV).forceYear(2020);
var validator = new ProjectionRequestValidator();
@@ -515,6 +522,121 @@ public void testCSFBiomassIssues3() {
verifyMessageSetIs(validator.getValidationMessages(), INVALID_CFS_BIOMASS_OUTPUT_FORMAT);
}
+ @Test
+ void testValidFullParameterCreation() {
+ Parameters p = new Parameters();
+ p //
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT)
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_INDENT_BLOCKS)
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_ROUTINE_NAMES)
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_TIMESTAMPS)
+ .addSelectedExecutionOptionsItem(ExecutionOption.BACK_GROW_ENABLED)
+ .addSelectedExecutionOptionsItem(
+ ExecutionOption.DO_ALLOW_BASAL_AREA_AND_TREES_PER_HECTARE_VALUE_SUBSTITUTION
+ ).addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_DEBUG_LOGGING)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_ERROR_LOGGING)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_PROGRESS_LOGGING)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_FORCE_CALENDAR_YEAR_INCLUSION_IN_YIELD_TABLES)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_FORCE_CURRENT_YEAR_INCLUSION_IN_YIELD_TABLES)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_FORCE_REFERENCE_YEAR_INCLUSION_IN_YIELD_TABLES)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_AGE_ROWS_IN_YIELD_TABLE)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_COLUMN_HEADERS_IN_YIELD_TABLE)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_FILE_HEADER)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_POLYGON_RECORD_ID_IN_YIELD_TABLE)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_BIOMASS)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_VOLUMES)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_PROJECTION_MODE_IN_YIELD_TABLE)
+ .addSelectedExecutionOptionsItem(
+ ExecutionOption.DO_INCLUDE_SECONDARY_SPECIES_DOMINANT_HEIGHT_IN_YIELD_TABLE
+ ).addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_SPECIES_PROJECTION)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_INCLUDE_YEAR_ROWS_IN_YIELD_TABLE)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_SAVE_INTERMEDIATE_FILES)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_LAYER)
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_POLYGON)
+ .addSelectedExecutionOptionsItem(ExecutionOption.FORWARD_GROW_ENABLED)
+ .addUtilsItem(
+ new ValidatedUtilizationParameter().speciesName("D").utilizationClass(UtilizationClass._12_5)
+ )
+ .addUtilsItem(
+ new ValidatedUtilizationParameter().speciesName("C").utilizationClass(UtilizationClass._4_0)
+ ).ageEnd(10) //
+ .ageIncrement(3) //
+ .ageStart(20) //
+ .combineAgeYearRange(AgeYearRangeCombinationKind.DIFFERENCE) //
+ .filters(
+ new Filters().maintainer("maintainer").mapsheet("mapsheet").polygon("polygon")
+ .polygonId("polygonId")
+ ).forceYear(2020) //
+ .metadataToOutput(MetadataToOutputDirective.ALL) //
+ .outputFormat(OutputFormat.YIELD_TABLE) //
+ .progressFrequency(FrequencyKind.MAPSHEET) //
+ .yearEnd(2024) //
+ .yearStart(2015);
+
+ ProjectionState s1 = new ProjectionState(ProjectionRequestKind.HCSV, "id", p);
+
+ var validator = new ProjectionRequestValidator();
+ validator.validateState(s1);
+ verifyMessageSetIs(validator.getValidationMessages());
+
+ var vp = s1.getValidatedParams();
+
+ Assert.assertTrue(vp.containsOption(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT));
+ Assert.assertTrue(vp.containsOption(DebugOption.DO_INCLUDE_DEBUG_INDENT_BLOCKS));
+ Assert.assertTrue(vp.containsOption(DebugOption.DO_INCLUDE_DEBUG_ROUTINE_NAMES));
+ Assert.assertTrue(vp.containsOption(DebugOption.DO_INCLUDE_DEBUG_TIMESTAMPS));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.BACK_GROW_ENABLED));
+ Assert.assertTrue(
+ vp.containsOption(ExecutionOption.DO_ALLOW_BASAL_AREA_AND_TREES_PER_HECTARE_VALUE_SUBSTITUTION)
+ );
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_ENABLE_DEBUG_LOGGING));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_ENABLE_ERROR_LOGGING));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_ENABLE_PROGRESS_LOGGING));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_FORCE_CALENDAR_YEAR_INCLUSION_IN_YIELD_TABLES));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_FORCE_CURRENT_YEAR_INCLUSION_IN_YIELD_TABLES));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_FORCE_REFERENCE_YEAR_INCLUSION_IN_YIELD_TABLES));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_AGE_ROWS_IN_YIELD_TABLE));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_COLUMN_HEADERS_IN_YIELD_TABLE));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_FILE_HEADER));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_POLYGON_RECORD_ID_IN_YIELD_TABLE));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_BIOMASS));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_PROJECTED_MOF_VOLUMES));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_PROJECTION_MODE_IN_YIELD_TABLE));
+ Assert.assertTrue(
+ vp.containsOption(ExecutionOption.DO_INCLUDE_SECONDARY_SPECIES_DOMINANT_HEIGHT_IN_YIELD_TABLE)
+ );
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_SPECIES_PROJECTION));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_INCLUDE_YEAR_ROWS_IN_YIELD_TABLE));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_SAVE_INTERMEDIATE_FILES));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_LAYER));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.DO_SUMMARIZE_PROJECTION_BY_POLYGON));
+ Assert.assertTrue(vp.containsOption(ExecutionOption.FORWARD_GROW_ENABLED));
+
+ Assert.assertEquals(Integer.valueOf(10), vp.getAgeEnd());
+ Assert.assertEquals(Integer.valueOf(3), vp.getAgeIncrement());
+ Assert.assertEquals(Integer.valueOf(20), vp.getAgeStart());
+ Assert.assertEquals(AgeYearRangeCombinationKind.DIFFERENCE, vp.getCombineAgeYearRange());
+ Assert.assertEquals(Integer.valueOf(2020), vp.getForceYear());
+ Assert.assertEquals(MetadataToOutputDirective.ALL, vp.getMetadataToOutput());
+ Assert.assertEquals(OutputFormat.YIELD_TABLE, vp.getOutputFormat());
+ Assert.assertEquals(FrequencyKind.MAPSHEET, vp.getProgressFrequency().getEnumValue());
+ Assert.assertEquals(Integer.valueOf(2024), vp.getYearEnd());
+ Assert.assertEquals(Integer.valueOf(2015), vp.getYearStart());
+
+ Assert.assertEquals("maintainer", vp.getFilters().getMaintainer());
+ Assert.assertEquals("mapsheet", vp.getFilters().getMapsheet());
+ Assert.assertEquals("polygon", vp.getFilters().getPolygon());
+ Assert.assertEquals("polygonId", vp.getFilters().getPolygonId());
+
+ assertThat(
+ vp.getUtils(),
+ containsInAnyOrder(
+ new ValidatedUtilizationParameter().speciesName("C").utilizationClass(UtilizationClass._4_0),
+ new ValidatedUtilizationParameter().speciesName("D").utilizationClass(UtilizationClass._12_5)
+ )
+ );
+ }
+
// Helpers
private void verifyMessageSetIs(List validationMessages, ValidationMessageKind... kinds) {
diff --git a/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/TestLoggingParameters.java b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/TestLoggingParameters.java
new file mode 100644
index 000000000..01eb6b97d
--- /dev/null
+++ b/backend/src/test/java/ca/bc/gov/nrs/vdyp/backend/projection/TestLoggingParameters.java
@@ -0,0 +1,81 @@
+package ca.bc.gov.nrs.vdyp.backend.projection;
+
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+
+import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters;
+import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.DebugOption;
+import ca.bc.gov.nrs.vdyp.backend.model.v1.Parameters.ExecutionOption;
+
+public class TestLoggingParameters {
+
+ @Test
+ void testNullLoggingParameters() {
+ LoggingParameters lparams1 = LoggingParameters.of(null);
+
+ Assert.assertFalse(lparams1.doEnableDebugLogging());
+ Assert.assertFalse(lparams1.doEnableErrorLogging());
+ Assert.assertFalse(lparams1.doEnableProgressLogging());
+ Assert.assertFalse(lparams1.doIncludeDebugEntryExit());
+ Assert.assertFalse(lparams1.doIncludeDebugIndentBlocks());
+ Assert.assertFalse(lparams1.doIncludeDebugRoutineNames());
+ Assert.assertFalse(lparams1.doIncludeDebugTimestamps());
+ }
+
+ @Test
+ void testLoggingParametersFromParameters() {
+ Parameters p = new Parameters() //
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_ENTRY_EXIT) //
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_INDENT_BLOCKS) //
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_ROUTINE_NAMES) //
+ .addSelectedDebugOptionsItem(DebugOption.DO_INCLUDE_DEBUG_TIMESTAMPS) //
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_DEBUG_LOGGING) //
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_ERROR_LOGGING) //
+ .addSelectedExecutionOptionsItem(ExecutionOption.DO_ENABLE_PROGRESS_LOGGING);
+
+ LoggingParameters lparams1 = LoggingParameters.of(p);
+
+ Assert.assertTrue(lparams1.doEnableDebugLogging());
+ Assert.assertTrue(lparams1.doEnableErrorLogging());
+ Assert.assertTrue(lparams1.doEnableProgressLogging());
+ Assert.assertTrue(lparams1.doIncludeDebugEntryExit());
+ Assert.assertTrue(lparams1.doIncludeDebugIndentBlocks());
+ Assert.assertTrue(lparams1.doIncludeDebugRoutineNames());
+ Assert.assertTrue(lparams1.doIncludeDebugTimestamps());
+
+ var lparams2 = lparams1.copy();
+
+ Assert.assertTrue(lparams1.equals(lparams1));
+ Assert.assertTrue(lparams1.equals(lparams2));
+ Assert.assertFalse(lparams2.equals(new Object()));
+
+ lparams2.setDoEnableDebugLogging(false);
+ lparams2.setDoEnableErrorLogging(false);
+ lparams2.setDoEnableProgressLogging(false);
+ lparams2.setDoIncludeDebugEntryExit(false);
+ lparams2.setDoIncludeDebugIndentBlocks(false);
+ lparams2.setDoIncludeDebugRoutineNames(false);
+ lparams2.setDoIncludeDebugTimestamps(false);
+
+ Assert.assertFalse(lparams2.doEnableDebugLogging());
+ Assert.assertFalse(lparams2.doEnableErrorLogging());
+ Assert.assertFalse(lparams2.doEnableProgressLogging());
+ Assert.assertFalse(lparams2.doIncludeDebugEntryExit());
+ Assert.assertFalse(lparams2.doIncludeDebugIndentBlocks());
+ Assert.assertFalse(lparams2.doIncludeDebugRoutineNames());
+ Assert.assertFalse(lparams2.doIncludeDebugTimestamps());
+
+ System.out.println(LoggingParameters.DEFAULT.toString());
+ }
+
+ @Test
+ void testHashcode() {
+ LoggingParameters lparam = LoggingParameters.DEFAULT.copy();
+
+ Assert.assertEquals(lparam.hashCode(), LoggingParameters.DEFAULT.hashCode());
+
+ lparam.setDoEnableDebugLogging(true);
+
+ Assert.assertNotEquals(lparam.hashCode(), LoggingParameters.DEFAULT.hashCode());
+ }
+}
diff --git a/backend/src/test/resources/logback.xml b/backend/src/test/resources/logback.xml
deleted file mode 100644
index 1cfab2425..000000000
--- a/backend/src/test/resources/logback.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
- projectionId
- not-request-specific
-
-
-
- logs/${projectionId}.log
- true
- false
-
- %d [%thread] %-5level %logger{35}: %msg%n
-
-
-
-
-
-
-
-
- %-4relative [%thread] %-5level %logger{35}: %msg%n
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/lib/vdyp-common/src/test/java/ca/bc/gov/nrs/vdyp/io/ZipOutputFileResolverTest.java b/lib/vdyp-common/src/test/java/ca/bc/gov/nrs/vdyp/io/ZipOutputFileResolverTest.java
index 0f30bc65f..800756d50 100644
--- a/lib/vdyp-common/src/test/java/ca/bc/gov/nrs/vdyp/io/ZipOutputFileResolverTest.java
+++ b/lib/vdyp-common/src/test/java/ca/bc/gov/nrs/vdyp/io/ZipOutputFileResolverTest.java
@@ -1,13 +1,13 @@
package ca.bc.gov.nrs.vdyp.io;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Arrays;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -27,11 +27,14 @@ void testZipOutputFileResolver() throws IOException {
ZipOutputFileResolver resolver = new ZipOutputFileResolver();
- MatcherAssert.assertThat(resolver.toPath("file").toString(), Matchers.endsWith("lib/vdyp-common/file"));
+ Path currentRelativePath = Paths.get("");
+ String currentPath = currentRelativePath.toAbsolutePath().toString();
+
+ MatcherAssert.assertThat(resolver.toPath("file"), Matchers.is(Paths.get(currentPath, "file")));
assertThrows(UnsupportedOperationException.class, () -> resolver.resolveForInput("file"));
- MatcherAssert.assertThat(resolver.toString("file"), Matchers.endsWith("lib/vdyp-common/file"));
+ MatcherAssert.assertThat(resolver.toString("file"), Matchers.endsWith(Paths.get(currentPath, "file").toString()));
for (int i = 0; i < 5; i++) {
OutputStream os = resolver.resolveForOutput("file" + i);
diff --git a/lib/vdyp-si32/pom.xml b/lib/vdyp-si32/pom.xml
index 812cdbded..52c9d1eb2 100644
--- a/lib/vdyp-si32/pom.xml
+++ b/lib/vdyp-si32/pom.xml
@@ -1,19 +1,20 @@
-
- 4.0.0
+
+ 4.0.0
- vdyp-si32
-
- Variable Density Yield Project - SI32
- http://maven.apache.org
+ vdyp-si32
-
- ca.bc.gov.nrs.vdyp
- vdyp-lib
- 0.0.1-SNAPSHOT
-
+ Variable Density Yield Project - SI32
+ http://maven.apache.org
-
+
+ ca.bc.gov.nrs.vdyp
+ vdyp-lib
+ 0.0.1-SNAPSHOT
+
+
+
@@ -45,8 +46,17 @@
- org.apache.commons
- commons-lang3
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-jdk14
+
+
+
+ org.apache.commons
+ commons-lang3
diff --git a/lib/vdyp-sindex/pom.xml b/lib/vdyp-sindex/pom.xml
index 335f56eb8..8cf5144f8 100644
--- a/lib/vdyp-sindex/pom.xml
+++ b/lib/vdyp-sindex/pom.xml
@@ -1,21 +1,20 @@
-
- 4.0.0
+
+ 4.0.0
- vdyp-sindex
-
-
- Variable Density Yield Project - Sindex
- http://maven.apache.org
+ vdyp-sindex
-
- ca.bc.gov.nrs.vdyp
- vdyp-lib
- 0.0.1-SNAPSHOT
-
+ Variable Density Yield Project - Sindex
+ http://maven.apache.org
+
+ ca.bc.gov.nrs.vdyp
+ vdyp-lib
+ 0.0.1-SNAPSHOT
+
-
+
@@ -48,6 +47,15 @@
test
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-jdk14
+
+
org.junit.jupiter
junit-jupiter-api
diff --git a/pom.xml b/pom.xml
index 40dd61e9a..e1ac6286d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,7 @@
org.slf4j
slf4j-jdk14
2.0.7
+ test