root / trunk / libraries / libFMap / src-test / com / iver / cit / gvsig / fmap / AllTests.java @ 38080
History | View | Annotate | Download (4.74 KB)
1 |
package com.iver.cit.gvsig.fmap; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.net.URL; |
5 |
|
6 |
import junit.framework.Test; |
7 |
import junit.framework.TestCase; |
8 |
import junit.framework.TestSuite; |
9 |
|
10 |
import org.cresques.cts.IProjection; |
11 |
|
12 |
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException; |
13 |
import com.iver.cit.gvsig.fmap.core.TestCartographicSupportForSymbol; |
14 |
import com.iver.cit.gvsig.fmap.core.rendering.TestILegend; |
15 |
import com.iver.cit.gvsig.fmap.core.rendering.styling.labeling.TestILabelingMethod; |
16 |
import com.iver.cit.gvsig.fmap.core.rendering.styling.labeling.TestLabelClass; |
17 |
import com.iver.cit.gvsig.fmap.core.symbols.TestISymbol; |
18 |
import com.iver.cit.gvsig.fmap.core.symbols.TestMultiLayerSymbol; |
19 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
20 |
import com.iver.cit.gvsig.fmap.drivers.dbf.TestDbf; |
21 |
import com.iver.cit.gvsig.fmap.drivers.dgn.TestDgn; |
22 |
import com.iver.cit.gvsig.fmap.featureiterators.DBFeatureIteratorTest; |
23 |
import com.iver.cit.gvsig.fmap.featureiterators.FeatureIteratorTest; |
24 |
import com.iver.cit.gvsig.fmap.featureiterators.PerformanceFeatureIteratorTest; |
25 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
26 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
27 |
import com.iver.cit.gvsig.fmap.layers.LayersIteratorTest; |
28 |
import com.iver.cit.gvsig.fmap.rendering.FIntervalTest; |
29 |
import com.iver.cit.gvsig.fmap.spatialindex.SpatialIndexTest; |
30 |
import com.iver.cit.gvsig.fmap.tools.AreaListenerTest; |
31 |
import com.vividsolutions.jts.operation.overlay.SnappingOverlayOperationTest; |
32 |
|
33 |
public class AllTests extends TestCase{ |
34 |
/**
|
35 |
* The EPSG:4326 projection
|
36 |
*/
|
37 |
public static IProjection TEST_DEFAULT_PROJECTION = |
38 |
CRSFactory.getCRS("EPSG:4326");
|
39 |
|
40 |
/**
|
41 |
* The EPSG:23030 projection
|
42 |
*/
|
43 |
public static IProjection TEST_DEFAULT_MERCATOR_PROJECTION = |
44 |
CRSFactory.getCRS("EPSG:23030");
|
45 |
|
46 |
/**
|
47 |
* The EPSG:23029 projection
|
48 |
*/
|
49 |
public static IProjection test_newProjection = |
50 |
CRSFactory.getCRS("EPSG:23029");
|
51 |
|
52 |
public static Test suite() { |
53 |
TestSuite suite = new TestSuite("Test for com.iver.cit.gvsig.fmap"); |
54 |
//$JUnit-BEGIN$
|
55 |
|
56 |
/* LayersIterator */
|
57 |
suite.addTestSuite(LayersIteratorTest.class); |
58 |
|
59 |
|
60 |
// NOTE (jaume): order is important for incremental testing
|
61 |
/* Symbols subsystem (jaume) */
|
62 |
// integration tests
|
63 |
// ISymbol
|
64 |
suite.addTest(TestISymbol.suite()); |
65 |
suite.addTestSuite(TestMultiLayerSymbol.class); |
66 |
|
67 |
/* CartographicSupport subsystem (jaume) */
|
68 |
// integration tests for symbols
|
69 |
suite.addTestSuite(TestCartographicSupportForSymbol.class); |
70 |
|
71 |
/* Legend subsystem (jaume) */
|
72 |
// integration tests
|
73 |
suite.addTest(TestILegend.suite()); |
74 |
|
75 |
/* Labeling subsystem (jaume) */
|
76 |
// unit tests
|
77 |
suite.addTestSuite(TestLabelClass.class); |
78 |
|
79 |
// integration tests
|
80 |
suite.addTest(TestILabelingMethod.suite()); |
81 |
/*
|
82 |
* Feature iterators
|
83 |
* */
|
84 |
suite.addTestSuite(FeatureIteratorTest.class); |
85 |
|
86 |
/*
|
87 |
* Other Tests present in FMap (cesar)
|
88 |
* Remove them from here and the src-test dir if they are not
|
89 |
* useful anymore.
|
90 |
*/
|
91 |
|
92 |
suite.addTestSuite(AreaListenerTest.class); |
93 |
suite.addTestSuite(DBFeatureIteratorTest.class); |
94 |
suite.addTestSuite(PerformanceFeatureIteratorTest.class); |
95 |
suite.addTestSuite(SnappingOverlayOperationTest.class); |
96 |
suite.addTestSuite(SpatialIndexTest.class); |
97 |
suite.addTestSuite(TestDbf.class); |
98 |
suite.addTestSuite(TestDgn.class); |
99 |
|
100 |
suite.addTestSuite(FIntervalTest.class); |
101 |
|
102 |
//$JUnit-END$
|
103 |
return suite;
|
104 |
} |
105 |
|
106 |
//// jaume
|
107 |
//// PASTED FROM FeatureIteratorTest.java to be globally accessible
|
108 |
public static final String fwAndamiDriverPath = "../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"; |
109 |
private static File baseDataPath; |
110 |
private static File baseDriversPath; |
111 |
|
112 |
|
113 |
public static void setUpDrivers() { |
114 |
try {
|
115 |
URL url = AllTests.class.getResource("testdata"); |
116 |
if (url == null) |
117 |
throw new Exception("No se encuentra el directorio con datos de prueba"); |
118 |
|
119 |
baseDataPath = new File(url.getFile()); |
120 |
if (!baseDataPath.exists())
|
121 |
throw new Exception("No se encuentra el directorio con datos de prueba"); |
122 |
|
123 |
baseDriversPath = new File(fwAndamiDriverPath); |
124 |
if (!baseDriversPath.exists())
|
125 |
throw new Exception("Can't find drivers path: " + fwAndamiDriverPath); |
126 |
|
127 |
LayerFactory.setDriversPath(baseDriversPath.getAbsolutePath()); |
128 |
if (LayerFactory.getDM().getDriverNames().length < 1) |
129 |
throw new Exception("Can't find drivers in path: " + fwAndamiDriverPath); |
130 |
} catch (Exception e) { |
131 |
throw new RuntimeException(e); |
132 |
} |
133 |
} |
134 |
|
135 |
public static FLayer newLayer(String fileName, |
136 |
String driverName)
|
137 |
throws LoadLayerException {
|
138 |
File file = new File(baseDataPath, fileName); |
139 |
return LayerFactory.createLayer(fileName,
|
140 |
driverName, |
141 |
file, TEST_DEFAULT_MERCATOR_PROJECTION); |
142 |
} |
143 |
|
144 |
public static MapContext newMapContext(IProjection projection) { |
145 |
ViewPort vp = new ViewPort(projection);
|
146 |
return new MapContext(vp); |
147 |
} |
148 |
|
149 |
//// end past
|
150 |
} |