/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotools.jdbc; import org.geotools.referencing.CRS; import org.opengis.feature.simple.SimpleFeatureType; /** * Tests data reading when we expose primary keys as attributes * @author Andrea Aime * * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/library/jdbc/src/test/java/org/geotools/jdbc/JDBCFeatureSourceExposePkTest.java $ */ public abstract class JDBCFeatureSourceExposePkTest extends JDBCFeatureSourceTest { @Override protected void connect() throws Exception { super.connect(); ((JDBCFeatureStore) featureSource).setExposePrimaryKeyColumns(true); } public void testSchema() throws Exception { SimpleFeatureType schema = featureSource.getSchema(); assertEquals(tname("ft1"), schema.getTypeName()); assertEquals(dataStore.getNamespaceURI(), schema.getName().getNamespaceURI()); assertTrue(areCRSEqual(CRS.decode("EPSG:4326"), schema.getCoordinateReferenceSystem())); assertEquals(5, schema.getAttributeCount()); assertNotNull(schema.getDescriptor(aname("id"))); assertNotNull(schema.getDescriptor(aname("geometry"))); assertNotNull(schema.getDescriptor(aname("intProperty"))); assertNotNull(schema.getDescriptor(aname("stringProperty"))); assertNotNull(schema.getDescriptor(aname("doubleProperty"))); } }