use of org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.CswTransactionRequest in project ddf by codice.
the class TransactionMessageBodyReader method readFrom.
@Override
public CswTransactionRequest readFrom(Class<CswTransactionRequest> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> multivaluedMap, InputStream inputStream) throws IOException, WebApplicationException {
XStream xStream = new XStream(new Xpp3Driver());
TransactionRequestConverter transactionRequestConverter = new TransactionRequestConverter(cswRecordConverter, registry);
transactionRequestConverter.setCswRecordConverter(new CswRecordConverter(metacardType));
xStream.registerConverter(transactionRequestConverter);
xStream.alias("csw:" + CswConstants.TRANSACTION, CswTransactionRequest.class);
xStream.alias(CswConstants.TRANSACTION, CswTransactionRequest.class);
return (CswTransactionRequest) xStream.fromXML(inputStream);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.CswTransactionRequest in project ddf by codice.
the class TestCswEndpoint method testIngestTransaction.
@Test
public void testIngestTransaction() throws CswException, SourceUnavailableException, FederationException, IngestException {
CswTransactionRequest request = new CswTransactionRequest();
request.getInsertActions().add(new InsertAction(CswConstants.CSW_TYPE, null, Arrays.asList(new MetacardImpl())));
TransactionResponseType response = csw.transaction(request);
assertThat(response, notNullValue());
assertThat(response.getInsertResult().isEmpty(), is(true));
assertThat(response.getTransactionSummary(), notNullValue());
TransactionSummaryType summary = response.getTransactionSummary();
assertThat(summary.getTotalDeleted().intValue(), is(0));
assertThat(summary.getTotalUpdated().intValue(), is(0));
assertThat(summary.getTotalInserted().intValue(), is(1));
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);
}
Aggregations