01: package org.geotools.data.jdbc;
02:
03: import java.sql.Types;
04:
05: import junit.framework.TestCase;
06:
07: import org.geotools.feature.FeatureType;
08: import org.geotools.feature.simple.SimpleTypeFactoryImpl;
09:
10: /**
11: * Test case for {@link JDBCTypeBuilder}.
12: *
13: * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
14: *
15: */
16: public class JDBCTypeBuilderTest extends TestCase {
17:
18: JDBCTypeBuilder typeBuilder;
19:
20: protected void setUp() throws Exception {
21: typeBuilder = new JDBCTypeBuilder(new SimpleTypeFactoryImpl());
22: }
23:
24: public void test() {
25: typeBuilder.setName("testType");
26: typeBuilder.setNamespaceURI("http://geotools.org/test");
27: typeBuilder.attribute("int", Types.INTEGER);
28: typeBuilder.attribute("double", Types.DOUBLE);
29: typeBuilder.attribute("string", Types.VARCHAR);
30:
31: FeatureType featureType = typeBuilder.feature();
32: assertNotNull(featureType);
33: assertNotNull(featureType.getAttributeType("int"));
34: assertEquals(Integer.class, featureType.getAttributeType("int")
35: .getType());
36: assertNotNull(featureType.getAttributeType("double"));
37: assertEquals(Double.class, featureType.getAttributeType(
38: "double").getType());
39: assertNotNull(featureType.getAttributeType("string"));
40: assertEquals(String.class, featureType.getAttributeType(
41: "string").getType());
42: }
43:
44: }
|