use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.
the class RemoteDeleteOperations method doRemoteDelete.
private DeleteResponse doRemoteDelete(DeleteRequest deleteRequest) {
HashSet<ProcessingDetails> exceptions = new HashSet<>();
Map<String, Serializable> properties = new HashMap<>();
List<CatalogStore> stores = opsCatStoreSupport.getCatalogStoresForRequest(deleteRequest, exceptions);
List<Metacard> metacards = new ArrayList<>();
for (CatalogStore store : stores) {
try {
if (!store.isAvailable()) {
exceptions.add(new ProcessingDetailsImpl(store.getId(), null, "CatalogStore is not available"));
} else {
// TODO: 4/27/17 Address bug in DDF-2970 for overwriting deleted metacards
DeleteResponse response = store.delete(deleteRequest);
properties.put(store.getId(), new ArrayList<>(response.getDeletedMetacards()));
metacards = response.getDeletedMetacards();
}
} catch (IngestException e) {
INGEST_LOGGER.error("Error deleting metacards for CatalogStore {}", store.getId(), e);
exceptions.add(new ProcessingDetailsImpl(store.getId(), e));
}
}
return new DeleteResponseImpl(deleteRequest, properties, metacards, exceptions);
}
use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.
the class CatalogMetricsTest method catalogUpdateExceptionMetric.
@Test
public void catalogUpdateExceptionMetric() throws Exception {
Iterable<Tag> updateExceptionTags = Tags.of("type", IngestException.class.getName(), "source", "source3");
UpdateRequest request = mock(UpdateRequest.class);
UpdateResponse response = mock(UpdateResponse.class);
mockCatalogResponseExceptions(request, response, new ProcessingDetailsImpl("source3", new IngestException()));
catalogMetrics.process(response);
assertThat(meterRegistry.counter("ddf.catalog.update.exceptions", updateExceptionTags).count(), is(1.0));
}
use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.
the class CatalogMetricsTest method catalogCreateExceptionMetric.
@Test
public void catalogCreateExceptionMetric() throws Exception {
Iterable<Tag> createExceptionTags = Tags.of("type", IngestException.class.getName(), "source", "source2");
CreateRequest request = mock(CreateRequest.class);
CreateResponse response = mock(CreateResponse.class);
mockCatalogResponseExceptions(request, response, new ProcessingDetailsImpl("source2", new IngestException()));
catalogMetrics.process(response);
assertThat(meterRegistry.counter("ddf.catalog.create.exceptions", createExceptionTags).count(), is(1.0));
}
use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.
the class SourceMetricsImplTest method testExceptionCounterForQueryResponse.
@Test
public void testExceptionCounterForQueryResponse() throws PluginExecutionException, StopProcessingException {
QueryResponse queryResponse = mock(QueryResponse.class);
Set<ProcessingDetails> processingDetails = Stream.of(new ProcessingDetailsImpl("testSource", new Exception())).collect(Collectors.toSet());
when(queryResponse.getProcessingDetails()).thenReturn(processingDetails);
sourceMetricsImpl.process(queryResponse);
String suffix = METRICS_PREFIX + "." + QUERY_SCOPE + "." + EXCEPTION_TYPE;
assertThat(meterRegistry.counter(suffix, "source", "testSource").count(), is(1.0));
}
use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.
the class ProcessingDetailsImplTest method testInequalityOfSourceIds.
@Test
public void testInequalityOfSourceIds() {
String sourceId = "test source";
String differentSourceId = "different test source";
Exception exception = new UnsupportedQueryException("We do not support this query");
List<String> warning = Collections.singletonList("warning");
ProcessingDetails processingDetails = new ProcessingDetailsImpl(sourceId, exception, warning);
ProcessingDetails processingDetailsWithDifferentSourceId = new ProcessingDetailsImpl(differentSourceId, exception, warning);
assertThat(processingDetails, is(not(processingDetailsWithDifferentSourceId)));
}
Aggregations