Search in sources :

Example 1 with CSPManager

use of org.collectionspace.csp.api.container.CSPManager in project application by collectionspace.

the class ServicesBaseClass method getBaseUrl.

private String getBaseUrl() throws CSPDependencyException {
    CSPManager cspm = getServiceManager();
    ServicesStorageGenerator gen = (ServicesStorageGenerator) cspm.getStorage("service");
    String baseurl = gen.getBase();
    return baseurl;
}
Also used : CSPManager(org.collectionspace.csp.api.container.CSPManager)

Example 2 with CSPManager

use of org.collectionspace.csp.api.container.CSPManager in project application by collectionspace.

the class ServicesBaseClass method getServiceManager.

private CSPManager getServiceManager() throws CSPDependencyException {
    CSPManager cspm = new CSPManagerImpl();
    cspm.register(new CoreConfig());
    cspm.register(new Spec());
    cspm.register(new ServicesStorageGenerator());
    cspm.go();
    cspm.configure(getRootSource(), new ConfigFinder(null), false);
    return cspm;
}
Also used : CSPManager(org.collectionspace.csp.api.container.CSPManager) CoreConfig(org.collectionspace.chain.csp.inner.CoreConfig) CSPManagerImpl(org.collectionspace.csp.container.impl.CSPManagerImpl) Spec(org.collectionspace.chain.csp.schema.Spec) ConfigFinder(org.collectionspace.csp.helper.core.ConfigFinder) TestConfigFinder(org.collectionspace.csp.helper.test.TestConfigFinder)

Example 3 with CSPManager

use of org.collectionspace.csp.api.container.CSPManager in project application by collectionspace.

the class ServicesBaseClass method makeServicesStorage.

protected Storage makeServicesStorage() throws CSPDependencyException {
    CSPManager cspm = getServiceManager();
    ConfigRoot root = cspm.getConfigRoot();
    Spec spec = (Spec) root.getRoot(Spec.SPEC_ROOT);
    assertNotNull(spec);
    // XXX this is spec specific testing that will break when we rename the object in the UI
    Record r_obj = spec.getRecord("collection-object");
    assertNotNull(r_obj);
    assertEquals("collection-object", r_obj.getID());
    assertEquals("cataloging", r_obj.getWebURL());
    StorageGenerator gen = cspm.getStorage("service");
    CSPRequestCredentials creds = gen.createCredentials();
    creds.setCredential(ServicesStorageGenerator.CRED_USERID, spec.getAdminData().getAuthUser());
    creds.setCredential(ServicesStorageGenerator.CRED_PASSWORD, spec.getAdminData().getAuthPass());
    return gen.getStorage(creds, new RequestCache());
}
Also used : ConfigRoot(org.collectionspace.chain.csp.config.ConfigRoot) CSPManager(org.collectionspace.csp.api.container.CSPManager) CSPRequestCache(org.collectionspace.csp.api.core.CSPRequestCache) RequestCache(org.collectionspace.csp.helper.core.RequestCache) Record(org.collectionspace.chain.csp.schema.Record) CSPRequestCredentials(org.collectionspace.csp.api.core.CSPRequestCredentials) Spec(org.collectionspace.chain.csp.schema.Spec) StorageGenerator(org.collectionspace.csp.api.persistence.StorageGenerator)

Example 4 with CSPManager

use of org.collectionspace.csp.api.container.CSPManager in project application by collectionspace.

the class ServicesBaseClass method getIMSBaseUrl.

private String getIMSBaseUrl() throws CSPDependencyException {
    CSPManager cspm = getServiceManager();
    ServicesStorageGenerator gen = (ServicesStorageGenerator) cspm.getStorage("service");
    String baseurl = gen.getIMSBase();
    return baseurl;
}
Also used : CSPManager(org.collectionspace.csp.api.container.CSPManager)

Example 5 with CSPManager

use of org.collectionspace.csp.api.container.CSPManager in project application by collectionspace.

the class TestService method testXMLJSONConversion.

