*/
@Test
public void testWithConfig() throws Exception {
final String nsUri = "http://online.socialchange.net.au";
final String localName = "RoadSegment";
final Name typeName = new NameImpl(nsUri, localName);
final URL configUrl = getClass().getResource("/test-data/roadsegments.xml");
AppSchemaDataAccessDTO config = new XMLConfigDigester().parse(configUrl);
Set/* <FeatureTypeMapping> */mappings = AppSchemaDataAccessConfigurator
.buildMappings(config);
dataStore = new AppSchemaDataAccess(mappings);
FeatureSource<FeatureType, Feature> source = dataStore.getFeatureSource(typeName);
FeatureType type = source.getSchema();
AttributeDescriptor node;
node = (AttributeDescriptor) Types.descriptor(type, Types.typeName(nsUri, "the_geom"));
assertNotNull(node);
assertEquals("LineStringPropertyType", node.getType().getName().getLocalPart());
assertNotNull(Types.descriptor(type, Types.typeName(nsUri, "name")));
Name ftNodeName = Types.typeName(nsUri, "fromToNodes");
assertNotNull(Types.descriptor(type, ftNodeName));
AttributeDescriptor descriptor = (AttributeDescriptor) Types.descriptor(type, ftNodeName);
ComplexType fromToNodes = (ComplexType) descriptor.getType();
assertFalse(descriptor.isNillable());
assertTrue(fromToNodes.isIdentified());
Name fromNodeName = Types.typeName(nsUri, "fromNode");
AttributeDescriptor fromNode = (AttributeDescriptor) Types.descriptor(fromToNodes,
fromNodeName);
assertNotNull(fromNode);
Name toNodeName = Types.typeName(nsUri, "toNode");
AttributeDescriptor toNode = (AttributeDescriptor) Types
.descriptor(fromToNodes, toNodeName);
assertNotNull(fromNode);
assertEquals(Point.class, fromNode.getType().getBinding());
assertEquals(Point.class, toNode.getType().getBinding());
// test to see if the mapping can successfully substitute a valid narrower type
Name subName = Types.typeName(nsUri, "broadTypeEl");
descriptor = (AttributeDescriptor) Types.descriptor(type, subName);
ComplexType subbedType = (ComplexType) descriptor.getType();