use of ddf.catalog.operation.UpdateResponse in project ddf by codice.
the class CatalogBackupPluginTest method getUpdateResponse.
private UpdateResponse getUpdateResponse(List<String> oldMetacardIds) {
List<Update> updatedMetacards = new ArrayList<>(oldMetacardIds.size());
int i = 0;
for (String oldMetacardId : oldMetacardIds) {
Metacard oldMetacard = getMetacard(oldMetacardId, BASE_OLD_TITLE + i);
Metacard newMetacard = getMetacard(oldMetacardId, BASE_NEW_TITLE + i);
// Create UpdateResponse
Update mockUpdate = mock(Update.class);
when(mockUpdate.getOldMetacard()).thenReturn(oldMetacard);
when(mockUpdate.getNewMetacard()).thenReturn(newMetacard);
updatedMetacards.add(mockUpdate);
i++;
}
UpdateRequest request = mock(UpdateRequest.class);
UpdateResponse mockUpdateResponse = mock(UpdateResponse.class);
when(mockUpdateResponse.getUpdatedMetacards()).thenReturn(updatedMetacards);
when(mockUpdateResponse.getRequest()).thenReturn(request);
return mockUpdateResponse;
}
use of ddf.catalog.operation.UpdateResponse in project ddf by codice.
the class UpdateOperations method performLocalUpdate.
private UpdateResponse performLocalUpdate(UpdateRequest updateRequest) throws IngestException, SourceUnavailableException {
if (!Requests.isLocal(updateRequest)) {
return null;
}
UpdateResponse updateResponse = sourceOperations.getCatalog().update(updateRequest);
updateResponse = historian.version(updateResponse);
return updateResponse;
}
use of ddf.catalog.operation.UpdateResponse in project ddf by codice.
the class UpdateOperations method performRemoteUpdate.
private UpdateResponse performRemoteUpdate(UpdateRequest updateRequest, UpdateResponse updateResponse) {
if (opsCatStoreSupport.isCatalogStoreRequest(updateRequest)) {
UpdateResponse remoteUpdateResponse = doRemoteUpdate(updateRequest);
if (updateResponse == null) {
updateResponse = remoteUpdateResponse;
} else {
updateResponse.getProperties().putAll(remoteUpdateResponse.getProperties());
updateResponse.getProcessingErrors().addAll(remoteUpdateResponse.getProcessingErrors());
}
}
return updateResponse;
}
use of ddf.catalog.operation.UpdateResponse in project ddf by codice.
the class UpdateOperations method update.
//
// Delegate methods
//
public UpdateResponse update(UpdateRequest updateRequest) throws IngestException, SourceUnavailableException {
UpdateResponse updateResponse = doUpdate(updateRequest);
updateResponse = doPostIngest(updateResponse);
return updateResponse;
}
use of ddf.catalog.operation.UpdateResponse in project ddf by codice.
the class CatalogMetricsTest method catalogUpdateExceptionMetric.
@Test
public void catalogUpdateExceptionMetric() throws Exception {
Iterable<Tag> updateExceptionTags = Tags.of("type", IngestException.class.getName(), "source", "source3");
UpdateRequest request = mock(UpdateRequest.class);
UpdateResponse response = mock(UpdateResponse.class);
mockCatalogResponseExceptions(request, response, new ProcessingDetailsImpl("source3", new IngestException()));
catalogMetrics.process(response);
assertThat(meterRegistry.counter("ddf.catalog.update.exceptions", updateExceptionTags).count(), is(1.0));
}
Aggregations