Skip to content

Commit

Permalink
Work in progress checking implementation of DwCGeoRefDQ methods again…
Browse files Browse the repository at this point in the history
…st current (2023-06-12) test descriptions. Addressed implementation of tdwg/bdq#96 VALIDATION_DECIMALLONGITUDE_NOTEMPTY and tdwg/bdq#112 VALIDATION_MAXELEVATION_INRANGE  Adding ProvidesVersion annotations.   Removing now empty file stubs for checked methods.  Adding to unit test.
  • Loading branch information
chicoreus committed Jun 19, 2023
1 parent 0c54f24 commit 8a61a97
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1450,17 +1450,22 @@ public static DQResponse<ComplianceValue> validationCoordinateuncertaintyInrange


/**
* Is the value of dwc:maximumElevationInMeters of a single record within a valid range
*
* Is the value of dwc:maximumElevationInMeters within the Parameter range?
*
* Provides: #112 VALIDATION_MAXELEVATION_INRANGE
* Version: 2022-03-26
*
* @param maximumElevationInMeters the provided dwc:maximumElevationInMeters to evaluate
* @param minimumValidElevationInMeters minimum valid value to test against, if null, defaults to -430
* @param maximumValidElevationInMeters maximum valid value to test against, if null, defaults to 8550
* @return DQResponse the response of type ComplianceValue to return
*/
@Validation(label="VALIDATION_MAXELEVATION_INRANGE", description="Is the value of dwc:maximumElevationInMeters within the Parameter range?")
@Validation(label="VALIDATION_MAXELEVATION_INRANGE", description="Is the value of dwc:maximumElevationInMeters of a single record within a valid range")
@Provides("c971fe3f-84c1-4636-9f44-b1ec31fd63c7")
@ProvidesVersion("https://rs.tdwg.org/bdq/terms/c971fe3f-84c1-4636-9f44-b1ec31fd63c7/2022-03-26")
@Specification("INTERNAL_PREREQUISITES_NOT_MET if dwc:maximumElevationInMeters is EMPTY or the value cannot be interpreted as a number; COMPLIANT if the value of dwc:maximumElevationInMeters is within the range of bdq:minimumValidElevationInMeters to bdq:maximumValidElevationInMeters inclusive; otherwise NOT_COMPLIANT ")
public static DQResponse<ComplianceValue> validationMaxelevationInrange(
@ActedUpon("dwc:maximumElevationInMeters") String maximumElevationInMeters,
@Parameter(name="bdq:minimumValidElevationInMeters") Double minimumValidElevationInMeters,
Expand All @@ -1477,7 +1482,7 @@ public static DQResponse<ComplianceValue> validationMaxelevationInrange(
//

// Parameters. This test is defined as parameterized.
// Default values: bdq:minimumValidElevationInMeters="-430"; bdq:maximumValidElevationInMeters="8850"
// Default values: bdq:minimumValidElevationInMeters="-430", bdq:maximumValidElevationInMeters="8850"


if (minimumValidElevationInMeters==null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,20 @@ public static DQResponse<ComplianceValue> validationMindepthInrange(
}

/**
* Is the value of dwc:maximumElevationInMeters within the Parameter range?
* Is the value of dwc:maximumElevationInMeters within the default range of -430 to 8850.
*
* Provides: #112 VALIDATION_MAXELEVATION_INRANGE
* Version: 2022-03-26
*
* Uses Default values: bdq:minimumValidElevationInMeters="-430", bdq:maximumValidElevationInMeters="8850"
*
* @param maximumElevationInMeters the provided dwc:maximumElevationInMeters to evaluate
* @return DQResponse the response of type ComplianceValue to return
*/
@Validation(label="VALIDATION_MAXELEVATION_INRANGE", description="Is the value of dwc:maximumElevationInMeters within the Parameter range?")
@Validation(label="VALIDATION_MAXELEVATION_INRANGE", description="Is the value of dwc:maximumElevationInMeters of a single record within a valid range")
@Provides("c971fe3f-84c1-4636-9f44-b1ec31fd63c7")
@ProvidesVersion("https://rs.tdwg.org/bdq/terms/c971fe3f-84c1-4636-9f44-b1ec31fd63c7/2022-03-26")
@Specification("INTERNAL_PREREQUISITES_NOT_MET if dwc:maximumElevationInMeters is EMPTY or the value cannot be interpreted as a number; COMPLIANT if the value of dwc:maximumElevationInMeters is within the range of bdq:minimumValidElevationInMeters to bdq:maximumValidElevationInMeters inclusive; otherwise NOT_COMPLIANT ")
public static DQResponse<ComplianceValue> validationMaxelevationInrange(
@ActedUpon("dwc:maximumElevationInMeters") String maximumElevationInMeters) {
return DwCGeoRefDQ.validationMaxelevationInrange(maximumElevationInMeters,-430d, 8850d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public DQResponse<AmendmentValue> amendmentGeodeticdatumAssumeddefault(@ActedUpo

//TODO: Parameters. This test is defined as parameterized.
// bdq:defaultGeodeticDatum default value="EPSG:4326"

return result;
}

Expand Down Expand Up @@ -685,36 +685,6 @@ public DQResponse<ComplianceValue> validationCoordinateuncertaintyInrange(@Acted
return result;
}

/**
* Is the value of dwc:maximumElevationInMeters of a single record within a valid range
*
* Provides: VALIDATION_MAXELEVATION_INRANGE
* Version: 2022-03-26
*
* @param maximumElevationInMeters the provided dwc:maximumElevationInMeters to evaluate
* @return DQResponse the response of type ComplianceValue to return
*/
@Validation(label="VALIDATION_MAXELEVATION_INRANGE", description="Is the value of dwc:maximumElevationInMeters of a single record within a valid range")
@Provides("c971fe3f-84c1-4636-9f44-b1ec31fd63c7")
@ProvidesVersion("https://rs.tdwg.org/bdq/terms/c971fe3f-84c1-4636-9f44-b1ec31fd63c7/2022-03-26")
@Specification("INTERNAL_PREREQUISITES_NOT_MET if dwc:maximumElevationInMeters is EMPTY or the value cannot be interpreted as a number; COMPLIANT if the value of dwc:maximumElevationInMeters is within the range of bdq:minimumValidElevationInMeters to bdq:maximumValidElevationInMeters inclusive; otherwise NOT_COMPLIANT ")
public DQResponse<ComplianceValue> validationMaxelevationInrange(@ActedUpon("dwc:maximumElevationInMeters") String maximumElevationInMeters) {
DQResponse<ComplianceValue> result = new DQResponse<ComplianceValue>();

//TODO: Implement specification
// INTERNAL_PREREQUISITES_NOT_MET if dwc:maximumElevationInMeters
// is EMPTY or the value cannot be interpreted as a number;
// COMPLIANT if the value of dwc:maximumElevationInMeters is
// within the range of bdq:minimumValidElevationInMeters to
// bdq:maximumValidElevationInMeters inclusive; otherwise NOT_COMPLIANT
//

//TODO: Parameters. This test is defined as parameterized.
// Default values: bdq:minimumValidElevationInMeters="-430",bdq:maximumValidElevationInMeters="8850"

return result;
}


/**
* Does the value of dwc:stateProvince occur in bdq:sourceAuthority?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public void testValidationDecimallongitudeEmpty() {

DQResponse<ComplianceValue> result = DwCGeoRefDQ.validationDecimallongitudeNotempty(null);
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.NOT_COMPLIANT, result.getValue());

result = DwCGeoRefDQ.validationDecimallongitudeNotempty("foo");
Expand Down Expand Up @@ -657,17 +657,47 @@ public void testValidationMaxelevationOutofrange() {
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("0");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("-400");
logger.debug(result.getComment());
System.out.println(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.COMPLIANT.getLabel(), result.getValue().getLabel());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("8850");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("23.456");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("-430");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("9000");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
assertEquals(ComplianceValue.NOT_COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("8851");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
assertEquals(ComplianceValue.NOT_COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("-431");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
assertEquals(ComplianceValue.NOT_COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange("-500");
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
Expand All @@ -691,6 +721,15 @@ public void testValidationMaxelevationOutofrange() {
assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel());
assertEquals(ComplianceValue.NOT_COMPLIANT.getLabel(), result.getValue().getLabel());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange(Integer.toString(Integer.MAX_VALUE));
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
assertEquals(ComplianceValue.NOT_COMPLIANT, result.getValue());

result = DwCGeoRefDQDefaults.validationMaxelevationInrange(Integer.toString(Integer.MIN_VALUE));
logger.debug(result.getComment());
assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());
assertEquals(ComplianceValue.NOT_COMPLIANT, result.getValue());
}

/**
Expand Down

0 comments on commit 8a61a97

Please sign in to comment.