Search in sources :

Example 11 with DeleteRequest

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);
}
Also used : DeleteRequestImpl(ddf.catalog.operation.impl.DeleteRequestImpl) DeleteRequest(ddf.catalog.operation.DeleteRequest)

Example 12 with DeleteRequest

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);
}
Also used : DeleteResponse(ddf.catalog.operation.DeleteResponse) QueryRequest(ddf.catalog.operation.QueryRequest) ResourceResponse(ddf.catalog.operation.ResourceResponse) CreateRequest(ddf.catalog.operation.CreateRequest) QueryResponse(ddf.catalog.operation.QueryResponse) ResourceRequest(ddf.catalog.operation.ResourceRequest) DeleteRequest(ddf.catalog.operation.DeleteRequest) Test(org.junit.Test)

Example 13 with DeleteRequest

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);
}
Also used : DeleteResponse(ddf.catalog.operation.DeleteResponse) QueryRequest(ddf.catalog.operation.QueryRequest) ResourceResponse(ddf.catalog.operation.ResourceResponse) UpdateRequest(ddf.catalog.operation.UpdateRequest) QueryResponse(ddf.catalog.operation.QueryResponse) ResourceRequest(ddf.catalog.operation.ResourceRequest) DeleteRequest(ddf.catalog.operation.DeleteRequest) Test(org.junit.Test)

Example 14 with DeleteRequest

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;
}
Also used : DeleteRequest(ddf.catalog.operation.DeleteRequest)

Example 15 with DeleteRequest

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));
}
Also used : DeleteStorageRequest(ddf.catalog.content.operation.DeleteStorageRequest) DeleteStorageRequestImpl(ddf.catalog.content.operation.impl.DeleteStorageRequestImpl) DeletedMetacard(ddf.catalog.core.versioning.DeletedMetacard) Metacard(ddf.catalog.data.Metacard) DeleteResponse(ddf.catalog.operation.DeleteResponse) DeleteResponseImpl(ddf.catalog.operation.impl.DeleteResponseImpl) DeleteRequestImpl(ddf.catalog.operation.impl.DeleteRequestImpl) DeleteRequest(ddf.catalog.operation.DeleteRequest) Test(org.junit.Test)

Aggregations

DeleteRequest (ddf.catalog.operation.DeleteRequest)39 Test (org.junit.Test)29 DeleteResponse (ddf.catalog.operation.DeleteResponse)22 DeleteRequestImpl (ddf.catalog.operation.impl.DeleteRequestImpl)22 Metacard (ddf.catalog.data.Metacard)18 ArrayList (java.util.ArrayList)18 HashMap (java.util.HashMap)11 Serializable (java.io.Serializable)10 DeleteResponseImpl (ddf.catalog.operation.impl.DeleteResponseImpl)9 List (java.util.List)9 CatalogFramework (ddf.catalog.CatalogFramework)7 QueryResponse (ddf.catalog.operation.QueryResponse)7 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)7 Result (ddf.catalog.data.Result)6 QueryRequest (ddf.catalog.operation.QueryRequest)6 ContentType (ddf.catalog.data.ContentType)5 ResourceRequest (ddf.catalog.operation.ResourceRequest)5 QueryImpl (ddf.catalog.operation.impl.QueryImpl)5 Filter (org.opengis.filter.Filter)5 ResultImpl (ddf.catalog.data.impl.ResultImpl)4