use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindDoubleProperties.
@Test
public void testfeatureMetacardTypeFindDoubleProperties() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement doubleElement = new XmlSchemaElement(schema, true);
doubleElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
doubleElement.setSchemaTypeName(Constants.XSD_DOUBLE);
doubleElement.setName(ELEMENT_NAME_1);
schema.getElements().put(new QName(ELEMENT_NAME_1), doubleElement);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.DOUBLE_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindIntegerProperties.
@Test
public void testfeatureMetacardTypeFindIntegerProperties() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement integerElement = new XmlSchemaElement(schema, true);
integerElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
integerElement.setSchemaTypeName(Constants.XSD_INTEGER);
integerElement.setName(ELEMENT_NAME_1);
XmlSchemaElement intElement = new XmlSchemaElement(schema, true);
intElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
intElement.setSchemaTypeName(Constants.XSD_INT);
intElement.setName(ELEMENT_NAME_2);
XmlSchemaElement positivieIntegerElement = new XmlSchemaElement(schema, true);
positivieIntegerElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
positivieIntegerElement.setSchemaTypeName(Constants.XSD_POSITIVEINTEGER);
positivieIntegerElement.setName(ELEMENT_NAME_3);
schema.getElements().put(new QName(ELEMENT_NAME_1), integerElement);
schema.getElements().put(new QName(ELEMENT_NAME_2), intElement);
schema.getElements().put(new QName(ELEMENT_NAME_3), positivieIntegerElement);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.STRING_TYPE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.INTEGER_TYPE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_3, BasicTypes.STRING_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testFeatureMetacardTypeStringAndGmlProperties.
@Test
public void testFeatureMetacardTypeStringAndGmlProperties() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
stringElement.setSchemaTypeName(Constants.XSD_STRING);
stringElement.setName(ELEMENT_NAME_1);
XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
gmlElement.setSchemaTypeName(new QName(Wfs10Constants.GML_NAMESPACE, GML));
gmlElement.setName(ELEMENT_NAME_2);
schema.getElements().put(new QName(ELEMENT_NAME_1), stringElement);
schema.getElements().put(new QName(ELEMENT_NAME_2), gmlElement);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertTrue(featureMetacardType.getTextualProperties().size() == 1);
assertTrue(featureMetacardType.getGmlProperties().size() == 1);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.STRING_TYPE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.GEO_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testFeatureMetacardTypeMultipleStringProperties.
@Test
public void testFeatureMetacardTypeMultipleStringProperties() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
stringElement.setSchemaTypeName(Constants.XSD_STRING);
stringElement.setName(ELEMENT_NAME_1);
XmlSchemaElement stringElement2 = new XmlSchemaElement(schema, true);
stringElement2.setSchemaType(new XmlSchemaSimpleType(schema, false));
stringElement2.setSchemaTypeName(Constants.XSD_STRING);
stringElement2.setName(ELEMENT_NAME_2);
schema.getElements().put(new QName(ELEMENT_NAME_1), stringElement);
schema.getElements().put(new QName(ELEMENT_NAME_2), stringElement2);
FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
assertTrue(featureMetacardType.getTextualProperties().size() == 2);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.STRING_TYPE);
assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.STRING_TYPE);
}
use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.
the class FeatureMetacardTypeTest method testFeatureMetacardTypeFindTaxonomyMetacardAttributes.
@Test
public void testFeatureMetacardTypeFindTaxonomyMetacardAttributes() {
XmlSchema schema = new XmlSchema();
XmlSchemaElement element = new XmlSchemaElement(schema, true);
element.setSchemaType(new XmlSchemaSimpleType(schema, false));
element.setSchemaTypeName(Constants.XSD_STRING);
element.setName(ELEMENT_NAME);
schema.getElements().put(new QName(ELEMENT_NAME), element);
FeatureMetacardType fmt = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
Set<AttributeDescriptor> descriptors = initDescriptors();
for (AttributeDescriptor ad : descriptors) {
assertBasicAttributeDescriptor(fmt, ad.getName(), ad.getType());
assertFalse(fmt.getAttributeDescriptor(ad.getName()).isStored());
}
// +1 to account for one element added to schema.
assertThat(fmt.getAttributeDescriptors().size(), is(descriptors.size() + 1));
}
Aggregations