svn-gvsig-desktop / trunk / libraries / libFMap / src-test / com / iver / cit / gvsig / fmap / AllTests.java @ 12043
History | View | Annotate | Download (2.87 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.symbols.TestCartographySupport; |
14 |
import com.iver.cit.gvsig.fmap.core.symbols.TestISymbol; |
15 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
16 |
import com.iver.cit.gvsig.fmap.featureiterators.FeatureIteratorTest; |
17 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
18 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
19 |
import com.iver.cit.gvsig.fmap.layers.LayersIteratorTest; |
20 |
|
21 |
public class AllTests extends TestCase{ |
22 |
public static IProjection TEST_DEFAULT_PROJECTION = |
23 |
CRSFactory.getCRS("EPSG:4326");
|
24 |
public static IProjection TEST_DEFAULT_MERCATOR_PROJECTION = |
25 |
CRSFactory.getCRS("EPSG:23030");
|
26 |
public static IProjection test_newProjection = |
27 |
CRSFactory.getCRS("EPSG:23029");
|
28 |
|
29 |
public static Test suite() { |
30 |
TestSuite suite = new TestSuite("Test for com.iver.cit.gvsig.fmap"); |
31 |
//$JUnit-BEGIN$
|
32 |
|
33 |
/* LayersIterator */
|
34 |
suite.addTestSuite(LayersIteratorTest.class); |
35 |
|
36 |
|
37 |
/* Symbols (jaume) */
|
38 |
// integration tests
|
39 |
// ISymbol
|
40 |
suite.addTestSuite(TestISymbol.class); |
41 |
|
42 |
// CartographicSupport
|
43 |
suite.addTestSuite(TestCartographySupport.class); |
44 |
|
45 |
//
|
46 |
/*
|
47 |
* Feature iterators
|
48 |
* */
|
49 |
suite.addTestSuite(FeatureIteratorTest.class); |
50 |
//$JUnit-END$
|
51 |
return suite;
|
52 |
} |
53 |
|
54 |
//// jaume
|
55 |
//// PASTED FROM FeatureIteratorTest.java to be globally accessible
|
56 |
static final String fwAndamiDriverPath = "../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"; |
57 |
private static File baseDataPath; |
58 |
private static File baseDriversPath; |
59 |
|
60 |
|
61 |
public static void setUpDrivers() { |
62 |
try {
|
63 |
URL url = AllTests.class.getResource("testdata"); |
64 |
if (url == null) |
65 |
throw new Exception("No se encuentra el directorio con datos de prueba"); |
66 |
|
67 |
baseDataPath = new File(url.getFile()); |
68 |
if (!baseDataPath.exists())
|
69 |
throw new Exception("No se encuentra el directorio con datos de prueba"); |
70 |
|
71 |
baseDriversPath = new File(fwAndamiDriverPath); |
72 |
if (!baseDriversPath.exists())
|
73 |
throw new Exception("Can't find drivers path: " + fwAndamiDriverPath); |
74 |
|
75 |
LayerFactory.setDriversPath(baseDriversPath.getAbsolutePath()); |
76 |
if (LayerFactory.getDM().getDriverNames().length < 1) |
77 |
throw new Exception("Can't find drivers in path: " + fwAndamiDriverPath); |
78 |
} catch (Exception e) { |
79 |
throw new RuntimeException(e); |
80 |
} |
81 |
} |
82 |
|
83 |
public static FLayer newLayer(String fileName, |
84 |
String driverName)
|
85 |
throws LoadLayerException {
|
86 |
File file = new File(baseDataPath, fileName); |
87 |
return LayerFactory.createLayer(fileName,
|
88 |
driverName, |
89 |
file, TEST_DEFAULT_MERCATOR_PROJECTION); |
90 |
} |
91 |
|
92 |
public static MapContext newMapContext(IProjection projection) { |
93 |
ViewPort vp = new ViewPort(projection);
|
94 |
return new MapContext(vp); |
95 |
} |
96 |
|
97 |
//// end past
|
98 |
} |