InspireValidatorUtils { public MetadataValidationStatus calculateValidationStatus(String validationStatus) { boolean isUndefined = validationStatus.equalsIgnoreCase(TEST_STATUS_UNDEFINED); boolean isNotApplicable = validationStatus.equalsIgnoreCase(TEST_STATUS_NOT_APPLICABLE); boolean executed = !validationStatus.equalsIgnoreCase(TEST_STATUS_INTERNAL_ERROR); MetadataValidationStatus metadataValidationStatus; if (isNotApplicable) { metadataValidationStatus = MetadataValidationStatus.DOES_NOT_APPLY; } else if (!isUndefined && executed) { boolean isValid = validationStatus.equalsIgnoreCase(TEST_STATUS_PASSED) || validationStatus.equalsIgnoreCase(TEST_STATUS_PASSED_MANUAL); metadataValidationStatus = (isValid ? MetadataValidationStatus.VALID : MetadataValidationStatus.INVALID); } else { metadataValidationStatus = MetadataValidationStatus.NEVER_CALCULATED; } return metadataValidationStatus; } InspireValidatorUtils(); String getDefaultTestSuite(); void setDefaultTestSuite(String defaultTestSuite); void setTestsuites(Map<String, String[]> testsuites); Map getTestsuites(); void setTestsuitesConditions(Map<String, String> testsuitesConditions); Map getTestsuitesConditions(); Integer getMaxNumberOfEtfChecks(); void setMaxNumberOfEtfChecks(Integer maxNumberOfEtfChecks); Long getIntervalBetweenEtfChecks(); void setIntervalBetweenEtfChecks(Long intervalBetweenEtfChecks); boolean checkServiceStatus(ServiceContext context, String endPoint); boolean isReady(ServiceContext context, String endPoint, String testId); String isPassed(ServiceContext context, String endPoint, String testId); String getReportUrl(String endPoint, String testId); static String getReportUrlJSON(String endPoint, String testId); static String getReportUrlXML(String endPoint, String testId); String submitFile(ServiceContext context, String serviceEndpoint, InputStream record, String testsuite, String testTitle); String retrieveReport(ServiceContext context, String endPoint); void waitUntilReady(ServiceContext context, String endPoint, String testId); MetadataValidationStatus calculateValidationStatus(String validationStatus); Map<String, String> calculateTestsuitesToApply(String schemaid, IMetadataSchemaUtils metadataSchemaUtils); final static String TEST_STATUS_PASSED; final static String TEST_STATUS_FAILED; final static String TEST_STATUS_PASSED_MANUAL; final static String TEST_STATUS_UNDEFINED; final static String TEST_STATUS_NOT_APPLICABLE; final static String TEST_STATUS_INTERNAL_ERROR; @Value("#{validatorAdditionalConfig['defaultTestSuite']}")
    public String defaultTestSuite; }
@Test public void testCalculateValidationStatus() { MetadataValidationStatus metadataValidationStatus = inspireValidatorUtils .calculateValidationStatus(inspireValidatorUtils.TEST_STATUS_INTERNAL_ERROR); assertEquals(MetadataValidationStatus.NEVER_CALCULATED, metadataValidationStatus); metadataValidationStatus = inspireValidatorUtils.calculateValidationStatus(inspireValidatorUtils.TEST_STATUS_UNDEFINED); assertEquals(MetadataValidationStatus.NEVER_CALCULATED, metadataValidationStatus); metadataValidationStatus = inspireValidatorUtils.calculateValidationStatus(inspireValidatorUtils.TEST_STATUS_NOT_APPLICABLE); assertEquals(MetadataValidationStatus.DOES_NOT_APPLY, metadataValidationStatus); metadataValidationStatus = inspireValidatorUtils.calculateValidationStatus(inspireValidatorUtils.TEST_STATUS_PASSED); assertEquals(MetadataValidationStatus.VALID, metadataValidationStatus); metadataValidationStatus = inspireValidatorUtils.calculateValidationStatus(inspireValidatorUtils.TEST_STATUS_PASSED_MANUAL); assertEquals(MetadataValidationStatus.VALID, metadataValidationStatus); metadataValidationStatus = inspireValidatorUtils.calculateValidationStatus(inspireValidatorUtils.TEST_STATUS_FAILED); assertEquals(MetadataValidationStatus.INVALID, metadataValidationStatus); }