use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class TestRegistryStore method testCreateWithExistingMetacard.
@Test
public void testCreateWithExistingMetacard() throws Exception {
Metacard mcard = getDefaultMetacard();
queryResults.add(new ResultImpl(mcard));
CreateRequest request = new CreateRequestImpl(mcard);
CreateResponse response = registryStore.create(request);
assertThat(response.getCreatedMetacards().get(0), is(mcard));
}
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);
}
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 testMultipleValidationTagsInvalid.
@Test
public void testMultipleValidationTagsInvalid() throws StopProcessingException, PluginExecutionException, ValidationException {
metacardValidators.add(getMockFailingValidatorWithErrorsAndWarnings());
CreateRequest request = getMockCreateRequest();
Metacard m1 = request.getMetacards().get(0);
Set<String> tags = m1.getTags();
tags.add(VALID_TAG);
m1.setAttribute(new AttributeImpl(Metacard.TAGS, new ArrayList<String>(tags)));
CreateRequest filteredRequest = plugin.process(request);
assertThat(filteredRequest.getMetacards().get(0).getTags(), hasItem(INVALID_TAG));
assertThat(filteredRequest.getMetacards().get(0).getTags(), not(hasItem(VALID_TAG)));
}
Aggregations