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"));
}
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));
}
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"));
}
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));
}
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());
}
Aggregations