use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class RegistryStoreImpl method delete.
@Override
public DeleteResponse delete(DeleteRequest request) throws IngestException {
List<String> ids = ((OperationTransaction) request.getPropertyValue(Constants.OPERATION_TRANSACTION_KEY)).getPreviousStateMetacards().stream().map(Metacard::getId).collect(Collectors.toList());
DeleteRequest newRequest = new DeleteRequestImpl(ids.toArray(new String[ids.size()]), request.getProperties());
return super.delete(newRequest);
}
use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class PointOfContactUpdatePluginTest method testPassthroughMethods.
@Test
public void testPassthroughMethods() throws Exception {
CreateRequest createRequest = mock(CreateRequest.class);
DeleteRequest deleteRequest = mock(DeleteRequest.class);
QueryRequest queryRequest = mock(QueryRequest.class);
ResourceRequest resourceRequest = mock(ResourceRequest.class);
DeleteResponse deleteResponse = mock(DeleteResponse.class);
QueryResponse queryResponse = mock(QueryResponse.class);
ResourceResponse resourceResponse = mock(ResourceResponse.class);
assertThat(pointOfContactUpdatePlugin.processPreCreate(createRequest), is(createRequest));
assertThat(pointOfContactUpdatePlugin.processPreDelete(deleteRequest), is(deleteRequest));
assertThat(pointOfContactUpdatePlugin.processPostDelete(deleteResponse), is(deleteResponse));
assertThat(pointOfContactUpdatePlugin.processPreQuery(queryRequest), is(queryRequest));
assertThat(pointOfContactUpdatePlugin.processPostQuery(queryResponse), is(queryResponse));
assertThat(pointOfContactUpdatePlugin.processPreResource(resourceRequest), is(resourceRequest));
assertThat(pointOfContactUpdatePlugin.processPostResource(resourceResponse, mock(Metacard.class)), is(resourceResponse));
verifyZeroInteractions(createRequest, deleteRequest, queryRequest, resourceRequest, deleteResponse, queryResponse, resourceResponse);
}
use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class MetacardIngestNetworkPluginTest method testPassthroughMethods.
@Test
public void testPassthroughMethods() throws Exception {
ThreadContext.put(CLIENT_INFO_KEY, INFO_MAP);
when(mockMetacardCondition.applies(INFO_MAP)).thenReturn(true);
UpdateRequest updateRequest = mock(UpdateRequest.class);
DeleteRequest deleteRequest = mock(DeleteRequest.class);
QueryRequest queryRequest = mock(QueryRequest.class);
ResourceRequest resourceRequest = mock(ResourceRequest.class);
DeleteResponse deleteResponse = mock(DeleteResponse.class);
QueryResponse queryResponse = mock(QueryResponse.class);
ResourceResponse resourceResponse = mock(ResourceResponse.class);
assertThat(plugin.processPreUpdate(updateRequest, mock(Map.class)), is(updateRequest));
assertThat(plugin.processPreDelete(deleteRequest), is(deleteRequest));
assertThat(plugin.processPreQuery(queryRequest), is(queryRequest));
assertThat(plugin.processPreResource(resourceRequest), is(resourceRequest));
assertThat(plugin.processPostDelete(deleteResponse), is(deleteResponse));
assertThat(plugin.processPostQuery(queryResponse), is(queryResponse));
assertThat(plugin.processPostResource(resourceResponse, mock(Metacard.class)), is(resourceResponse));
verifyZeroInteractions(mockMetacardCondition, mockMetacardServices, updateRequest, deleteRequest, queryRequest, resourceRequest, deleteResponse, queryResponse, resourceResponse);
}
use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class DummyPreIngestPlugin method process.
public DeleteRequest process(DeleteRequest input) throws PluginExecutionException {
String methodName = "process(DeleteRequest)";
LOGGER.debug(ENTERING, methodName);
DeleteRequest newRequest = input;
// List<String> results = new ArrayList<String>();
// if(idsToDelete != null)
// {
// int size = idsToDelete.size();
//
// //In this example, we demonstrate filtering out every other
// //id in the list
// for(int i = 0; i < size; i++) {
// if(i % 2 == 0) {
// results.add(idsToDelete.get(i));
// }
// }
// }
LOGGER.debug(EXITING, methodName);
// return results;
return newRequest;
}
use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class HistorianTest method testDeleteResponse.
@Test
public void testDeleteResponse() throws SourceUnavailableException, IngestException, StorageException {
Metacard metacard = getMetacardUpdatePair().get(0);
storeMetacard(metacard);
// Send a delete request
DeleteStorageRequest deleteStorageRequest = new DeleteStorageRequestImpl(Collections.singletonList(metacard), new HashMap<>());
storageProvider.delete(deleteStorageRequest);
// Version delete request
DeleteRequest deleteRequest = new DeleteRequestImpl("deleteRequest");
DeleteResponse deleteResponse = new DeleteResponseImpl(deleteRequest, new HashMap<>(), Collections.singletonList(metacard));
historian.version(deleteResponse);
// Only the version metacard is left
assertThat(storageProvider.storageMap.size(), equalTo(1));
}
Aggregations