} catch (Exception e) {
e.printStackTrace();
throw e;
}
final AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry();
try {
typeRegistry.addSchemas(schemaIndex);
final Name typeName = Types.typeName(AWNS, "SiteSinglePhenomTimeSeriesType");
final ComplexType testType = (ComplexType) typeRegistry.getAttributeType(typeName);
assertNotNull(testType);
assertTrue(testType instanceof FeatureType);
AttributeType superType = testType.getSuper();
assertNotNull(superType);
Name superTypeName = Types.typeName(AWNS, "SamplingSitePurposeType");
assertEquals(superTypeName, superType.getName());
// assertTrue(superType instanceof FeatureType);
// ensure all needed types were parsed and aren't just empty proxies
Map samplingProperties = new HashMap();
// from gml:AbstractFeatureType
samplingProperties.put(name(GMLNS, "metaDataProperty"), typeName(GMLNS,
"MetaDataPropertyType"));
samplingProperties.put(name(GMLNS, "description"), typeName(GMLNS, "StringOrRefType"));
samplingProperties.put(name(GMLNS, "name"), typeName(GMLNS, "CodeType"));
samplingProperties.put(name(GMLNS, "boundedBy"), typeName(GMLNS, "BoundingShapeType"));
samplingProperties.put(name(GMLNS, "location"), typeName(GMLNS, "LocationPropertyType"));
// aw:SamplingSiteType
samplingProperties.put(name(AWNS, "samplingRegimeType"), Types.toTypeName(GML.CodeType));
samplingProperties.put(name(AWNS, "waterBodyType"), Types.toTypeName(GML.CodeType));
samplingProperties.put(name(AWNS, "accessTypeCode"), Types.toTypeName(GML.CodeType));
// sa:SamplingPointType
samplingProperties.put(name(SANS, "position"), typeName(GMLNS, "PointPropertyType"));
// sa:SamplingFeatureType
samplingProperties.put(name(SANS, "relatedObservation"), typeName(OMNS,
"ObservationPropertyType"));
samplingProperties.put(name(SANS, "relatedSamplingFeature"), typeName(SANS,
"SamplingFeatureRelationPropertyType"));
samplingProperties
.put(name(SANS, "sampledFeature"), typeName(GMLNS, "FeaturePropertyType"));
samplingProperties.put(name(SANS, "surveyDetails"), typeName(SANS,
"SurveyProcedurePropertyType"));
// sa:SiteSinglePhenomTimeSeriesType
samplingProperties.put(name(AWNS, "relatedObservation"), typeName(AWNS,
"PhenomenonTimeSeriesPropertyType"));
assertPropertyNamesAndTypeNames(testType, samplingProperties);
AttributeDescriptor relatedObservation = (AttributeDescriptor) Types.descriptor(testType,
name(AWNS, "relatedObservation"));
Map relatedObsProps = new HashMap();
relatedObsProps.put(name(AWNS, "PhenomenonTimeSeries"), typeName(AWNS,
"PhenomenonTimeSeriesType"));
ComplexType phenomenonTimeSeriesPropertyType = (ComplexType) relatedObservation.getType();
assertPropertyNamesAndTypeNames(phenomenonTimeSeriesPropertyType, relatedObsProps);
AttributeDescriptor phenomenonTimeSeries = (AttributeDescriptor) Types.descriptor(
phenomenonTimeSeriesPropertyType, name(AWNS, "PhenomenonTimeSeries"));
ComplexType phenomenonTimeSeriesType = (ComplexType) phenomenonTimeSeries.getType();
Map phenomenonTimeSeriesProps = new HashMap();
// from
// aw:WaterObservationType/om:TimeSeriesObsType/om:AbstractObservationType
// phenomenonTimeSeriesProps.put(name(OMNS, "procedure"), typeName(OMNS,
// "ObservationProcedurePropertyType"));
// phenomenonTimeSeriesProps.put(name(OMNS, "countParameter"),
// typeName(SWENS,
// "TypedCountType"));
// phenomenonTimeSeriesProps.put(name(OMNS, "measureParameter"),
// typeName(SWENS,
// "TypedMeasureType"));
// phenomenonTimeSeriesProps.put(name(OMNS, "termParameter"),
// typeName(SWENS,
// "TypedCategoryType"));
// phenomenonTimeSeriesProps.put(name(OMNS, "observedProperty"),
// typeName(SWENS,
// "PhenomenonPropertyType"));
//
// from PhenomenonTimeSeriesType
phenomenonTimeSeriesProps.put(name(AWNS, "result"), typeName(CVNS,
"CompactDiscreteTimeCoveragePropertyType"));
assertPropertyNamesAndTypeNames(phenomenonTimeSeriesType, phenomenonTimeSeriesProps);
AttributeDescriptor observedProperty = (AttributeDescriptor) Types.descriptor(
phenomenonTimeSeriesType, name(OMNS, "observedProperty"));
ComplexType phenomenonPropertyType = (ComplexType) observedProperty.getType();
assertPropertyNamesAndTypeNames(phenomenonPropertyType, Collections.singletonMap(name(
SWENS, "Phenomenon"), typeName(SWENS, "PhenomenonType")));
AttributeDescriptor phenomenon = (AttributeDescriptor) Types.descriptor(
phenomenonPropertyType, name(SWENS, "Phenomenon"));
ComplexType phenomenonType = (ComplexType) phenomenon.getType();
assertNotNull(phenomenonType.getSuper());
assertEquals(typeName(GMLNS, "DefinitionType"), phenomenonType.getSuper().getName());
Map phenomenonProps = new HashMap();
// from gml:DefinitionType
phenomenonProps.put(name(GMLNS, "metaDataProperty"), null);
phenomenonProps.put(name(GMLNS, "description"), null);
phenomenonProps.put(name(GMLNS, "name"), null);
assertPropertyNamesAndTypeNames(phenomenonType, phenomenonProps);
}
finally {
typeRegistry.disposeSchemaIndexes();
}
}