use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method testUpdateWithNullRequest.
@Test
public void testUpdateWithNullRequest() throws PluginExecutionException, StopProcessingException {
UpdateRequest returnedRequest = plugin.process((UpdateRequest) null);
assertThat(returnedRequest, nullValue());
}
use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method testUpdateSingleUpdateKeyNull.
@Test
public void testUpdateSingleUpdateKeyNull() throws PluginExecutionException, StopProcessingException {
UpdateRequest request = mock(UpdateRequest.class);
List<Entry<Serializable, Metacard>> updates = new ArrayList<>();
updates.add(new Entry<Serializable, Metacard>() {
@Override
public Metacard setValue(Metacard value) {
return null;
}
@Override
public Metacard getValue() {
return null;
}
@Override
public Serializable getKey() {
return null;
}
});
when(request.getUpdates()).thenReturn(updates);
UpdateRequest returnedRequest = plugin.process(request);
assertThat(returnedRequest, is(request));
}
use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method testUpdateSingleUpdateValueNull.
@Test
public void testUpdateSingleUpdateValueNull() throws PluginExecutionException, StopProcessingException {
UpdateRequest request = mock(UpdateRequest.class);
List<Entry<Serializable, Metacard>> updates = new ArrayList<>();
updates.add(new Entry<Serializable, Metacard>() {
@Override
public Metacard setValue(Metacard value) {
return null;
}
@Override
public Metacard getValue() {
return null;
}
@Override
public Serializable getKey() {
return SAMPLE_ID;
}
});
when(request.getUpdates()).thenReturn(updates);
UpdateRequest returnedRequest = plugin.process(request);
assertThat(returnedRequest, is(request));
}
use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class TestMetacardGroomerPlugin method processUpdate.
private Metacard processUpdate(Metacard inputMetacard) throws PluginExecutionException, StopProcessingException {
UpdateRequestImpl inputRequest = new UpdateRequestImpl(SAMPLE_ID, copy(inputMetacard));
UpdateRequest returnedRequest = plugin.process(inputRequest);
assertNotNull(returnedRequest);
assertThat(returnedRequest.getUpdates().size(), is(1));
return returnedRequest.getUpdates().get(0).getValue();
}
use of ddf.catalog.operation.UpdateRequest in project ddf by codice.
the class CatalogMetricsTest method catalogUpdateMetric.
@Test
public void catalogUpdateMetric() throws Exception {
UpdateRequest request = mock(UpdateRequest.class);
UpdateResponse response = mock(UpdateResponse.class);
List<Update> updatedList = mock(List.class);
when(updatedList.size()).thenReturn(100);
when(response.getRequest()).thenReturn(request);
when(response.getUpdatedMetacards()).thenReturn(updatedList);
underTest.process(response);
assertThat(underTest.updatedMetacards.getCount(), is(100L));
}
Aggregations