use of net.opengis.cat.csw.v_2_0_2.SchemaComponentType in project ddf by codice.
the class TestCswEndpoint method testMarshallDescribeRecord.
/**
* Tests to see that JAXB configuration is working
*/
@Test
public void testMarshallDescribeRecord() {
DescribeRecordResponseType response = new DescribeRecordResponseType();
List<SchemaComponentType> schemas = new ArrayList<>();
SchemaComponentType schemaComponentType = new SchemaComponentType();
schemas.add(schemaComponentType);
response.setSchemaComponent(schemas);
JAXBContext context;
try {
context = JAXBContext.newInstance("net.opengis.cat.csw.v_2_0_2:net.opengis.filter.v_1_1_0:net.opengis.gml.v_3_1_1");
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
StringWriter sw = new StringWriter();
JAXBElement<DescribeRecordResponseType> wrappedResponse = new JAXBElement<>(cswQnameOutPutSchema, DescribeRecordResponseType.class, response);
marshaller.marshal(wrappedResponse, sw);
LOGGER.info("Response: {}", sw.toString());
} catch (JAXBException e) {
fail("Could not marshall message, Error: " + e.getMessage());
}
}
use of net.opengis.cat.csw.v_2_0_2.SchemaComponentType in project ddf by codice.
the class TestCswEndpoint 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);
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));
}
use of net.opengis.cat.csw.v_2_0_2.SchemaComponentType in project ddf by codice.
the class TestCswEndpoint 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));
}
use of net.opengis.cat.csw.v_2_0_2.SchemaComponentType in project ddf by codice.
the class TestCswEndpoint 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));
}
use of net.opengis.cat.csw.v_2_0_2.SchemaComponentType in project ddf by codice.
the class TestCswEndpoint method testDescribeRecordValidSchemaLanguage.
@Test
public void testDescribeRecordValidSchemaLanguage() {
DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
drr.setTypeName(VALID_PREFIX_LOCAL_TYPE);
drr.setSchemaLanguage(CswConstants.SCHEMA_LANGUAGE_X_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));
}
Aggregations