-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/master' into base_update
- Loading branch information
Showing
26 changed files
with
201 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule ivoatex
updated
6 files
+5 −1 | Makefile | |
+2 −15 | archdiag-full.xml | |
+14 −12 | docrepo.bib | |
+24 −7 | regressiontest/run-regression.py | |
+1 −0 | submission.py | |
+19 −1 | update_generated.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
* Created on 03/05/2023 by Paul Harrison ([email protected]). | ||
*/ | ||
|
||
import java.io.File; | ||
import java.io.StringReader; | ||
import java.io.StringWriter; | ||
import java.sql.PreparedStatement; | ||
|
@@ -37,7 +36,7 @@ | |
import org.ivoa.vodml.ModelManagement; | ||
import org.ivoa.vodml.VodmlModel; | ||
import org.ivoa.vodml.jpa.JPAManipulationsForObjectType; | ||
import org.ivoa.vodml.validation.ModelValidator.ValidationResult; | ||
import org.ivoa.vodml.validation.XMLValidator.ValidationResult; | ||
|
||
/** | ||
* Base Class for doing validating tests. | ||
|
@@ -123,20 +122,27 @@ protected <T extends VodmlModel<T>> RoundTripResult<T> roundtripXML(VodmlModel<T | |
StreamResult result = new StreamResult(sw2); | ||
|
||
trans.transform(new StreamSource(new StringReader(sw.toString())), result); | ||
System.out.println(sw2.toString()); | ||
final String xmlOutput = sw2.toString(); | ||
System.out.println(xmlOutput); | ||
XMLValidator xmlValidator = new XMLValidator(vodmlModel.management()); | ||
ValidationResult validation = xmlValidator.validate(xmlOutput); | ||
if(!validation.isOk) | ||
{ | ||
validation.printValidationErrors(System.err); | ||
} | ||
|
||
//try to read in again | ||
Unmarshaller um = jc.createUnmarshaller(); | ||
ValidationEventCollector vc = new jakarta.xml.bind.util.ValidationEventCollector(); | ||
um.setEventHandler(vc); | ||
JAXBElement<T> el = um.unmarshal(new StreamSource(new StringReader(sw2.toString())),clazz); | ||
JAXBElement<T> el = um.unmarshal(new StreamSource(new StringReader(xmlOutput)),clazz); | ||
if (vc.hasEvents()) { | ||
for (ValidationEvent err : vc.getEvents()) { | ||
System.err.println(err.getMessage()); | ||
} | ||
} | ||
T modelin = el.getValue(); | ||
return new RoundTripResult<T>(!vc.hasEvents(), modelin); | ||
return new RoundTripResult<T>(!vc.hasEvents() & validation.isOk, modelin); | ||
} | ||
|
||
/** | ||
|
@@ -227,11 +233,9 @@ protected EntityManager setupH2Db(String puname){ | |
* @throws JAXBException exception when there is a JAXB problem. | ||
*/ | ||
protected <T> ValidationResult validateModel(VodmlModel<T> m) throws JAXBException { | ||
|
||
final ModelDescription desc = m.descriptor(); | ||
File schemaFile = new File(desc.schemaMap().get(desc.xmlNamespace())); | ||
ModelValidator v = new ModelValidator(m); | ||
return v.validate(m); | ||
|
||
XMLValidator v = new XMLValidator(m.management()); | ||
return v.validateObject(m.management().theModel()); | ||
|
||
} | ||
|
||
|
Oops, something went wrong.