001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
005: * (C) 2002, Institut de Recherche pour le Développement
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.referencing;
018:
019: // JUnit dependencies
020: import junit.framework.Test;
021: import junit.framework.TestCase;
022: import junit.framework.TestSuite;
023: import junit.textui.TestRunner;
024:
025: /**
026: * Performs all tests for the <code>org.geotools.referencing</code> packages. This
027: * also includes tests in some dependencies, like <code>org.geotools.measure</code>
028: * and <code>org.geotools.parameter</code> packages.
029: *
030: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/test/java/org/geotools/referencing/AllTests.java $
031: * @version $Id: AllTests.java 27848 2007-11-12 13:10:32Z desruisseaux $
032: * @author Martin Desruisseaux
033: */
034: public class AllTests extends TestCase {
035: /**
036: * No need to construct this class.
037: */
038: private AllTests() {
039: }
040:
041: /**
042: * Run the suite from the command line.
043: */
044: public static void main(final String[] args) {
045: org.geotools.util.logging.Logging.GEOTOOLS
046: .forceMonolineConsoleOutput();
047: TestRunner.run(suite());
048: }
049:
050: /**
051: * Add a test suite using reflection. Used in order to add some suites that may or may
052: * not be on the classpath.
053: */
054: private static void addTest(final TestSuite suite,
055: final String tests) {
056: try {
057: final Class c = Class.forName(tests);
058: suite.addTest((Test) c.getMethod("suite", (Class[]) null)
059: .invoke(null, (Object[]) null));
060: } catch (Exception ignore) {
061: /*
062: * EPSG tests not found on the class path (which may be normal), or method invocation
063: * failed (which should not happen). Ignore, because the addition of those tests here
064: * was just a convenience. All tests will be run at Maven build anyway.
065: */
066: }
067: }
068:
069: /**
070: * Returns all suites.
071: */
072: public static Test suite() {
073: final TestSuite suite = new TestSuite(
074: "org.geotools.referencing");
075: addTest(suite, "org.geotools.metadata.AllTests");
076: suite.addTest(org.geotools.measure.FormatTest.suite());
077: suite
078: .addTest(org.geotools.geometry.GeneralEnvelopeTest
079: .suite());
080: suite.addTest(org.geotools.parameter.ParametersTest.suite());
081: suite.addTest(org.geotools.parameter.ImagingParametersTest
082: .suite());
083: suite.addTest(org.geotools.referencing.IdentifiedObjectTest
084: .suite());
085: suite.addTest(org.geotools.referencing.PredefinedObjectsTest
086: .suite());
087: suite.addTest(org.geotools.referencing.FactoriesTest.suite());
088: suite.addTest(org.geotools.referencing.GeodeticCalculatorTest
089: .suite());
090: suite
091: .addTest(org.geotools.referencing.cs.DirectionAlongMeridianTest
092: .suite());
093: suite
094: .addTest(org.geotools.referencing.cs.DefaultCoordinateSystemAxisTest
095: .suite());
096: suite
097: .addTest(org.geotools.referencing.cs.ComparableAxisWrapperTest
098: .suite());
099: suite.addTest(org.geotools.referencing.cs.AbstractCSTest
100: .suite());
101: suite
102: .addTest(org.geotools.referencing.cs.DefaultCartesianCSTest
103: .suite());
104: suite.addTest(org.geotools.referencing.wkt.SymbolsTest.suite());
105: suite.addTest(org.geotools.referencing.wkt.ParserTest.suite());
106: suite
107: .addTest(org.geotools.referencing.operation.LinearConversionTest
108: .suite());
109: suite
110: .addTest(org.geotools.referencing.operation.Transform3DTest
111: .suite());
112: suite
113: .addTest(org.geotools.referencing.operation.CoordinateOperationFactoryTest
114: .suite());
115: suite
116: .addTest(org.geotools.referencing.operation.matrix.XAffineTransformTest
117: .suite());
118: suite
119: .addTest(org.geotools.referencing.operation.transform.MathTransformTest
120: .suite());
121: suite
122: .addTest(org.geotools.referencing.operation.transform.GeocentricTransformTest
123: .suite());
124: suite
125: .addTest(org.geotools.referencing.operation.transform.GeocentricTranslationTest
126: .suite());
127: suite
128: .addTest(org.geotools.referencing.operation.transform.PassthroughTransformTest
129: .suite());
130: suite
131: .addTest(org.geotools.referencing.operation.transform.LocalizationGridTest
132: .suite());
133: suite
134: .addTest(org.geotools.referencing.operation.transform.WarpTransformTest
135: .suite());
136: suite
137: .addTest(org.geotools.referencing.operation.projection.DirectCreationTest
138: .suite());
139: suite
140: .addTest(org.geotools.referencing.operation.projection.NewZealandMapGridTest
141: .suite());
142: suite
143: .addTest(org.geotools.referencing.operation.projection.SouthOrientedTest
144: .suite());
145: suite
146: .addTest(org.geotools.referencing.factory.epsg.FactoryUsingWktTest
147: .suite());
148: suite
149: .addTest(org.geotools.referencing.factory.epsg.FallbackAuthorityFactoryTest
150: .suite());
151: suite.addTest(org.geotools.referencing.factory.wms.AUTOTest
152: .suite());
153: suite.addTest(org.geotools.referencing.factory.wms.CRSTest
154: .suite());
155: suite.addTest(org.geotools.referencing.factory.URN_ParserTest
156: .suite());
157: suite.addTest(org.geotools.referencing.CrsTest.suite());
158: suite.addTest(org.geotools.referencing.ScriptTest.suite());
159: /*
160: * If the EPSG authority factory on HSQL is available in the class path, add its tests.
161: * It is never the case when the referencing module is build by Maven (the EPSG tests
162: * will be run at plugin/epsg-hsql building time instead). But it is sometime the case
163: * when the tests are run from the command line.
164: */
165: addTest(suite, "org.geotools.referencing.factory.epsg.AllTests");
166: /*
167: * The following must be tested after the EPSG factory tests, because it may involves more
168: * interactions with the EPSG factory. No work on the database-backed EPSG factory should
169: * be performed before the tests from the EPSG module (the 'try {...} catch' block above),
170: * otherwise the org.geotools.referencing.factory.epsg.DefaultDataSourceTest.testTimeout()
171: * test may fails.
172: */
173: suite
174: .addTest(org.geotools.referencing.factory.AllAuthoritiesFactoryTest
175: .suite());
176: return suite;
177: }
178: }
|