Search in sources :

Example 6 with DeleteResponseImpl

use of ddf.catalog.operation.impl.DeleteResponseImpl 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)

Example 7 with DeleteResponseImpl

use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.

the class RemoteDeleteOperationsTest method setUpDeleteRequest.

private void setUpDeleteRequest() {
    MetacardImpl metacard = new MetacardImpl();
    ArrayList<Metacard> metacardList = new ArrayList<>();
    metacard.setId("Bob");
    metacard.setTitle("Bob's Title");
    metacardList.add(metacard);
    metacard = new MetacardImpl();
    metacard.setId("Bobbert");
    metacard.setTitle("Bobbert's Title");
    metacardList.add(metacard);
    deleteRequest = new DeleteRequestImpl(metacard.getId());
    deleteResponse = new DeleteResponseImpl(deleteRequest, new HashMap(), metacardList);
}
Also used : Metacard(ddf.catalog.data.Metacard) DeleteResponseImpl(ddf.catalog.operation.impl.DeleteResponseImpl) HashMap(java.util.HashMap) DeleteRequestImpl(ddf.catalog.operation.impl.DeleteRequestImpl) ArrayList(java.util.ArrayList) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 8 with DeleteResponseImpl

use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.

the class HistorianTest method testDeleteResponseNoContentItems.

@Test
public void testDeleteResponseNoContentItems() throws SourceUnavailableException, IngestException, StorageException {
    Metacard metacard = getMetacardUpdatePair().get(0);
    DeleteRequest deleteRequest = new DeleteRequestImpl("deleteRequest");
    DeleteResponse deleteResponse = new DeleteResponseImpl(deleteRequest, new HashMap<>(), Collections.singletonList(metacard));
    historian.version(deleteResponse);
    assertThat(storageProvider.storageMap.size(), equalTo(0));
}
Also used : 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)

Example 9 with DeleteResponseImpl

use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.

the class HistorianTest method testDeleteResponseSetSkipFlag.

@Test
public void testDeleteResponseSetSkipFlag() 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);
    assertThat(deleteResponse.getProperties(), hasEntry(MetacardVersion.SKIP_VERSIONING, true));
}
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)

Example 10 with DeleteResponseImpl

use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.

the class CachingFederationStrategyTest method testProcessDeleteResponse.

@Test
public void testProcessDeleteResponse() throws Exception {
    Map<String, Serializable> testMap = new HashMap<>();
    testMap.put(Constants.SERVICE_TITLE, MOCK_RESPONSE_TITLE);
    DeleteResponse response = new DeleteResponseImpl(mock(DeleteRequestImpl.class), testMap, new ArrayList<>());
    response = strategy.process(response);
    assertThat(response.getPropertyValue(Constants.SERVICE_TITLE), is(MOCK_RESPONSE_TITLE));
}
Also used : Serializable(java.io.Serializable) DeleteResponse(ddf.catalog.operation.DeleteResponse) DeleteResponseImpl(ddf.catalog.operation.impl.DeleteResponseImpl) HashMap(java.util.HashMap) DeleteRequestImpl(ddf.catalog.operation.impl.DeleteRequestImpl) Test(org.junit.Test)

Aggregations

DeleteResponseImpl (ddf.catalog.operation.impl.DeleteResponseImpl)17 DeleteResponse (ddf.catalog.operation.DeleteResponse)14 Test (org.junit.Test)12 Metacard (ddf.catalog.data.Metacard)11 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 DeleteRequest (ddf.catalog.operation.DeleteRequest)8 DeleteRequestImpl (ddf.catalog.operation.impl.DeleteRequestImpl)8 Serializable (java.io.Serializable)5 List (java.util.List)4 DeletedMetacard (ddf.catalog.core.versioning.DeletedMetacard)3 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)3 CreateResponse (ddf.catalog.operation.CreateResponse)3 Update (ddf.catalog.operation.Update)3 CreateResponseImpl (ddf.catalog.operation.impl.CreateResponseImpl)3 IngestException (ddf.catalog.source.IngestException)3 Exchange (org.apache.camel.Exchange)3 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)3 DeleteStorageRequest (ddf.catalog.content.operation.DeleteStorageRequest)2 DeleteStorageRequestImpl (ddf.catalog.content.operation.impl.DeleteStorageRequestImpl)2