use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class SecurityPluginTest method testNominalCaseDelete.
@Test
public void testNominalCaseDelete() throws Exception {
Subject mockSubject = mock(Subject.class);
ThreadContext.bind(mockSubject);
DeleteRequest request = new MockDeleteRequest();
SecurityPlugin plugin = new SecurityPlugin();
request = plugin.processPreDelete(request);
request = plugin.processPreDelete(request);
assertThat(request.getPropertyValue(SecurityConstants.SECURITY_SUBJECT), equalTo(mockSubject));
}
use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class CatalogFrameworkImplTest method testProviderRuntimeExceptionOnDeleteByID.
@Test(expected = IngestException.class)
public void testProviderRuntimeExceptionOnDeleteByID() throws IngestException {
MockEventProcessor eventAdmin = new MockEventProcessor();
// use exception provider instead of memory
MockExceptionProvider provider = new MockExceptionProvider("Provider", "Provider", "v1.0", "DDF", new HashSet<ContentType>(), true, null);
MockMemoryStorageProvider storageProvider = new MockMemoryStorageProvider();
CatalogFramework framework = this.createDummyCatalogFramework(provider, storageProvider, eventAdmin, true);
List<String> ids = new ArrayList<String>();
ids.add("1234");
DeleteRequest request = new DeleteRequestImpl((String[]) ids.toArray(new String[ids.size()]));
// expected to throw exception due to catalog provider
try {
framework.delete(request);
} catch (SourceUnavailableException e) {
fail();
}
}
use of ddf.catalog.operation.DeleteRequest 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));
}
use of ddf.catalog.operation.DeleteRequest 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));
}
use of ddf.catalog.operation.DeleteRequest in project ddf by codice.
the class SolrCacheTest method deleteWithId.
@Test
public void deleteWithId() throws Exception {
DeleteRequest mockRequest = setupDeleteRequest("id");
solrCache.delete(mockRequest);
verify(mockCacheSolrMetacardClient).deleteByIds("original_id" + SchemaFields.TEXT_SUFFIX, null, false);
}
Aggregations