Search in sources :

Example 66 with CreateResponse

use of ddf.catalog.operation.CreateResponse in project ddf by codice.

the class RegistryIdPostIngestPluginTest method testProcessCreateInternal.

@Test
public void testProcessCreateInternal() throws Exception {
    CreateResponse response = new CreateResponseImpl(null, null, Collections.singletonList(getDefaultInternalMetacard()));
    registryIdPostIngestPlugin.process(response);
    assertThat(registryIdPostIngestPlugin.getRegistryIds().size(), equalTo(0));
    assertThat(registryIdPostIngestPlugin.getRemoteMetacardIds().size(), equalTo(1));
    assertThat(registryIdPostIngestPlugin.getRemoteMetacardIds().iterator().next(), equalTo("remoteMcardId"));
}
Also used : CreateResponse(ddf.catalog.operation.CreateResponse) CreateResponseImpl(ddf.catalog.operation.impl.CreateResponseImpl) Test(org.junit.Test)

Example 67 with CreateResponse

use of ddf.catalog.operation.CreateResponse in project ddf by codice.

the class RegistryIdPostIngestPluginTest method testProcessDeleteInternal.

@Test
public void testProcessDeleteInternal() throws Exception {
    CreateResponse createResponse = new CreateResponseImpl(null, null, Collections.singletonList(getDefaultInternalMetacard()));
    registryIdPostIngestPlugin.process(createResponse);
    DeleteResponse deleteResponse = new DeleteResponseImpl(null, null, Collections.singletonList(getDefaultInternalMetacard()));
    registryIdPostIngestPlugin.process(deleteResponse);
    assertThat(registryIdPostIngestPlugin.getRemoteMetacardIds().size(), equalTo(0));
}
Also used : DeleteResponse(ddf.catalog.operation.DeleteResponse) DeleteResponseImpl(ddf.catalog.operation.impl.DeleteResponseImpl) CreateResponse(ddf.catalog.operation.CreateResponse) CreateResponseImpl(ddf.catalog.operation.impl.CreateResponseImpl) Test(org.junit.Test)

Example 68 with CreateResponse

use of ddf.catalog.operation.CreateResponse in project ddf by codice.

the class RegistryIdPostIngestPluginTest method testProcessCreate.

@Test
public void testProcessCreate() throws Exception {
    CreateResponse response = new CreateResponseImpl(null, null, Collections.singletonList(getDefaultMetacard()));
    registryIdPostIngestPlugin.process(response);
    assertThat(registryIdPostIngestPlugin.getRegistryIds().size(), equalTo(1));
    assertThat(registryIdPostIngestPlugin.getRegistryIds().iterator().next(), equalTo("regId"));
}
Also used : CreateResponse(ddf.catalog.operation.CreateResponse) CreateResponseImpl(ddf.catalog.operation.impl.CreateResponseImpl) Test(org.junit.Test)

Example 69 with CreateResponse

use of ddf.catalog.operation.CreateResponse in project ddf by codice.

the class TestPlugin method testCreate.

@Test
@Ignore
public void testCreate() throws PluginExecutionException, CatalogTransformerException, IOException, IngestException, SourceUnavailableException {
    // given
    CreateResponse createResponse = new CreateResponseImpl(new CreateRequestImpl(metacard), null, Arrays.asList(metacard));
    // when
    CreateResponse response = plugin.process(createResponse);
    // then
    verify(endpoint).addDocument(isA(HttpHeaders.class), isA(UriInfo.class), isA(InputStream.class));
    assertThat(response, sameInstance(createResponse));
}
Also used : HttpHeaders(javax.ws.rs.core.HttpHeaders) CreateResponse(ddf.catalog.operation.CreateResponse) InputStream(java.io.InputStream) CreateRequestImpl(ddf.catalog.operation.impl.CreateRequestImpl) UriInfo(javax.ws.rs.core.UriInfo) CreateResponseImpl(ddf.catalog.operation.impl.CreateResponseImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 70 with CreateResponse

use of ddf.catalog.operation.CreateResponse in project ddf by codice.

the class SolrProviderTest method testUpdatePartial.

/**
     * Tests if a partial update is handled appropriately.
     *
     * @throws IngestException
     * @throws UnsupportedQueryException
     */
@Test
public void testUpdatePartial() throws IngestException, UnsupportedQueryException {
    deleteAllIn(provider);
    MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord());
    CreateResponse createResponse = create(metacard);
    String id = createResponse.getCreatedMetacards().get(0).getId();
    metacard.setContentTypeName("newContentType");
    String[] ids = { id, "no_such_record" };
    UpdateResponse response = update(ids, Arrays.asList((Metacard) metacard, metacard));
    assertEquals(1, response.getUpdatedMetacards().size());
}
Also used : UpdateResponse(ddf.catalog.operation.UpdateResponse) Metacard(ddf.catalog.data.Metacard) CreateResponse(ddf.catalog.operation.CreateResponse) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Aggregations

CreateResponse (ddf.catalog.operation.CreateResponse)111 Test (org.junit.Test)82 Metacard (ddf.catalog.data.Metacard)76 CreateRequestImpl (ddf.catalog.operation.impl.CreateRequestImpl)44 ArrayList (java.util.ArrayList)42 CreateRequest (ddf.catalog.operation.CreateRequest)36 QueryImpl (ddf.catalog.operation.impl.QueryImpl)29 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)29 CreateResponseImpl (ddf.catalog.operation.impl.CreateResponseImpl)27 HashMap (java.util.HashMap)25 Serializable (java.io.Serializable)23 List (java.util.List)23 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)22 DeleteResponse (ddf.catalog.operation.DeleteResponse)22 UpdateResponse (ddf.catalog.operation.UpdateResponse)21 Filter (org.opengis.filter.Filter)21 IngestException (ddf.catalog.source.IngestException)20 SourceResponse (ddf.catalog.operation.SourceResponse)18 QueryRequest (ddf.catalog.operation.QueryRequest)17 MetacardType (ddf.catalog.data.MetacardType)16