Search in sources :

Example 11 with InsertAction

use of org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.InsertAction 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);
}
Also used : CswTransactionRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.CswTransactionRequest) InsertAction(org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.InsertAction) TransactionSummaryType(net.opengis.cat.csw.v_2_0_2.TransactionSummaryType) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) TransactionResponseType(net.opengis.cat.csw.v_2_0_2.TransactionResponseType) Test(org.junit.Test)

Aggregations

InsertAction (org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.InsertAction)11 CswTransactionRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.CswTransactionRequest)10 Test (org.junit.Test)7 DeleteAction (org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.DeleteAction)6 Metacard (ddf.catalog.data.Metacard)5 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)5 UpdateAction (org.codice.ddf.spatial.ogc.csw.catalog.common.transaction.UpdateAction)5 TransactionResponseType (net.opengis.cat.csw.v_2_0_2.TransactionResponseType)4 TransactionSummaryType (net.opengis.cat.csw.v_2_0_2.TransactionSummaryType)3 Converter (com.thoughtworks.xstream.converters.Converter)2 UnmarshallingContext (com.thoughtworks.xstream.converters.UnmarshallingContext)2 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)2 IngestException (ddf.catalog.source.IngestException)2 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 DeleteType (net.opengis.cat.csw.v_2_0_2.DeleteType)2 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)2 CswRecordConverter (org.codice.ddf.spatial.ogc.csw.catalog.converter.CswRecordConverter)2 CswQueryFactoryTest (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest)2