svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extDalTransformEventTheme / src-test / org / gvsig / app / eventlayer / daltransform / EventThemeTransformTest.java @ 29956
History | View | Annotate | Download (3.45 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 {Iver T.I.} {Task}
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.app.eventlayer.daltransform; |
29 |
|
30 |
import java.io.File; |
31 |
|
32 |
import org.gvsig.app.eventtheme.dal.feature.EventThemeTransform; |
33 |
import org.gvsig.fmap.dal.DALFileLibrary; |
34 |
import org.gvsig.fmap.dal.DataStoreParameters; |
35 |
import org.gvsig.fmap.dal.exception.DataException; |
36 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
38 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransform; |
39 |
import org.gvsig.fmap.dal.store.dbf.DBFLibrary; |
40 |
import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters; |
41 |
import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider; |
42 |
|
43 |
/**
|
44 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
45 |
*/
|
46 |
public class EventThemeTransformTest extends BaseFeatureStoreTransform { |
47 |
private final File dbf = new File("testdata/events.dbf"); |
48 |
private final String xFieldName = "x"; |
49 |
private final String yFieldName = "y"; |
50 |
private final String geometryFieldName = "geom"; |
51 |
protected boolean testDBFInitialized = false; |
52 |
|
53 |
protected void setUp() throws Exception { |
54 |
super.setUp();
|
55 |
if (testDBFInitialized) {
|
56 |
return;
|
57 |
} |
58 |
// FIXME
|
59 |
// ToolsLocator.registerDefaultPersistenceManager(XMLEntityManager.class);
|
60 |
|
61 |
DALFileLibrary libFile = new DALFileLibrary();
|
62 |
libFile.initialize(); |
63 |
|
64 |
DBFLibrary dbfLib = new DBFLibrary();
|
65 |
dbfLib.initialize(); |
66 |
|
67 |
libFile.postInitialize(); |
68 |
dbfLib.postInitialize(); |
69 |
testDBFInitialized = true;
|
70 |
} |
71 |
|
72 |
public DataStoreParameters getDefaultDataStoreParameters() throws DataException { |
73 |
DBFStoreParameters dbfParameters = null;
|
74 |
dbfParameters = (DBFStoreParameters) dataManager |
75 |
.createStoreParameters(DBFStoreProvider.NAME); |
76 |
|
77 |
dbfParameters.setFile(dbf); |
78 |
|
79 |
return dbfParameters;
|
80 |
} |
81 |
|
82 |
/* (non-Javadoc)
|
83 |
* @see org.gvsig.fmap.dal.feature.BaseFeatureStoreTransform#getFeatureStoreTransform()
|
84 |
*/
|
85 |
public FeatureStoreTransform getFeatureStoreTransform() throws DataException, ValidateDataParametersException { |
86 |
FeatureStore store = (FeatureStore) dataManager.createStore(this
|
87 |
.getDefaultDataStoreParameters()); |
88 |
EventThemeTransform transform = new EventThemeTransform();
|
89 |
transform.initialize(store, geometryFieldName, xFieldName, yFieldName); |
90 |
return transform;
|
91 |
} |
92 |
|
93 |
/* (non-Javadoc)
|
94 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer()
|
95 |
*/
|
96 |
public boolean hasExplorer() { |
97 |
// TODO Auto-generated method stub
|
98 |
return false; |
99 |
} |
100 |
|
101 |
/* (non-Javadoc)
|
102 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#usesResources()
|
103 |
*/
|
104 |
public boolean usesResources() { |
105 |
// TODO Auto-generated method stub
|
106 |
return false; |
107 |
} |
108 |
} |
109 |
|