use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class ReplicateCommandTest method testFailedtoIngestHalf.
@Test
public void testFailedtoIngestHalf() throws Exception {
when(catalogFramework.create(isA(CreateRequest.class))).thenAnswer(invocation -> {
Object[] args = invocation.getArguments();
CreateRequest request = (CreateRequest) args[0];
when(mockCreateResponse.getCreatedMetacards()).thenReturn(request.getMetacards().subList(0, request.getMetacards().size() / 2));
return mockCreateResponse;
});
replicateCommand.isUseTemporal = false;
replicateCommand.sourceId = "sourceId1";
replicateCommand.temporalProperty = Metacard.EFFECTIVE;
replicateCommand.executeWithSubject();
verifyReplicate(HITS, Metacard.EFFECTIVE);
verifyConsoleOutput((int) Math.floor(HITS / 2) + " record(s) replicated; " + (int) (HITS - Math.floor(HITS / 2)) + " record(s) failed;");
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method testCreateWithNoRecords.
@Test
public void testCreateWithNoRecords() throws PluginExecutionException, StopProcessingException {
CreateRequest request = mock(CreateRequest.class);
when(request.getMetacards()).thenReturn(new ArrayList<>());
CreateRequest returnedRequest = plugin.process(request);
assertThat(returnedRequest, not(nullValue()));
assertThat(returnedRequest.getMetacards(), not(nullValue()));
assertThat(returnedRequest.getMetacards().size(), is(0));
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method testCreateWithNullRequest.
@Test
public void testCreateWithNullRequest() throws PluginExecutionException, StopProcessingException {
CreateRequest returnedRequest = plugin.process((CreateRequest) null);
assertThat(returnedRequest, nullValue());
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method processCreate.
private Metacard processCreate(Metacard inputMetacard) throws PluginExecutionException, StopProcessingException {
CreateRequestImpl inputRequest = new CreateRequestImpl(copy(inputMetacard));
CreateRequest returnedRequest = plugin.process(inputRequest);
assertNotNull(returnedRequest);
assertThat(returnedRequest.getMetacards().size(), is(1));
return returnedRequest.getMetacards().get(0);
}
use of ddf.catalog.operation.CreateRequest in project ddf by codice.
the class SolrProviderTest method testCreateNullList.
@Test
public void testCreateNullList() throws IngestException, UnsupportedQueryException {
deleteAllIn(provider);
CreateResponse response = provider.create(new CreateRequest() {
@Override
public boolean hasProperties() {
return false;
}
@Override
public Serializable getPropertyValue(String name) {
return null;
}
@Override
public Set<String> getPropertyNames() {
return null;
}
@Override
public Map<String, Serializable> getProperties() {
return null;
}
@Override
public boolean containsPropertyName(String name) {
return false;
}
@Override
public List<Metacard> getMetacards() {
return null;
}
});
assertThat(response.getCreatedMetacards().size(), is(0));
}
Aggregations