Search in sources :

Example 46 with DeleteResponse

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

the class CatalogBackupPluginTest method testDeleteResponseDeleteSuccessful.

@Test
public void testDeleteResponseDeleteSuccessful() throws Exception {
    // Setup
    int subDirLevels = 3;
    CatalogBackupPlugin plugin = getPlugin(subDirLevels);
    DeleteResponse mockDeleteResponse = getDeleteResponse(Arrays.asList(METACARD_IDS));
    plugin.process(getCreateResponse(METACARD_IDS));
    // Delete files
    DeleteResponse postPluginDeleteResponse = plugin.process(mockDeleteResponse);
    // Ensure files were deleted
    assertThat(postPluginDeleteResponse, is(notNullValue()));
    assertFilesDoNotExist(METACARD_IDS, subDirLevels);
}
Also used : DeleteResponse(ddf.catalog.operation.DeleteResponse) Test(org.junit.Test)

Example 47 with DeleteResponse

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

the class CatalogBackupPluginTest method testDeleteResponseFailToDeleteOneMetacard.

@Test
public void testDeleteResponseFailToDeleteOneMetacard() throws PluginExecutionException {
    //Verify assumptions about hard-codes indexes
    assertThat("The list of metacard IDs has changed sized", METACARD_IDS, arrayWithSize(2));
    CatalogBackupPlugin plugin = getPlugin();
    DeleteResponse mockDeleteResponse = getDeleteResponse(Arrays.asList(METACARD_IDS));
    // Perform Test
    plugin.process(getCreateResponse(new String[] { METACARD_IDS[0] }));
    plugin.process(mockDeleteResponse);
}
Also used : DeleteResponse(ddf.catalog.operation.DeleteResponse) Test(org.junit.Test)

Example 48 with DeleteResponse

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

the class HistorianTest method testDeleteResponseSkipProperty.

@Test
public void testDeleteResponseSkipProperty() throws SourceUnavailableException, IngestException {
    Map<String, Serializable> properties = new HashMap<>();
    properties.put(MetacardVersion.SKIP_VERSIONING, true);
    DeleteResponse deleteResponse = mock(DeleteResponse.class);
    when(deleteResponse.getProperties()).thenReturn(properties);
    historian.version(deleteResponse);
    verifyZeroInteractions(catalogProvider);
}
Also used : Serializable(java.io.Serializable) DeleteResponse(ddf.catalog.operation.DeleteResponse) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 49 with DeleteResponse

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

the class TestPlugin method testDelete.

@Test
@Ignore
public void testDelete() throws PluginExecutionException, CatalogTransformerException, IOException, IngestException, SourceUnavailableException {
    // given
    when(metacard.getId()).thenReturn("23");
    DeleteResponse deleteResponse = new DeleteResponseImpl(null, null, Arrays.asList(metacard));
    // when
    DeleteResponse response = plugin.process(deleteResponse);
    // then
    verify(endpoint).deleteDocument(argThat(is("23")));
    assertThat(response, sameInstance(deleteResponse));
}
Also used : DeleteResponse(ddf.catalog.operation.DeleteResponse) DeleteResponseImpl(ddf.catalog.operation.impl.DeleteResponseImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 50 with DeleteResponse

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

the class SolrProviderTest method testDeletePendingNrtIndex.

@Test
public void testDeletePendingNrtIndex() throws Exception {
    deleteAllIn(provider);
    ConfigurationStore.getInstance().setForceAutoCommit(false);
    try {
        MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord());
        CreateResponse createResponse = create(metacard);
        DeleteResponse deleteResponse = delete(createResponse.getCreatedMetacards().get(0).getId());
        Metacard deletedMetacard = deleteResponse.getDeletedMetacards().get(0);
        verifyDeletedRecord(metacard, createResponse, deleteResponse, deletedMetacard);
    } finally {
        ConfigurationStore.getInstance().setForceAutoCommit(true);
    }
}
Also used : Metacard(ddf.catalog.data.Metacard) DeleteResponse(ddf.catalog.operation.DeleteResponse) CreateResponse(ddf.catalog.operation.CreateResponse) Test(org.junit.Test)

Aggregations

DeleteResponse (ddf.catalog.operation.DeleteResponse)54 Test (org.junit.Test)37 Metacard (ddf.catalog.data.Metacard)23 DeleteRequest (ddf.catalog.operation.DeleteRequest)23 ArrayList (java.util.ArrayList)19 DeleteRequestImpl (ddf.catalog.operation.impl.DeleteRequestImpl)18 HashMap (java.util.HashMap)17 Serializable (java.io.Serializable)15 DeleteResponseImpl (ddf.catalog.operation.impl.DeleteResponseImpl)14 CreateResponse (ddf.catalog.operation.CreateResponse)13 List (java.util.List)11 QueryResponse (ddf.catalog.operation.QueryResponse)9 QueryRequest (ddf.catalog.operation.QueryRequest)8 IngestException (ddf.catalog.source.IngestException)8 Result (ddf.catalog.data.Result)7 UpdateResponse (ddf.catalog.operation.UpdateResponse)7 QueryImpl (ddf.catalog.operation.impl.QueryImpl)7 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)7 CatalogFramework (ddf.catalog.CatalogFramework)6 Update (ddf.catalog.operation.Update)6