use of ddf.catalog.operation.CreateRequest 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.CreateRequest in project ddf by codice.
the class CatalogMetricsTest method catalogCreateMetric.
@Test
public void catalogCreateMetric() throws Exception {
CreateRequest request = mock(CreateRequest.class);
CreateResponse response = mock(CreateResponse.class);
List<Metacard> createdList = mock(List.class);
when(createdList.size()).thenReturn(100);
when(response.getRequest()).thenReturn(request);
when(response.getCreatedMetacards()).thenReturn(createdList);
catalogMetrics.process(response);
assertThat(meterRegistry.counter("ddf.catalog.create").count(), is(100.0));
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class MetacardValidityMarkerPluginTest method testMetacardPassesEnforcedValidators.
@Test
public void testMetacardPassesEnforcedValidators() throws StopProcessingException, PluginExecutionException {
metacardValidators.add(getMockEnforcedPassingValidatorWithId(ID));
enforcedMetacardValidators.add(ID);
CreateRequest createRequest = getMockCreateRequest();
List<Metacard> createdMetacards = createRequest.getMetacards();
verifyEnforcedCreate(createRequest, createdMetacards);
UpdateRequest updateRequest = getMockUpdateRequest();
List<Metacard> updatedMetacards = getUpdatedMetacards(updateRequest);
verifyEnforcedUpdate(updateRequest, updatedMetacards);
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class MetacardValidityMarkerPluginTest method verifyEnforcedCreate.
private void verifyEnforcedCreate(CreateRequest originalRequest, List<Metacard> expectedAllowedMetacards) throws PluginExecutionException, StopProcessingException {
CreateRequest filteredRequest = plugin.process(originalRequest);
List<Metacard> filteredMetacards = filteredRequest.getMetacards();
verifyAllowedMetacards(filteredMetacards, expectedAllowedMetacards);
verifyRequestPropertiesUnchanged(originalRequest, filteredRequest);
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class MetacardValidityMarkerPluginTest method testMetacardPassesEnforcedValidatorsNoDescribable.
@Test
public void testMetacardPassesEnforcedValidatorsNoDescribable() throws StopProcessingException, PluginExecutionException {
MetacardValidator mockValidator = getMockPassingValidatorNoDescribable();
metacardValidators.add(mockValidator);
enforcedMetacardValidators.add(mockValidator.getClass().getCanonicalName());
CreateRequest createRequest = getMockCreateRequest();
List<Metacard> createdMetacards = createRequest.getMetacards();
verifyEnforcedCreate(createRequest, createdMetacards);
UpdateRequest updateRequest = getMockUpdateRequest();
List<Metacard> updatedMetacards = getUpdatedMetacards(updateRequest);
verifyEnforcedUpdate(updateRequest, updatedMetacards);
}
Aggregations