Search in sources :

Example 21 with SchemaComponentType

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

the class CswEndpointTest method testDescribeRecordMultipleTypesMultipleNamespacesNominal.

@Test
public void testDescribeRecordMultipleTypesMultipleNamespacesNominal() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw:test");
    drr.setNamespace("xmlns(" + VALID_PREFIX + "=" + CswConstants.CSW_OUTPUT_SCHEMA + ")");
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drr);
    } catch (CswException e) {
        fail("DescribeRecord failed with message '" + e.getMessage() + "'");
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 22 with SchemaComponentType

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

the class CswEndpointTest method testDescribeRecordRequestMultipleTypes.

@Test
public void testDescribeRecordRequestMultipleTypes() {
    DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
    drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw:test");
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drr);
    } catch (CswException e) {
        fail("CswException caught during describeRecord GET request: " + e.getMessage());
    }
    // spec does not say specifically it should throw an exception,
    // and NSG interoperability tests require to skip the unknown ones, and
    // potentially return an empty list if none are known
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) DescribeRecordRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 23 with SchemaComponentType

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

the class CswEndpointTest method testPostDescribeRecordRequestGMDTypePassed.

@Test
public void testPostDescribeRecordRequestGMDTypePassed() {
    DescribeRecordType drt = createDefaultDescribeRecordType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(GmdConstants.GMD_NAMESPACE, GmdConstants.GMD_LOCAL_NAME, GmdConstants.GMD_PREFIX));
    drt.setTypeName(typeNames);
    when(mockSchemaManager.getTransformerSchemaForId(GMD_PREFIX_LOCAL_TYPE)).thenReturn(GmdConstants.GMD_NAMESPACE);
    when(mockSchemaManager.getTransformerSchemaLocationForId(GMD_PREFIX_LOCAL_TYPE)).thenReturn(GMD_SCHEMA_LOCATION);
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drt);
    } catch (CswException e) {
        fail("CswException caught during describeRecord POST request: " + e.getMessage());
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : DescribeRecordType(net.opengis.cat.csw.v_2_0_2.DescribeRecordType) SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) QName(javax.xml.namespace.QName) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) ArrayList(java.util.ArrayList) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 24 with SchemaComponentType

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

the class CswEndpointTest method testPostDescribeRecordValidSchemaLanguage.

@Test
public void testPostDescribeRecordValidSchemaLanguage() {
    DescribeRecordType drt = createDefaultDescribeRecordType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, VALID_TYPE, VALID_PREFIX));
    drt.setTypeName(typeNames);
    drt.setSchemaLanguage(CswConstants.SCHEMA_LANGUAGE_X_SCHEMA);
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drt);
    } catch (CswException e) {
        fail("DescribeRecord failed with message '" + e.getMessage() + "'");
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : DescribeRecordType(net.opengis.cat.csw.v_2_0_2.DescribeRecordType) SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) QName(javax.xml.namespace.QName) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) ArrayList(java.util.ArrayList) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 25 with SchemaComponentType

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

the class CswEndpointTest method testPostDescribeRecordRequestSingleTypePassed.

@Test
public void testPostDescribeRecordRequestSingleTypePassed() {
    DescribeRecordType drt = createDefaultDescribeRecordType();
    List<QName> typeNames = new ArrayList<>();
    typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, VALID_TYPE, VALID_PREFIX));
    drt.setTypeName(typeNames);
    DescribeRecordResponseType drrt = null;
    try {
        drrt = csw.describeRecord(drt);
    } catch (CswException e) {
        fail("CswException caught during describeRecord POST request: " + e.getMessage());
    }
    assertThat(drrt, notNullValue());
    assertThat(drrt.getSchemaComponent(), notNullValue());
    List<SchemaComponentType> schemaComponents = drrt.getSchemaComponent();
    assertThat(schemaComponents.size(), is(1));
}
Also used : DescribeRecordType(net.opengis.cat.csw.v_2_0_2.DescribeRecordType) SchemaComponentType(net.opengis.cat.csw.v_2_0_2.SchemaComponentType) QName(javax.xml.namespace.QName) DescribeRecordResponseType(net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType) ArrayList(java.util.ArrayList) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Aggregations

SchemaComponentType (net.opengis.cat.csw.v_2_0_2.SchemaComponentType)25 DescribeRecordResponseType (net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType)24 Test (org.junit.Test)22 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)20 ArrayList (java.util.ArrayList)13 DescribeRecordRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.DescribeRecordRequest)12 QName (javax.xml.namespace.QName)10 DescribeRecordType (net.opengis.cat.csw.v_2_0_2.DescribeRecordType)8 StringWriter (java.io.StringWriter)2 JAXBContext (javax.xml.bind.JAXBContext)2 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 Marshaller (javax.xml.bind.Marshaller)2