use of ddf.catalog.operation.impl.CreateRequestImpl in project ddf by codice.
the class WorkspacePreIngestPluginTest method testUnsuccessfulIngest.
@Test(expected = StopProcessingException.class)
public void testUnsuccessfulIngest() throws Exception {
WorkspacePreIngestPlugin wpip = makePlugin(null, null);
wpip.process(new CreateRequestImpl(new WorkspaceMetacardImpl()));
}
use of ddf.catalog.operation.impl.CreateRequestImpl in project ddf by codice.
the class TestPlugin method testCreate.
@Test
@Ignore
public void testCreate() throws PluginExecutionException, CatalogTransformerException, IOException, IngestException, SourceUnavailableException {
// given
CreateResponse createResponse = new CreateResponseImpl(new CreateRequestImpl(metacard), null, Arrays.asList(metacard));
// when
CreateResponse response = plugin.process(createResponse);
// then
verify(endpoint).addDocument(isA(HttpHeaders.class), isA(UriInfo.class), isA(InputStream.class));
assertThat(response, sameInstance(createResponse));
}
use of ddf.catalog.operation.impl.CreateRequestImpl in project ddf by codice.
the class DummyPreIngestPlugin method process.
public CreateRequest process(CreateRequest input) throws PluginExecutionException {
String methodName = "process(CreateRequest)";
LOGGER.debug(ENTERING, methodName);
CreateRequest newRequest = input;
if (input != null) {
List<Metacard> filteredCards = filterOutMetacards(input.getMetacards());
newRequest = new CreateRequestImpl(filteredCards);
}
LOGGER.debug(EXITING, methodName);
return newRequest;
}
use of ddf.catalog.operation.impl.CreateRequestImpl in project ddf by codice.
the class CatalogComponentFrameworkTest method testCreateWithWrongTypeOperation.
@Test
public /**
* Operation: CREATE Body contains: Metacard
*/
void testCreateWithWrongTypeOperation() throws Exception {
resetMocks();
// Setup expectations to verify
final MockEndpoint mockVerifierEndpoint = getMockEndpoint("mock:result");
mockVerifierEndpoint.expectedMessageCount(1);
final List<Metacard> metacards = new ArrayList<Metacard>();
metacards.add(metacard1);
// Mock catalog framework
final CreateRequest createRequest = new CreateRequestImpl(metacards);
final CreateResponse createResponse = new CreateResponseImpl(createRequest, new HashMap(), metacards);
when(catalogFramework.create(any(CreateRequest.class))).thenReturn(createResponse);
// Exercise the route with a CREATE operation
template.sendBodyAndHeader("direct:sampleInput", metacard1, "Operation", new Boolean("CREATE"));
// Verify that the number of metacards in the exchange after the records
// is identical to the input
assertListSize(mockVerifierEndpoint.getExchanges(), 1);
final Exchange exchange = mockVerifierEndpoint.getExchanges().get(0);
final List<Metacard> cardsCreated = (List<Metacard>) exchange.getIn().getBody();
assertListSize(cardsCreated, 0);
mockVerifierEndpoint.assertIsSatisfied();
}
use of ddf.catalog.operation.impl.CreateRequestImpl in project ddf by codice.
the class CatalogComponentFrameworkTest method testCreateWithListOfMetacards.
@Test
public /**
* Operation: CREATE Body contains: List<Metacard>
*/
void testCreateWithListOfMetacards() throws Exception {
resetMocks();
// Setup expectations to verify
final MockEndpoint mockVerifierEndpoint = getMockEndpoint("mock:result");
mockVerifierEndpoint.expectedMessageCount(1);
final List<Metacard> metacards = new ArrayList<Metacard>();
metacards.add(metacard1);
metacards.add(metacard2);
// Mock catalog framework
final CreateRequest createRequest = new CreateRequestImpl(metacards);
final CreateResponse createResponse = new CreateResponseImpl(createRequest, new HashMap(), metacards);
when(catalogFramework.create(any(CreateRequest.class))).thenReturn(createResponse);
// Exercise the route with a CREATE operation
template.sendBodyAndHeader("direct:sampleInput", metacards, "Operation", "CREATE");
// Verify that the number of metacards in the exchange after the records
// is identical to the input
assertListSize(mockVerifierEndpoint.getExchanges(), 1);
final Exchange exchange = mockVerifierEndpoint.getExchanges().get(0);
final List<Metacard> cardsCreated = (List<Metacard>) exchange.getIn().getBody();
assertListSize(cardsCreated, 2);
mockVerifierEndpoint.assertIsSatisfied();
}
Aggregations