use of net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType in project ddf by codice.
the class CswEndpoint method buildDescribeRecordResponseFromTypes.
private DescribeRecordResponseType buildDescribeRecordResponseFromTypes(List<QName> types, String version) throws CswException {
validator.validateFullyQualifiedTypes(types);
DescribeRecordResponseType response = new DescribeRecordResponseType();
List<SchemaComponentType> schemas = new ArrayList<>();
if (types.isEmpty()) {
schemas.add(getSchemaComponentType(CswConstants.CSW_OUTPUT_SCHEMA));
schemas.add(getSchemaComponentType(GmdConstants.GMD_NAMESPACE));
} else {
if (types.contains(new QName(CswConstants.CSW_OUTPUT_SCHEMA, CswConstants.CSW_RECORD_LOCAL_NAME))) {
schemas.add(getSchemaComponentType(CswConstants.CSW_OUTPUT_SCHEMA));
}
if (types.contains(new QName(GmdConstants.GMD_NAMESPACE, GmdConstants.GMD_LOCAL_NAME))) {
schemas.add(getSchemaComponentType(GmdConstants.GMD_NAMESPACE));
}
if (types.contains(new QName(CswConstants.EBRIM_SCHEMA, CswConstants.EBRIM_RECORD_LOCAL_NAME))) {
schemas.add(getSchemaComponentType(CswConstants.EBRIM_SCHEMA));
}
}
response.setSchemaComponent(schemas);
return response;
}
use of net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType in project ddf by codice.
the class TestCswEndpoint method testPostDescribeRecordRequestMultipleTypes.
@Test
public void testPostDescribeRecordRequestMultipleTypes() {
DescribeRecordType drt = createDefaultDescribeRecordType();
List<QName> typeNames = new ArrayList<>();
typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, VALID_TYPE, VALID_PREFIX));
typeNames.add(new QName(CswConstants.CSW_OUTPUT_SCHEMA, "test", VALID_PREFIX));
drt.setTypeName(typeNames);
DescribeRecordResponseType drrt = null;
try {
drrt = csw.describeRecord(drt);
} catch (CswException e) {
fail("CswException caught during describeRecord GET 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.DescribeRecordResponseType in project ddf by codice.
the class TestCswEndpoint 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));
}
use of net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType in project ddf by codice.
the class TestCswEndpoint method testDescribeRecordRequestNoTypesPassed.
@Test
public void testDescribeRecordRequestNoTypesPassed() {
DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
LOGGER.info("Resource directory is {}", this.getClass().getResource(".").getPath());
DescribeRecordResponseType drrt = null;
try {
drrt = csw.describeRecord(drr);
} catch (CswException e) {
fail("CswException caught during describeRecord GET request: " + e.getMessage());
}
assertThat(drrt, notNullValue());
assertThat(drrt.getSchemaComponent(), notNullValue());
// Assert that it returned all record types.
assertThat(drrt.getSchemaComponent().size(), is(2));
LOGGER.info("got response \n{}\n", drrt.toString());
}
use of net.opengis.cat.csw.v_2_0_2.DescribeRecordResponseType in project ddf by codice.
the class TestCswEndpoint 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));
}
Aggregations