use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswException 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 org.codice.ddf.spatial.ogc.csw.catalog.common.CswException in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesRequestServiceIdentification.
@Test
public void testCapabilitiesRequestServiceIdentification() {
// Should only return the ServiceIdentification section
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
gcr.setSections(CswEndpoint.SERVICE_IDENTIFICATION);
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), nullValue());
verifyFilterCapabilities(ct);
assertThat(ct.getServiceProvider(), nullValue());
verifyServiceIdentification(ct);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswException 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));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswException in project ddf by codice.
the class TestCswEndpoint method testDescribeRecordMultipleTypesMultipleNamespacesMultiplePrefixesMismatchedPrefix.
@Test
public void testDescribeRecordMultipleTypesMultipleNamespacesMultiplePrefixesMismatchedPrefix() {
DescribeRecordRequest drr = createDefaultDescribeRecordRequest();
drr.setTypeName(VALID_PREFIX_LOCAL_TYPE + ",csw3:test4");
drr.setNamespace("xmlns(" + VALID_PREFIX + "=" + CswConstants.CSW_OUTPUT_SCHEMA + ")" + "," + "xmlns(" + "csw2" + "=" + CswConstants.CSW_OUTPUT_SCHEMA + "2" + ")");
try {
csw.describeRecord(drr);
fail("Should have thrown an exception indicating an invalid type.");
} catch (CswException e) {
LOGGER.info("Correctly got exception " + e.getMessage());
return;
}
fail("Should have gotten exception.");
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswException in project ddf by codice.
the class TestCswEndpoint method testGetCapabilitiesTypeFederatedCatalogs.
@Test
public void testGetCapabilitiesTypeFederatedCatalogs() {
GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gct);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), notNullValue());
for (Operation operation : ct.getOperationsMetadata().getOperation()) {
if (StringUtils.equals(operation.getName(), CswConstants.GET_RECORDS)) {
for (DomainType constraint : operation.getConstraint()) {
if (StringUtils.equals(constraint.getName(), CswConstants.FEDERATED_CATALOGS)) {
assertThat(constraint.getValue().size(), is(3));
return;
}
}
}
}
fail("Didn't find [" + CswConstants.FEDERATED_CATALOGS + "] in request [" + CswConstants.GET_RECORDS + "]");
}
Aggregations