@Test public void testGML32Undeclared() { // GEOT-4756: no namespace support provided.. due to namespaces not set in // mapping file. This is legitimate if the mapping doesn't use any GML attributes. // Previously, this won't work. AppSchemaFeatureTypeRegistry registry = new AppSchemaFeatureTypeRegistry(); registry.addSchemas(schemaIndex); AttributeType type = registry.getAttributeType(BOREHOLE_TYPE); assertTrue(type instanceof FeatureType); } }
typeRegistry.disposeSchemaIndexes(); typeRegistry = null;
private AttributeDescriptor getTargetDescriptor(TypeMapping dto, CoordinateReferenceSystem crs) throws IOException { String prefixedTargetName = dto.getTargetElementName(); Name targetNodeName = Types.degloseName(prefixedTargetName, namespaces); AttributeDescriptor targetDescriptor = typeRegistry.getDescriptor(targetNodeName, crs); if (targetDescriptor == null) { throw new NoSuchElementException( "descriptor " + targetNodeName + " not found in parsed schema"); } // check if default geometry was set in FeatureTypeMapping // NOTE: if a default geometry is already set, it will be overridden String defaultGeomXPath = dto.getDefaultGeometryXPath(); if (defaultGeomXPath != null && !defaultGeomXPath.isEmpty()) { targetDescriptor = retypeAddingDefaultGeometry(targetDescriptor, defaultGeomXPath); } return targetDescriptor; }
typeRegistry = new AppSchemaFeatureTypeRegistry(namespaces); typeRegistry.addSchemas(schemaIndex);
@Test public void testSimpleAttributeFromComplexDeclaration() throws Exception { String res = "/test-data/complexFeature.xsd"; URL resource = getClass().getResource(res); SchemaIndex schemaIndex = EmfComplexFeatureReader.newInstance().parse(resource); AppSchemaFeatureTypeRegistry registry = new AppSchemaFeatureTypeRegistry(); try { registry.addSchemas(schemaIndex); Name tcl = Types.typeName(NS_URI, "TypedCategoryListType"); AttributeType typedCategoryListType = registry.getAttributeType(tcl); Assert.assertNotNull(typedCategoryListType); Assert.assertTrue(typedCategoryListType instanceof ComplexType); AttributeType superType = typedCategoryListType.getSuper(); Assert.assertNotNull(superType); Name superName = superType.getName(); Assert.assertEquals(XS.STRING.getNamespaceURI(), superName.getNamespaceURI()); Assert.assertEquals(XS.STRING.getLocalPart(), superName.getLocalPart()); Assert.assertNotNull(typedCategoryListType.getUserData().get(XSDTypeDefinition.class)); } finally { registry.disposeSchemaIndexes(); } }
expectedInstanceOf = typeRegistry.getAttributeType(expectedNodeTypeName, null, crs); if (expectedInstanceOf == null) { String msg =
AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); try { typeRegistry.addSchemas(schemaIndex); ComplexType mf = (ComplexType) typeRegistry.getAttributeType(typeName); assertNotNull(mf); assertTrue(mf instanceof FeatureType); mf = (ComplexType) typeRegistry.getAttributeType(typeName); assertNotNull(mf); assertTrue(mf instanceof FeatureType); } finally { typeRegistry.disposeSchemaIndexes();
/** * Tests if the schema-to-FM parsing code developed for complex data store configuration loading * can parse the GeoSciML types * * @throws Exception */ @Test public void testParseSchema() throws Exception { SchemaIndex schemaIndex = loadSchema("http://schemas.opengis.net/GeoSciML/Gsml.xsd"); AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); try { typeRegistry.addSchemas(schemaIndex); Name typeName = Types.typeName(GSMLNS, "GeologicUnitType"); ComplexType mf = (ComplexType) typeRegistry.getAttributeType(typeName); assertNotNull(mf); assertTrue(mf instanceof FeatureType); AttributeType superType = mf.getSuper(); assertNotNull(superType); Name superTypeName = Types.typeName(GSMLNS, "GeologicFeatureType"); assertEquals(superTypeName, superType.getName()); assertTrue(superType instanceof FeatureType); } finally { typeRegistry.disposeSchemaIndexes(); } }
@Test public void testGML32Declared() { AppSchemaFeatureTypeRegistry registry = new AppSchemaFeatureTypeRegistry(gml32NS); registry.addSchemas(schemaIndex); AttributeType type = registry.getAttributeType(BOREHOLE_TYPE); assertTrue(type instanceof FeatureType); }
AppSchemaFeatureTypeRegistry parsedTypes = new AppSchemaFeatureTypeRegistry(); parsedTypes.addSchemas(schemaIndex); AttributeType type = parsedTypes.getAttributeType(typeName); Assert.assertNotNull(type); Assert.assertTrue(type.getClass().getName(), type instanceof ComplexType); assertSimpleAttribute(descriptor, name, typeName, Integer.class, 1, 1); } finally { parsedTypes.disposeSchemaIndexes();
assertNotNull(restrictedElDecl); AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); typeRegistry.addSchemas(schemaIndex); (ComplexType) typeRegistry.getAttributeType(unrestrictedTypeName); assertNotNull(unrestrictedType); assertTrue(Types.canHaveTextContent(unrestrictedType)); (ComplexType) typeRegistry.getAttributeType(restrictedTypeName); assertNotNull(restrictedType); assertFalse(Types.canHaveTextContent(restrictedType));
AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); try { typeRegistry.addSchemas(schemaIndex); (ComplexFeatureTypeImpl) typeRegistry.getAttributeType(typeName); assertNotNull(borehole); assertTrue(borehole instanceof FeatureType); (AttributeType) typeRegistry.getAttributeType(tcl); assertNotNull(typedCategoryListType); assertTrue(typedCategoryListType instanceof ComplexType); } finally { typeRegistry.disposeSchemaIndexes();
SchemaIndex schemaIndex = loadSchema("http://schemas.opengis.net/GeoSciML/Gsml.xsd"); AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); typeRegistry.addSchemas(schemaIndex); ComplexType mf = (ComplexType) typeRegistry.getAttributeType(typeName); assertNotNull(mf); assertTrue(mf instanceof FeatureType); assertNull(o); } finally { typeRegistry.disposeSchemaIndexes();
final AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); try { typeRegistry.addSchemas(schemaIndex); final ComplexType testType = (ComplexType) typeRegistry.getAttributeType(typeName); typeRegistry.disposeSchemaIndexes();
SchemaIndex schemaIndex = EmfComplexFeatureReader.newInstance().parse(resource); AppSchemaFeatureTypeRegistry typeRegistry = new AppSchemaFeatureTypeRegistry(); try { typeRegistry.addSchemas(schemaIndex); AttributeType type = (AttributeType) typeRegistry.getAttributeType(typeName); Assert.assertTrue(type instanceof FeatureType); Assert.assertFalse(type instanceof SimpleFeatureType); AttributeDescriptor wqPlusDescriptor = typeRegistry.getDescriptor(name, null); Assert.assertNotNull(wqPlusDescriptor); Assert.assertEquals(name, wqPlusDescriptor.getName()); type = typeRegistry.getAttributeType(typeName); Assert.assertTrue(type instanceof ComplexType); Assert.assertFalse(type instanceof FeatureType); assertSimpleAttribute(descriptor, name, typeName, String.class, 1, Integer.MAX_VALUE); } finally { typeRegistry.disposeSchemaIndexes();