Search in sources :

Example 11 with FeatureMetacardType

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(Wfs20Constants.GML_3_2_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, Wfs20Constants.GML_3_2_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);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 12 with FeatureMetacardType

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, Wfs20Constants.GML_3_2_NAMESPACE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.DOUBLE_TYPE);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) QName(javax.xml.namespace.QName) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 13 with FeatureMetacardType

use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.

the class FeatureMetacardTypeTest method testFeatureMetacardTypeComplexContentWithStringAndGmlProperties.

@Test
public void testFeatureMetacardTypeComplexContentWithStringAndGmlProperties() {
    XmlSchema schema = new XmlSchema();
    // Create the GML and String types
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement stringElement = new XmlSchemaElement(schema, true);
    stringElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    stringElement.setSchemaTypeName(Constants.XSD_STRING);
    stringElement.setName(ELEMENT_NAME_2);
    // build the complex objects
    XmlSchemaElement complexElement = new XmlSchemaElement(schema, true);
    XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, false);
    XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();
    XmlSchemaComplexContentExtension contentExtension = new XmlSchemaComplexContentExtension();
    XmlSchemaSequence particle = new XmlSchemaSequence();
    particle.getItems().add(stringElement);
    contentExtension.setParticle(particle);
    complexContent.setContent(contentExtension);
    complexType.setContentModel(complexContent);
    complexElement.setSchemaType(complexType);
    complexElement.setSchemaTypeName(new QName("Complex"));
    schema.getElements().put(new QName(ELEMENT_NAME_2), complexElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getTextualProperties().size() == 1);
    assertTrue(featureMetacardType.getGmlProperties().size() == 1);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.STRING_TYPE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.GEO_TYPE);
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaComplexContent(org.apache.ws.commons.schema.XmlSchemaComplexContent) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 14 with FeatureMetacardType

use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.

the class FeatureMetacardTypeTest method testFeatureMetacardTypeNonQueryGmlProperty.

@Test
public void testFeatureMetacardTypeNonQueryGmlProperty() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement gmlElement2 = new XmlSchemaElement(schema, true);
    gmlElement2.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement2.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement2.setName(ELEMENT_NAME_2);
    List<String> nonQueryProps = new ArrayList<String>();
    nonQueryProps.add(ELEMENT_NAME_2);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, nonQueryProps, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getGmlProperties().size() == 2);
    AttributeDescriptor attrDesc = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_1));
    assertNotNull(attrDesc);
    assertTrue(attrDesc.getType() == BasicTypes.GEO_TYPE);
    assertTrue(attrDesc.isIndexed());
    AttributeDescriptor attrDesc2 = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_2));
    assertNotNull(attrDesc2);
    assertTrue(attrDesc2.getType() == BasicTypes.GEO_TYPE);
    assertFalse(attrDesc2.isIndexed());
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 15 with FeatureMetacardType

use of org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType in project ddf by codice.

the class FeatureMetacardTypeTest method testfeatureMetacardTypeMultipleGmlProperties.

@Test
public void testfeatureMetacardTypeMultipleGmlProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement gmlElement = new XmlSchemaElement(schema, true);
    gmlElement.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement gmlElement2 = new XmlSchemaElement(schema, true);
    gmlElement2.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement2.setSchemaTypeName(new QName(Wfs20Constants.GML_3_2_NAMESPACE, GML));
    gmlElement2.setName(ELEMENT_NAME_2);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getGmlProperties().size() == 2);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_2, BasicTypes.GEO_TYPE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.GEO_TYPE);
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Aggregations

FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)40 XmlSchema (org.apache.ws.commons.schema.XmlSchema)37 QName (javax.xml.namespace.QName)34 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)32 Test (org.junit.Test)32 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)26 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)10 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)7 ArrayList (java.util.ArrayList)6 MetacardType (ddf.catalog.data.MetacardType)2 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 XmlSchemaComplexContent (org.apache.ws.commons.schema.XmlSchemaComplexContent)2 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)2 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)2 WfsException (org.codice.ddf.spatial.ogc.wfs.catalog.common.WfsException)2 ServiceRegistration (org.osgi.framework.ServiceRegistration)2 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)1 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1