@Test
public void testBuildGml2() throws Exception {
FeatureTypeSchemaBuilder builder = new FeatureTypeSchemaBuilder.GML2(getGeoServer());
FeatureTypeInfo lines = getFeatureTypeInfo(SystemTestData.LINES);
XSDSchema schema = builder.build(new FeatureTypeInfo[] {lines}, null);
assertNotNull(schema);
XSDElementDeclaration element = Schemas.getElementDeclaration(schema, SystemTestData.LINES);
assertNotNull(element);
assertTrue(element.getType() instanceof XSDComplexTypeDefinition);
XSDElementDeclaration id =
Schemas.getChildElementDeclaration(
element, new QName(SystemTestData.CGF_URI, "id"));
assertNotNull(id);
XSDElementDeclaration lineStringProperty =
Schemas.getChildElementDeclaration(
element, new QName(SystemTestData.CGF_URI, "lineStringProperty"));
assertNotNull(lineStringProperty);
XSDTypeDefinition lineStringPropertyType = lineStringProperty.getType();
assertEquals(GML.NAMESPACE, lineStringPropertyType.getTargetNamespace());
assertEquals(GML.LINESTRINGPROPERTYTYPE.getLocalPart(), lineStringPropertyType.getName());
XSDTypeDefinition geometryAssociationType = lineStringPropertyType.getBaseType();
assertNotNull(geometryAssociationType);
assertEquals(GML.NAMESPACE, geometryAssociationType.getTargetNamespace());
assertEquals(GML.GEOMETRYASSOCIATIONTYPE.getLocalPart(), geometryAssociationType.getName());
}