use of ddf.catalog.operation.UpdateRequest 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);
}
use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class MetacardValidityMarkerPluginTest method verifyEnforcedUpdate.
private void verifyEnforcedUpdate(UpdateRequest originalRequest, List<Metacard> expectedAllowedMetacards) throws PluginExecutionException, StopProcessingException {
UpdateRequest filteredRequest = plugin.process(originalRequest);
List<Metacard> filteredMetacards = getUpdatedMetacards(filteredRequest);
verifyAllowedMetacards(filteredMetacards, expectedAllowedMetacards);
verifyRequestPropertiesUnchanged(originalRequest, filteredRequest);
}
use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class MetacardValidityMarkerPluginTest method verifyUpdate.
private void verifyUpdate(UpdateRequest originalRequest, Consumer<Attribute> errorExpectation, Consumer<Attribute> warningExpectation, String expectedTag) throws PluginExecutionException, StopProcessingException {
UpdateRequest filteredRequest = plugin.process(originalRequest);
List<Metacard> filteredMetacards = getUpdatedMetacards(filteredRequest);
verifyMetacardErrorsAndWarnings(filteredMetacards, errorExpectation, warningExpectation, expectedTag);
verifyRequestPropertiesUnchanged(originalRequest, filteredRequest);
}
use of ddf.catalog.operation.UpdateRequest 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.UpdateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method testUpdateSingleUpdateNull.
@Test
public void testUpdateSingleUpdateNull() throws PluginExecutionException, StopProcessingException {
UpdateRequest request = mock(UpdateRequest.class);
List<Entry<Serializable, Metacard>> updates = new ArrayList<>();
updates.add(null);
when(request.getUpdates()).thenReturn(updates);
UpdateRequest returnedRequest = plugin.process(request);
assertThat(returnedRequest, is(request));
}
Aggregations