Search in sources :

Example 1 with FederatedCswMockServer

use of org.codice.ddf.itests.common.csw.mock.FederatedCswMockServer in project ddf by codice.

the class TestRegistry method beforeExam.

@BeforeExam
public void beforeExam() throws Exception {
    try {
        waitForSystemReady();
        getServiceManager().startFeature(true, CATALOG_REGISTRY);
        getServiceManager().waitForAllBundles();
        getServiceManager().startFeature(true, CATALOG_REGISTRY_CORE);
        getServiceManager().waitForAllBundles();
        cswServer = new FederatedCswMockServer("MockCswServer", "http://localhost:", Integer.parseInt(CSW_STUB_SERVER_PORT.getPort()));
        String defaultResponse = getRegistryQueryResponse("11111111111111111111111111111111", REMOTE_REGISTRY_ID, REMOTE_REGISTRY_ID, "RemoteRegistry", "2018-02-26T17:16:34.996Z");
        cswServer.setupDefaultQueryResponseExpectation(defaultResponse);
        cswServer.start();
        waitForMockServer();
        getServiceManager().createManagedService(FACTORY_PID, getCswRegistryStoreProperties(REGISTRY_CATALOG_STORE_ID, "http://localhost:" + CSW_STUB_SERVER_PORT.getPort() + "/services/csw", getServiceManager()));
        storeId = String.format("RemoteRegistry (localhost:%s) (%s)", CSW_STUB_SERVER_PORT.getPort(), CSW_REGISTRY_TYPE);
        getCatalogBundle().waitForCatalogStore(storeId);
    } catch (Exception e) {
        LoggingUtils.failWithThrowableStacktrace(e, "Failed in @BeforeExam: ");
    }
}
Also used : FederatedCswMockServer(org.codice.ddf.itests.common.csw.mock.FederatedCswMockServer) IOException(java.io.IOException) BeforeExam(org.codice.ddf.itests.common.annotations.BeforeExam)

Example 2 with FederatedCswMockServer

use of org.codice.ddf.itests.common.csw.mock.FederatedCswMockServer in project ddf by codice.

the class TestFederation method beforeExam.

@BeforeExam
public void beforeExam() throws Exception {
    try {
        waitForSystemReady();
        getCatalogBundle().setupMaxDownloadRetryAttempts(MAX_DOWNLOAD_RETRY_ATTEMPTS);
        Map<String, Object> openSearchProperties = getOpenSearchSourceProperties(OPENSEARCH_SOURCE_ID, OPENSEARCH_PATH.getUrl(), getServiceManager());
        getServiceManager().createManagedService(OPENSEARCH_FACTORY_PID, openSearchProperties);
        cswServer = new FederatedCswMockServer(CSW_STUB_SOURCE_ID, INSECURE_ROOT, Integer.parseInt(CSW_STUB_SERVER_PORT.getPort()));
        cswServer.start();
        Map<String, Object> cswStubServerProperties = getCswSourceProperties(CSW_STUB_SOURCE_ID, CSW_PATH.getUrl(), getServiceManager());
        cswStubServerProperties.put("cswUrl", CSW_STUB_SERVER_PATH.getUrl());
        cswStubServerProperties.put(POLL_INTERVAL, CSW_SOURCE_POLL_INTERVAL);
        getServiceManager().createManagedService(CSW_FEDERATED_SOURCE_FACTORY_PID, cswStubServerProperties);
        getServiceManager().waitForHttpEndpoint(CSW_PATH + "?_wadl");
        Map<String, Object> cswProperties = getCswSourceProperties(CSW_SOURCE_ID, CSW_PATH.getUrl(), getServiceManager());
        cswProperties.put(POLL_INTERVAL, CSW_SOURCE_POLL_INTERVAL);
        getServiceManager().createManagedService(CSW_FEDERATED_SOURCE_FACTORY_PID, cswProperties);
        Map<String, Object> cswProperties2 = getCswSourceProperties(CSW_SOURCE_WITH_METACARD_XML_ID, CSW_PATH.getUrl(), getServiceManager());
        cswProperties2.put("outputSchema", "urn:catalog:metacard");
        cswProperties2.put(POLL_INTERVAL, CSW_SOURCE_POLL_INTERVAL);
        getServiceManager().createManagedService(CSW_FEDERATED_SOURCE_FACTORY_PID, cswProperties2);
        Map<String, Object> gmdProperties = getCswSourceProperties(GMD_SOURCE_ID, GMD_CSW_FEDERATED_SOURCE_FACTORY_PID, CSW_PATH.getUrl(), getServiceManager());
        gmdProperties.put(POLL_INTERVAL, CSW_SOURCE_POLL_INTERVAL);
        getServiceManager().createManagedService(GMD_CSW_FEDERATED_SOURCE_FACTORY_PID, gmdProperties);
        getCatalogBundle().waitForFederatedSource(OPENSEARCH_SOURCE_ID);
        getCatalogBundle().waitForFederatedSource(CSW_STUB_SOURCE_ID);
        getCatalogBundle().waitForFederatedSource(CSW_SOURCE_ID);
        getCatalogBundle().waitForFederatedSource(CSW_SOURCE_WITH_METACARD_XML_ID);
        getCatalogBundle().waitForFederatedSource(GMD_SOURCE_ID);
        getServiceManager().waitForSourcesToBeAvailable(REST_PATH.getUrl(), OPENSEARCH_SOURCE_ID, CSW_STUB_SOURCE_ID, CSW_SOURCE_ID, CSW_SOURCE_WITH_METACARD_XML_ID, GMD_SOURCE_ID);
        LOGGER.info("Source status: \n{}", get(REST_PATH.getUrl() + "sources").body().prettyPrint());
    } catch (Exception e) {
        LoggingUtils.failWithThrowableStacktrace(e, "Failed in @BeforeExam: ");
    }
}
Also used : FederatedCswMockServer(org.codice.ddf.itests.common.csw.mock.FederatedCswMockServer) Matchers.containsString(org.hamcrest.Matchers.containsString) IOException(java.io.IOException) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) BeforeExam(org.codice.ddf.itests.common.annotations.BeforeExam)

Aggregations

IOException (java.io.IOException)2 BeforeExam (org.codice.ddf.itests.common.annotations.BeforeExam)2 FederatedCswMockServer (org.codice.ddf.itests.common.csw.mock.FederatedCswMockServer)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1