Search in sources :

Example 11 with ElementSetNameType

use of net.opengis.cat.csw.v_2_0_2.ElementSetNameType in project ddf by codice.

the class TestCswEndpoint method testPostGetRecordsGmdCswOutputSchema.

@Test
public void testPostGetRecordsGmdCswOutputSchema() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
    GetRecordsType grr = createDefaultPostRecordsRequest();
    grr.setResultType(ResultType.RESULTS);
    QueryType query = new QueryType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(GmdConstants.GMD_NAMESPACE, GmdConstants.GMD_LOCAL_NAME, GmdConstants.GMD_PREFIX));
    query.setTypeNames(typeNames);
    QueryConstraintType constraint = new QueryConstraintType();
    constraint.setCqlText(GMD_CONTEXTUAL_LIKE_QUERY);
    query.setConstraint(constraint);
    ElementSetNameType esnt = new ElementSetNameType();
    esnt.setValue(ElementSetType.SUMMARY);
    query.setElementSetName(esnt);
    JAXBElement<QueryType> jaxbQuery = new JAXBElement<>(cswQnameOutPutSchema, QueryType.class, query);
    grr.setAbstractQuery(jaxbQuery);
    final String exampleSchema = CswConstants.CSW_OUTPUT_SCHEMA;
    grr.setOutputSchema(exampleSchema);
    final String exampleMime = "application/xml";
    grr.setOutputFormat(exampleMime);
    when(catalogFramework.query(argument.capture())).thenReturn(getQueryResponse());
    CswRecordCollection collection = csw.getRecords(grr);
    assertThat(collection.getMimeType(), is(exampleMime));
    assertThat(collection.getOutputSchema(), is(exampleSchema));
    assertThat(collection.getSourceResponse(), notNullValue());
    assertThat(collection.getResultType(), is(ResultType.RESULTS));
    assertThat(collection.getElementSetType(), is(ElementSetType.SUMMARY));
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) CswRecordCollection(org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection) GetRecordsType(net.opengis.cat.csw.v_2_0_2.GetRecordsType) ElementSetNameType(net.opengis.cat.csw.v_2_0_2.ElementSetNameType) JAXBElement(javax.xml.bind.JAXBElement) QueryType(net.opengis.cat.csw.v_2_0_2.QueryType) QueryConstraintType(net.opengis.cat.csw.v_2_0_2.QueryConstraintType) Test(org.junit.Test)

Aggregations

ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)10 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)10 JAXBElement (javax.xml.bind.JAXBElement)9 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)7 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)6 XStream (com.thoughtworks.xstream.XStream)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Ignore (jdk.nashorn.internal.ir.annotations.Ignore)5 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)5 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)5 Matchers.anyString (org.mockito.Matchers.anyString)5 MarshallingContext (com.thoughtworks.xstream.converters.MarshallingContext)4 HierarchicalStreamWriter (com.thoughtworks.xstream.io.HierarchicalStreamWriter)4 QName (javax.xml.namespace.QName)3 QueryConstraintType (net.opengis.cat.csw.v_2_0_2.QueryConstraintType)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 TransformerManager (org.codice.ddf.spatial.ogc.csw.catalog.common.transformer.TransformerManager)2 NoNameCoder (com.thoughtworks.xstream.io.naming.NoNameCoder)1