Source Code Cross Referenced for UnnamedExtensionTest.java in  » GIS » GeoTools-2.4.1 » org » geotools » referencing » factory » epsg » 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.referencing.factory.epsg 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2007, GeoTools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.referencing.factory.epsg;
017:
018:        // Java dependencies
019:        import java.util.Set;
020:        import java.util.Collection;
021:        import java.io.PrintWriter;
022:        import java.io.StringWriter;
023:
024:        // OpenGIS dependencies
025:        import org.opengis.metadata.citation.Citation;
026:        import org.opengis.referencing.FactoryException;
027:        import org.opengis.referencing.crs.ProjectedCRS;
028:        import org.opengis.referencing.crs.CRSAuthorityFactory;
029:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
030:
031:        // Geotools dependencies
032:        import org.geotools.factory.Hints;
033:        import org.geotools.referencing.CRS;
034:        import org.geotools.referencing.NamedIdentifier;
035:        import org.geotools.referencing.ReferencingFactoryFinder;
036:        import org.geotools.referencing.factory.OrderedAxisAuthorityFactory;
037:        import org.geotools.metadata.iso.citation.Citations;
038:
039:        // JUnit dependencies
040:        import junit.framework.Test;
041:        import junit.framework.TestCase;
042:        import junit.framework.TestSuite;
043:
044:        /**
045:         * Tests {@link UnnamedExtension}.
046:         * 
047:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/epsg-extension/src/test/java/org/geotools/referencing/factory/epsg/UnnamedExtensionTest.java $
048:         * @version $Id: UnnamedExtensionTest.java 27925 2007-11-18 23:08:33Z desruisseaux $
049:         * @author Martin Desruisseaux
050:         * @author Jody Garnett
051:         */
052:        public class UnnamedExtensionTest extends TestCase {
053:            /**
054:             * The factory to test.
055:             */
056:            private UnnamedExtension factory;
057:
058:            /**
059:             * Returns the test suite.
060:             */
061:            public static Test suite() {
062:                return new TestSuite(UnnamedExtensionTest.class);
063:            }
064:
065:            /**
066:             * Run the test from the command line.
067:             * Options: {@code -verbose}.
068:             *
069:             * @param args the command line arguments.
070:             */
071:            public static void main(final String[] args) {
072:                org.geotools.util.logging.Logging.GEOTOOLS
073:                        .forceMonolineConsoleOutput();
074:                junit.textui.TestRunner.run(suite());
075:            }
076:
077:            /**
078:             * Creates a test case with the specified name.
079:             */
080:            public UnnamedExtensionTest(final String name) {
081:                super (name);
082:            }
083:
084:            /**
085:             * Gets the authority factory for ESRI.
086:             */
087:            protected void setUp() throws Exception {
088:                super .setUp();
089:                factory = (UnnamedExtension) ReferencingFactoryFinder
090:                        .getCRSAuthorityFactory("EPSG", new Hints(
091:                                Hints.CRS_AUTHORITY_FACTORY,
092:                                UnnamedExtension.class));
093:            }
094:
095:            /**
096:             * Tests the authority code.
097:             */
098:            public void testAuthority() {
099:                final Citation authority = factory.getAuthority();
100:                assertNotNull(authority);
101:                assertEquals("European Petroleum Survey Group", authority
102:                        .getTitle().toString());
103:                assertTrue(authority.getIdentifiers().contains("EPSG"));
104:                assertFalse(authority.getIdentifiers().contains("ESRI"));
105:                assertTrue(factory instanceof  UnnamedExtension);
106:            }
107:
108:            /**
109:             * Tests the vendor.
110:             */
111:            public void testVendor() {
112:                final Citation vendor = factory.getVendor();
113:                assertNotNull(vendor);
114:                assertEquals("Geotools", vendor.getTitle().toString());
115:            }
116:
117:            /**
118:             * Checks for duplication with EPSG-HSQL.
119:             */
120:            public void testDuplication() throws FactoryException {
121:                final StringWriter buffer = new StringWriter();
122:                final PrintWriter writer = new PrintWriter(buffer);
123:                final Set duplicated = factory.reportDuplicatedCodes(writer);
124:                assertTrue(buffer.toString(), duplicated.isEmpty());
125:            }
126:
127:            /**
128:             * Checks for CRS instantiations.
129:             */
130:            public void testInstantiation() throws FactoryException {
131:                final StringWriter buffer = new StringWriter();
132:                final PrintWriter writer = new PrintWriter(buffer);
133:                final Set duplicated = factory
134:                        .reportInstantiationFailures(writer);
135:                assertTrue(buffer.toString(), duplicated.isEmpty());
136:            }
137:
138:            /**
139:             * Tests the {@code 41001} code.
140:             */
141:            public void test41001() throws FactoryException {
142:                CoordinateReferenceSystem actual, expected;
143:                expected = factory.createCoordinateReferenceSystem("41001");
144:                actual = CRS.decode("EPSG:41001");
145:                assertSame(expected, actual);
146:                assertTrue(actual instanceof  ProjectedCRS);
147:                Collection ids = actual.getIdentifiers();
148:                assertTrue(ids.contains(new NamedIdentifier(Citations.EPSG,
149:                        "41001")));
150:                assertFalse(ids.contains(new NamedIdentifier(Citations.ESRI,
151:                        "41001")));
152:            }
153:
154:            /**
155:             * UDIG requires this to work.
156:             */
157:            public void test42102() throws FactoryException {
158:                final Hints hints = new Hints(Hints.CRS_AUTHORITY_FACTORY,
159:                        UnnamedExtension.class);
160:                final CRSAuthorityFactory factory = new OrderedAxisAuthorityFactory(
161:                        "EPSG", hints, null);
162:                final CoordinateReferenceSystem crs = factory
163:                        .createCoordinateReferenceSystem("EPSG:42102");
164:                assertNotNull(crs);
165:                assertNotNull(crs.getIdentifiers());
166:                assertFalse(crs.getIdentifiers().isEmpty());
167:                NamedIdentifier expected = new NamedIdentifier(Citations.EPSG,
168:                        "42102");
169:                assertTrue(crs.getIdentifiers().contains(expected));
170:            }
171:
172:            /**
173:             * WFS requires this to work.
174:             */
175:            public void test42102Lower() throws FactoryException {
176:                CoordinateReferenceSystem crs = CRS.decode("epsg:42102");
177:                assertNotNull(crs);
178:                assertNotNull(crs.getIdentifiers());
179:                assertFalse(crs.getIdentifiers().isEmpty());
180:                NamedIdentifier expected = new NamedIdentifier(Citations.EPSG,
181:                        "42102");
182:                assertTrue(crs.getIdentifiers().contains(expected));
183:            }
184:
185:            /**
186:             * WFS requires this to work.
187:             */
188:            public void test42304Lower() throws FactoryException {
189:                CoordinateReferenceSystem crs = CRS.decode("epsg:42304");
190:                assertNotNull(crs);
191:            }
192:
193:            /**
194:             * Tests the extensions through a URI.
195:             * 
196:             * @see http://jira.codehaus.org/browse/GEOT-1563
197:             */
198:            public void testURI() throws FactoryException {
199:                final String id = "100001";
200:                final CoordinateReferenceSystem crs = CRS.decode("EPSG:" + id);
201:                assertSame(crs, CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:"
202:                        + id));
203:                assertSame(crs,
204:                        CRS.decode("http://www.opengis.net/gml/srs/epsg.xml#"
205:                                + id));
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.