Search in sources :

Example 16 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testFeatureMetacardTypeStringNonQueryProperty.

@Test
public void testFeatureMetacardTypeStringNonQueryProperty() {
    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);
    List<String> nonQueryProps = new ArrayList<String>();
    nonQueryProps.add(ELEMENT_NAME_1);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, nonQueryProps, Wfs20Constants.GML_3_2_NAMESPACE);
    assertTrue(featureMetacardType.getTextualProperties().size() == 2);
    AttributeDescriptor attrDesc = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_1));
    assertNotNull(attrDesc);
    assertFalse(attrDesc.isIndexed());
    AttributeDescriptor attrDesc2 = featureMetacardType.getAttributeDescriptor(prefix(ELEMENT_NAME_2));
    assertNotNull(attrDesc2);
    assertTrue(attrDesc2.isIndexed());
}
Also used : XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) FeatureMetacardType(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType) Test(org.junit.Test)

Example 17 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindLongProperties.

@Test
public void testfeatureMetacardTypeFindLongProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement longElement = new XmlSchemaElement(schema, true);
    longElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    longElement.setSchemaTypeName(Constants.XSD_LONG);
    longElement.setName(ELEMENT_NAME_1);
    schema.getElements().put(new QName(ELEMENT_NAME_1), longElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.LONG_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 18 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema 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(Wfs10Constants.GML_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement gmlElement2 = new XmlSchemaElement(schema, true);
    gmlElement2.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement2.setSchemaTypeName(new QName(Wfs10Constants.GML_NAMESPACE, GML));
    gmlElement2.setName(ELEMENT_NAME_2);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_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)

Example 19 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema in project ddf by codice.

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindBooleanProperties.

@Test
public void testfeatureMetacardTypeFindBooleanProperties() {
    XmlSchema schema = new XmlSchema();
    XmlSchemaElement booleanElement = new XmlSchemaElement(schema, true);
    booleanElement.setSchemaType(new XmlSchemaSimpleType(schema, false));
    booleanElement.setSchemaTypeName(Constants.XSD_BOOLEAN);
    booleanElement.setName(ELEMENT_NAME_1);
    schema.getElements().put(new QName(ELEMENT_NAME_1), booleanElement);
    FeatureMetacardType featureMetacardType = new FeatureMetacardType(schema, FEATURE_TYPE, NON_QUERYABLE_PROPS, Wfs10Constants.GML_NAMESPACE);
    assertAttributeDescriptor(featureMetacardType, ELEMENT_NAME_1, BasicTypes.BOOLEAN_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 20 with XmlSchema

use of org.apache.ws.commons.schema.XmlSchema 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(Wfs10Constants.GML_NAMESPACE, GML));
    gmlElement.setName(ELEMENT_NAME_1);
    XmlSchemaElement gmlElement2 = new XmlSchemaElement(schema, true);
    gmlElement2.setSchemaType(new XmlSchemaComplexType(schema, false));
    gmlElement2.setSchemaTypeName(new QName(Wfs10Constants.GML_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, Wfs10Constants.GML_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)

Aggregations

XmlSchema (org.apache.ws.commons.schema.XmlSchema)51 QName (javax.xml.namespace.QName)37 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)37 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)35 Test (org.junit.Test)35 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)28 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)11 ArrayList (java.util.ArrayList)10 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)6 Iterator (java.util.Iterator)6 List (java.util.List)5 XmlSchemaCollection (org.apache.ws.commons.schema.XmlSchemaCollection)5 Map (java.util.Map)4 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)4 HashMap (java.util.HashMap)3 XmlSchemaComplexContent (org.apache.ws.commons.schema.XmlSchemaComplexContent)3 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)3 XmlSchemaObjectTable (org.apache.ws.commons.schema.XmlSchemaObjectTable)3 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)3 WfsException (org.codice.ddf.spatial.ogc.wfs.catalog.common.WfsException)3