diff --git a/java/org/slub/rosetta/dps/repository/plugin/Validation/TestValidateSchema.java b/java/org/slub/rosetta/dps/repository/plugin/Validation/TestValidateSchema.java index 24b030bac018ee6cd4f9fb93858d6b8ccc137d0f..d9658272be1bc13bce076553e536f7f50d0d3d59 100644 --- a/java/org/slub/rosetta/dps/repository/plugin/Validation/TestValidateSchema.java +++ b/java/org/slub/rosetta/dps/repository/plugin/Validation/TestValidateSchema.java @@ -41,7 +41,7 @@ import static org.junit.Assert.*; @RunWith(JUnit4.class) public class TestValidateSchema { - private static XmlFormatValidationPlugin mock; + private XmlFormatValidationPlugin mock; private final Map<String, String> initp = new HashMap<>(); private URI local2Uri(String sUri) { @@ -67,6 +67,8 @@ public class TestValidateSchema { @org.junit.Test public void schema_valid() { + System.out.println("-----------------------------------------------------------------------------------"); + String testfile = "resources/test/valid/minimod.xml"; ValidationResultHandle resultHandle = new ValidationResultHandle(); ValidationResourceResolver validationResourceResolver = new ValidationResourceResolver(mock.getNamespaceSchemaMap(), resultHandle); var v = new ValidateSchema(validationResourceResolver, resultHandle); @@ -74,19 +76,22 @@ public class TestValidateSchema { var has_exception = false; var res = false; try { - var doc = mock.getDocument("resources/test/valid/minimod.xml"); + var doc = mock.getDocument(testfile); res = v.validateAgainst(doc, local2Uri("example_catalog/mods-3.8/flatten/mods-3-8.xsd")); } catch ( Exception e) { e.printStackTrace(); has_exception = true; } System.out.println( resultHandle.getLog()); - assertFalse("schema validation should not raise an exception", has_exception ); - assertTrue("schema validation should return true for sucessful validation", res); + assertFalse("schema validation of " + testfile + " should not raise an exception", has_exception ); + assertTrue( "schema validation of " + testfile + " should return true for sucessful validation", res); + } @org.junit.Test public void schema_invalid() { + System.out.println("-----------------------------------------------------------------------------------"); + String testfile = "resources/test/invalid/minimod.xml"; ValidationResultHandle resultHandle = new ValidationResultHandle(); ValidationResourceResolver validationResourceResolver = new ValidationResourceResolver(mock.getNamespaceSchemaMap(), resultHandle); var v = new ValidateSchema(validationResourceResolver, resultHandle); @@ -94,19 +99,21 @@ public class TestValidateSchema { var has_exception = false; var res = false; try { - var doc = mock.getDocument("resources/test/invalid/minimod.xml"); + var doc = mock.getDocument(testfile); res = v.validateAgainst(doc, local2Uri("example_catalog/mods-3.8/flatten/mods-3-8.xsd")); } catch ( Exception e) { System.out.println( "EXCEPTION:" + e.getMessage()); e.printStackTrace(); has_exception = true; } - assertFalse("schema validation should not raise an exception", has_exception ); - assertFalse("schema validation should return false for failed validation", res); + assertFalse("schema validation of " + testfile + " should not raise an exception", has_exception ); + assertFalse("schema validation of " + testfile + " should return false for failed validation", res); } @org.junit.Test public void check_import_regression() { + System.out.println("-----------------------------------------------------------------------------------"); + String testfile = "resources/test/valid/kml/KML_Samples.kml"; Set<ValidationSchema> nssm = new HashSet<>(); Set<ValidationSchema> old = mock.getNamespaceSchemaMap(); for (ValidationSchema val : old) { // filter Atoim out to trigger error @@ -122,14 +129,14 @@ public class TestValidateSchema { var has_exception = false; var res = false; try { - var doc = mock.getDocument("resources/test/valid/kml/KML_Samples.kml"); + var doc = mock.getDocument(testfile); res = v.validateAgainst(doc, local2Uri("example_catalog/kml-2.3.0/ogckml23.xsd")); } catch ( Exception e) { System.out.println( "EXCEPTION:" + e.getMessage()); e.printStackTrace(); has_exception = true; } - assertFalse("schema validation should not raise an exception", has_exception ); - assertFalse("schema validation should return false for failed validation", res); + assertFalse("schema validation of " + testfile + " should not raise an exception", has_exception ); + assertFalse("schema validation of " + testfile + " should return false for failed validation", res); } }