Search in sources :

Example 36 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType 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(Wfs10Constants.GML_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, Wfs10Constants.GML_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 37 with XmlSchemaSimpleType

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

the class FeatureMetacardTypeTest method testfeatureMetacardTypeFindShortProperties.

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

use of org.apache.ws.commons.schema.XmlSchemaSimpleType 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, Wfs10Constants.GML_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 39 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType 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);
}
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 40 with XmlSchemaSimpleType

use of org.apache.ws.commons.schema.XmlSchemaSimpleType 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);
}
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)

Aggregations

XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)60 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)44 QName (javax.xml.namespace.QName)38 XmlSchema (org.apache.ws.commons.schema.XmlSchema)31 Test (org.junit.Test)27 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)26 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)20 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)13 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)9 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)9 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)8 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)8 XmlSchemaSimpleTypeRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction)8 ArrayList (java.util.ArrayList)6 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)6 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)6 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)4 Iterator (java.util.Iterator)4 List (java.util.List)4 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)4