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