Source Code Cross Referenced for SimpleTypeBuilderTest.java in  » GIS » GeoTools-2.4.1 » org » geotools » feature » iso » simple » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.feature.iso.simple 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.geotools.feature.iso.simple;
002:
003:        import java.util.List;
004:
005:        import junit.framework.TestCase;
006:
007:        import org.geotools.referencing.crs.DefaultGeographicCRS;
008:        import org.geotools.util.GTContainer;
009:        import org.opengis.feature.simple.SimpleFeatureCollectionType;
010:        import org.opengis.feature.simple.SimpleFeatureType;
011:        import org.picocontainer.defaults.DefaultPicoContainer;
012:
013:        import com.vividsolutions.jts.geom.LineString;
014:
015:        /**
016:         * This test cases will check that the typeBuilder works as advertised.
017:         * <p>
018:         * This test uses the container set up for simple types implementation. If you
019:         * wish to subclass this you may reuse the test methods with alternate
020:         * implementations.
021:         * </p>
022:         * 
023:         * @author Jody
024:         */
025:        public class SimpleTypeBuilderTest extends TestCase {
026:
027:            /* do you remember gopher? */
028:            static final String URI = "gopher://localhost/test/";
029:
030:            DefaultPicoContainer gt;
031:
032:            private SimpleTypeBuilder builder;
033:
034:            protected void setUp() throws Exception {
035:                super .setUp();
036:                gt = GTContainer.simple();
037:                builder = (SimpleTypeBuilder) gt
038:                        .getComponentInstance(SimpleTypeBuilder.class);
039:            }
040:
041:            /**
042:             * Defines a simple setup of Address, Fullname, Person and then defines a
043:             * collection of Person as a Country.
044:             * 
045:             * <pre><code>
046:             *      +-------------------+
047:             *      | ROAD (Feature)    |
048:             *      +-------------------+
049:             *      |name: Text         |
050:             *      |route: Route       |
051:             *      +-------------------+
052:             *               *|
053:             *                |members
054:             *                |
055:             *      +--------------------------+
056:             *      | ROADS(FeatureCollection) |
057:             *      +--------------------------+
058:             * </code></pre>
059:             * 
060:             * <p>
061:             * Things to note in this example:
062:             * <ul>
063:             * <li>Definition of "atomic" types like Text and Number that bind directly
064:             * to Java classes
065:             * <li>Definition of "geometry" types like Route that bind to a geometry
066:             * implementation
067:             * <li>Definition of a "simple feature" made of atomic and geometry types
068:             * without support for descriptors or associations
069:             * <li>Definition of a "simple feature collection" able to hold a
070:             * collection of simple feature, but unable to hold attributes itself.
071:             * </ul>
072:             */
073:            public void testBuilding() throws Exception {
074:                builder.load(new SimpleSchema()); // load java types
075:                builder.setNamespaceURI(URI);
076:                builder.setCRS(DefaultGeographicCRS.WGS84);
077:
078:                builder.setName("ROAD");
079:                builder.addAttribute("name", String.class);
080:                builder.addGeometry("route", LineString.class);
081:                SimpleFeatureType ROAD = builder.feature();
082:
083:                assertEquals(2, ROAD.getAttributeCount());
084:                assertEquals(LineString.class, ROAD.getDefaultGeometryType()
085:                        .getBinding());
086:                assertTrue(List.class.isInstance(ROAD.attributes()));
087:
088:                builder.setName("ROADS");
089:                builder.setMember(ROAD);
090:
091:                SimpleFeatureCollectionType ROADS = builder.collection();
092:                assertEquals(0, ROADS.attributes().size());
093:                assertEquals(ROAD, ROADS.getMemberType());
094:            }
095:
096:            public void testTerse() throws Exception {
097:                builder.load(new SimpleSchema()); // load java types
098:                builder.setNamespaceURI(URI);
099:                builder.setCRS(DefaultGeographicCRS.WGS84);
100:
101:                SimpleFeatureType ROAD = builder.name("ROAD").attribute("name",
102:                        String.class).geometry("route", LineString.class)
103:                        .feature();
104:
105:                assertEquals(2, ROAD.getAttributeCount());
106:                assertEquals(LineString.class, ROAD.getDefaultGeometryType()
107:                        .getBinding());
108:                assertTrue(List.class.isInstance(ROAD.attributes()));
109:                assertEquals(DefaultGeographicCRS.WGS84, ROAD.getCRS());
110:
111:                SimpleFeatureCollectionType ROADS = builder.name("ROADS")
112:                        .member(ROAD).collection();
113:
114:                assertEquals(0, ROADS.attributes().size());
115:                assertEquals(ROAD, ROADS.getMemberType());
116:                assertEquals(DefaultGeographicCRS.WGS84, ROADS.getCRS());
117:            }
118:
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.