@Test
public void testXMLJSONConversion() 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);
    testXMLJSON(spec, "location", "location.xml", "location.json");
    testXMLJSON(spec, "concept", "concept.xml", "concept.json");
    testXMLJSON(spec, "place", "placeXMLJSON.xml", "placeJSON.json");
    testXMLJSON(spec, "citation", "citation.xml", "citation.json");
    testXMLJSON(spec, "work", "work.xml", "work.json");
    testXMLJSON(spec, "collection-object", "objectsXMLJSON.xml", "objectsJSON.json");
    testXMLJSON(spec, "acquisition", "acquisitionXMLJSON.xml", "acquisitionJSON.json");
    testXMLJSON(spec, "intake", "intake.xml", "intake.json");
    testXMLJSON(spec, "loanin", "loanin.xml", "loanin.json");
    testXMLJSON(spec, "loanout", "loanout.xml", "loanout.json");
    testXMLJSON(spec, "valuationcontrol", "valuationcontrol.xml", "valuationcontrol.json");
    testXMLJSON(spec, "movement", "movement.xml", "movement.json");
    testXMLJSON(spec, "objectexit", "objectexit.xml", "objectexit.json");
    testXMLJSON(spec, "group", "group.xml", "group.json");
    testXMLJSON(spec, "media", "media.xml", "mediaJSON.json");
    testXMLJSON(spec, "conditioncheck", "conditioncheck.xml", "conditioncheck.json");
    testXMLJSON(spec, "conservation", "conservation.xml", "conservation.json");
    testXMLJSON(spec, "exhibition", "exhibition.xml", "exhibition.json");
    testXMLJSON(spec, "role", "role.xml", "role.json");
    testXMLJSON(spec, "permrole", "rolepermissions.xml", "rolepermissions.json");
    testXMLJSON(spec, "userrole", "accountrole.xml", "accountrole.json");
// testXMLJSON(spec,
// "permission","permissionXMLJSON.xml","permissionsJSON.json");
// testXMLJSON(spec,
// "organization","orgauthref.xml","permissionsJSON.json");
}
Also used : ConfigRoot(org.collectionspace.chain.csp.config.ConfigRoot) CSPManager(org.collectionspace.csp.api.container.CSPManager) CoreConfig(org.collectionspace.chain.csp.inner.CoreConfig) CSPManagerImpl(org.collectionspace.csp.container.impl.CSPManagerImpl) Spec(org.collectionspace.chain.csp.schema.Spec) ConfigFinder(org.collectionspace.csp.helper.core.ConfigFinder) Test(org.junit.Test)

Aggregations

CSPManager (org.collectionspace.csp.api.container.CSPManager)11 Spec (org.collectionspace.chain.csp.schema.Spec)8 CoreConfig (org.collectionspace.chain.csp.inner.CoreConfig)7 CSPManagerImpl (org.collectionspace.csp.container.impl.CSPManagerImpl)7 ConfigFinder (org.collectionspace.csp.helper.core.ConfigFinder)7 ConfigRoot (org.collectionspace.chain.csp.config.ConfigRoot)6 TestConfigFinder (org.collectionspace.csp.helper.test.TestConfigFinder)5 CSPDependencyException (org.collectionspace.csp.api.core.CSPDependencyException)3 Test (org.junit.Test)3 ServicesStorageGenerator (org.collectionspace.chain.csp.persistence.services.ServicesStorageGenerator)2 TenantSpec (org.collectionspace.chain.csp.persistence.services.TenantSpec)2 File (java.io.File)1 Record (org.collectionspace.chain.csp.schema.Record)1 CSPRequestCache (org.collectionspace.csp.api.core.CSPRequestCache)1 CSPRequestCredentials (org.collectionspace.csp.api.core.CSPRequestCredentials)1 StorageGenerator (org.collectionspace.csp.api.persistence.StorageGenerator)1 RequestCache (org.collectionspace.csp.helper.core.RequestCache)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1 InputSource (org.xml.sax.InputSource)1