use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.
the class RegistryIdPostIngestPluginTest method testProcessDeleteLocal.
@Test
public void testProcessDeleteLocal() throws Exception {
MetacardImpl metacard = getDefaultMetacard();
metacard.setAttribute(RegistryObjectMetacardType.REGISTRY_LOCAL_NODE, true);
CreateResponse createResponse = new CreateResponseImpl(null, null, Collections.singletonList(metacard));
registryIdPostIngestPlugin.process(createResponse);
assertThat(registryIdPostIngestPlugin.getLocalRegistryIds().size(), equalTo(1));
DeleteResponse deleteResponse = new DeleteResponseImpl(null, null, Collections.singletonList(metacard));
registryIdPostIngestPlugin.process(deleteResponse);
assertThat(registryIdPostIngestPlugin.getLocalRegistryIds().size(), equalTo(0));
}
use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.
the class RegistryIdPostIngestPluginTest method testProcessDelete.
@Test
public void testProcessDelete() throws Exception {
CreateResponse createResponse = new CreateResponseImpl(null, null, Collections.singletonList(getDefaultMetacard()));
registryIdPostIngestPlugin.process(createResponse);
DeleteResponse deleteResponse = new DeleteResponseImpl(null, null, Collections.singletonList(getDefaultMetacard()));
registryIdPostIngestPlugin.process(deleteResponse);
assertThat(registryIdPostIngestPlugin.getRegistryIds().size(), equalTo(0));
}
use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.
the class CachingFederationStrategyTest method testProcessDeleteResponse.
@Test
public void testProcessDeleteResponse() throws Exception {
Map<String, Serializable> testMap = new HashMap<>();
testMap.put(Constants.SERVICE_TITLE, MOCK_RESPONSE_TITLE);
DeleteResponse response = new DeleteResponseImpl(mock(DeleteRequestImpl.class), testMap, new ArrayList<>());
response = strategy.process(response);
assertThat(response.getPropertyValue(Constants.SERVICE_TITLE), is(MOCK_RESPONSE_TITLE));
}
use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.
the class TestCswEndpoint method testDeleteTransaction.
@Test
public void testDeleteTransaction() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException, IngestException {
DeleteType deleteType = mock(DeleteType.class);
doReturn(CswConstants.CSW_RECORD).when(deleteType).getTypeName();
doReturn("").when(deleteType).getHandle();
QueryConstraintType queryConstraintType = new QueryConstraintType();
queryConstraintType.setCqlText("title = \"foo\"");
doReturn(queryConstraintType).when(deleteType).getConstraint();
List<Result> results = new ArrayList<>();
results.add(new ResultImpl(new MetacardImpl()));
results.add(new ResultImpl(new MetacardImpl()));
QueryResponse queryResponse = new QueryResponseImpl(null, results, results.size());
doReturn(queryResponse).when(catalogFramework).query(any(QueryRequest.class));
List<Metacard> deletedMetacards = new ArrayList<>();
deletedMetacards.add(new MetacardImpl());
deletedMetacards.add(new MetacardImpl());
DeleteResponse deleteResponse = new DeleteResponseImpl(null, null, deletedMetacards);
doReturn(deleteResponse).when(catalogFramework).delete(any(DeleteRequest.class));
DeleteAction deleteAction = new DeleteAction(deleteType, DefaultCswRecordMap.getDefaultCswRecordMap().getPrefixToUriMapping());
CswTransactionRequest deleteRequest = new CswTransactionRequest();
deleteRequest.getDeleteActions().add(deleteAction);
deleteRequest.setVersion(CswConstants.VERSION_2_0_2);
deleteRequest.setService(CswConstants.CSW);
deleteRequest.setVerbose(false);
TransactionResponseType response = csw.transaction(deleteRequest);
assertThat(response, notNullValue());
TransactionSummaryType summary = response.getTransactionSummary();
assertThat(summary, notNullValue());
assertThat(summary.getTotalDeleted().intValue(), is(2));
assertThat(summary.getTotalInserted().intValue(), is(0));
assertThat(summary.getTotalUpdated().intValue(), is(0));
verifyMarshalResponse(response, "net.opengis.cat.csw.v_2_0_2:net.opengis.filter.v_1_1_0:net.opengis.gml.v_3_1_1", cswQnameOutPutSchema);
}
use of ddf.catalog.operation.impl.DeleteResponseImpl in project ddf by codice.
the class RemoteDeleteOperationsTest method setUpDeleteRequest.
private void setUpDeleteRequest() {
MetacardImpl metacard = new MetacardImpl();
ArrayList<Metacard> metacardList = new ArrayList<>();
metacard.setId("Bob");
metacard.setTitle("Bob's Title");
metacardList.add(metacard);
metacard = new MetacardImpl();
metacard.setId("Bobbert");
metacard.setTitle("Bobbert's Title");
metacardList.add(metacard);
deleteRequest = new DeleteRequestImpl(metacard.getId());
deleteResponse = new DeleteResponseImpl(deleteRequest, new HashMap(), metacardList);
}
Aggregations