use of org.collectionspace.chain.csp.inner.CoreConfig in project application by collectionspace.
the class TestService method testJSONXMLConversion.
/**
* I wouldn't call this a robust multipart test - needs more work but works
* fine for single part multipart xml
*
* @throws Exception
*/
@Test
public void testJSONXMLConversion() throws Exception {
CSPManager cspm = new CSPManagerImpl();
cspm.register(new CoreConfig());
cspm.register(new Spec());
cspm.register(new ServicesStorageGenerator());
cspm.go();
// argh - test break when config changes *sob*
cspm.configure(getRootSource(), new ConfigFinder(null), false);
ConfigRoot root = cspm.getConfigRoot();
Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
testJSONXML(spec, "location", "location.xml", "location.json");
testJSONXML(spec, "concept", "concept.xml", "concept.json");
testJSONXML(spec, "citation", "citation.xml", "citation.json");
testJSONXML(spec, "place", "placeXMLJSON.xml", "placeJSON.json");
testJSONXML(spec, "work", "work.xml", "work.json");
// CSPACE-6135: In CollectionObject, the computedCurrentLocation field is services-readonly,
// so the JSON->XML->JSON conversion produces JSON that does not match the initial JSON
// (computedCurrentLocation is omitted from the XML, so it does not appear in the JSON
// converted back from the XML). In this case, we need to supply a third parameter to
// specify the expected round-trip JSON. objectsReturnedJSON.json is identical to
// objectsJSON.json, except computedCurrentLocation has been removed.
testJSONXML(spec, "collection-object", "objectsXMLJSON.xml", "objectsJSON.json", "objectsReturnedJSON.json");
testJSONXML(spec, "acquisition", "acquisitionXMLJSON.xml", "acquisitionJSON.json");
testJSONXML(spec, "media", "media.xml", "mediaJSON.json");
testJSONXML(spec, "loanin", "loanin.xml", "loanin.json");
testJSONXML(spec, "loanout", "loanout.xml", "loanout.json");
testJSONXML(spec, "intake", "intake.xml", "intake.json");
testJSONXML(spec, "movement", "movement.xml", "movement.json");
testJSONXML(spec, "valuationcontrol", "valuationcontrol.xml", "valuationcontrol.json");
testJSONXML(spec, "objectexit", "objectexit.xml", "objectexit.json");
testJSONXML(spec, "group", "group.xml", "group.json");
testJSONXML(spec, "conditioncheck", "conditioncheck.xml", "conditioncheck.json");
testJSONXML(spec, "conservation", "conservation.xml", "conservation.json");
testJSONXML(spec, "exhibition", "exhibition.xml", "exhibition.json");
testJSONXML(spec, "role", "role.xml", "role.json");
// testJSONXML(spec,"permrole","rolepermissions.xml","rolepermissions.json");
// testJSONXML(spec, "userrole","accountrole.xml","accountrole.json");
// testJSONXML(spec,
// "permission","permissionXMLJSON.xml","permissionsJSON.json");
}
use of org.collectionspace.chain.csp.inner.CoreConfig in project application by collectionspace.
the class TestData method getSpec.
public final Spec getSpec(ServletTester tester) {
if (this.spec == null) {
CSPManager cspm = new CSPManagerImpl();
cspm.register(new CoreConfig());
cspm.register(new Spec());
try {
cspm.go();
tester.getAttribute("config-filename");
String filename = (String) tester.getAttribute("config-filename");
cspm.configure(getSource(filename), new ConfigFinder(null), false);
} catch (CSPDependencyException e) {
log.info("CSPManagerImpl failed");
log.info(tester.getAttribute("config-filename").toString());
log.info(e.getLocalizedMessage());
}
ConfigRoot root = cspm.getConfigRoot();
Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
this.spec = spec;
}
return this.spec;
}
use of org.collectionspace.chain.csp.inner.CoreConfig in project application by collectionspace.
the class TestServices method getServiceManager.
private CSPManager getServiceManager(String filename) {
CSPManager cspm = new CSPManagerImpl();
cspm.register(new CoreConfig());
cspm.register(new Spec());
cspm.register(new ServicesStorageGenerator());
try {
cspm.go();
cspm.configure(getSource(filename), new ConfigFinder(null), false);
} catch (CSPDependencyException e) {
log.error("CSPManagerImpl failed");
log.error(e.getLocalizedMessage());
}
return cspm;
}
Aggregations