Revision 6067
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/AbstractTest19Authorization.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
import static junit.framework.TestCase.assertEquals; |
|
6 |
import static junit.framework.TestCase.assertNotNull; |
|
7 |
import org.apache.commons.io.FileUtils; |
|
8 |
import org.gvsig.expressionevaluator.Expression; |
|
9 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
10 |
import org.gvsig.fmap.dal.feature.Feature; |
|
11 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
12 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
13 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
14 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
|
15 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
16 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
17 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
|
18 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_OK; |
|
19 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_USER_NOT_AUTHORIZED; |
|
20 |
import org.gvsig.vcsgis.lib.VCSGisUserIdentificationRequester; |
|
21 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
22 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepositoryChange; |
|
23 |
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldbImpl; |
|
24 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.ConfigRepoTable; |
|
25 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.DataRepoTable; |
|
26 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable; |
|
27 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.UsersRepoTable; |
|
28 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
29 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceChanges; |
|
30 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable; |
|
31 |
|
|
32 |
public abstract class AbstractTest19Authorization extends AbstractTestVCSGIS { |
|
33 |
|
|
34 |
public AbstractTest19Authorization(String testName) { |
|
35 |
super(testName); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
protected void setUp() throws Exception { |
|
40 |
super.setUp(); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void tearDown() throws Exception { |
|
45 |
super.tearDown(); |
|
46 |
} |
|
47 |
|
|
48 |
private void check(FeatureStore store2, String relatedFeatureCode, int id, String text) throws Exception { |
|
49 |
Feature f = store2.findFirst("VCSGISCODE = '"+relatedFeatureCode+"'"); |
|
50 |
assertEquals(id, f.getInt("id")); |
|
51 |
assertEquals(text, f.getString("text")); |
|
52 |
} |
|
53 |
|
|
54 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
55 |
// public void testHello() {} |
|
56 |
|
|
57 |
protected void testAuthorizationAllAllowed() throws Exception { |
|
58 |
utils().cleanRepositoryDatabase(); |
|
59 |
|
|
60 |
final String testid = "AuthorizationAllAllowed"; |
|
61 |
|
|
62 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
63 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-"+testid); |
|
64 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs","ws-"+testid)); |
|
65 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); |
|
66 |
|
|
67 |
Feature f; |
|
68 |
EditableFeature ef; |
|
69 |
List<Feature> features; |
|
70 |
FeatureStore sourceTest; |
|
71 |
FeatureStore store2; |
|
72 |
|
|
73 |
// --------------------------------------------------------- |
|
74 |
// Creamos el respositorio y lo abrimos. |
|
75 |
int r = manager.initRepository(server.getParameters(), null); |
|
76 |
assertEquals("srv-init status", 0, r); |
|
77 |
|
|
78 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
79 |
utils().info_repository(repo); |
|
80 |
|
|
81 |
enableAuthentication(repo); |
|
82 |
addUser(repo, "user1", "password","add,entities,commit,update,checkout,history,topologyplans,users"); |
|
83 |
|
|
84 |
// --------------------------------------------------------- |
|
85 |
// Creamos un workspace y lo abrimos. |
|
86 |
r = manager.initWorkspace(wsfile, repo, "Test add and commit",null); |
|
87 |
assertEquals("ws-init status", 0, r); |
|
88 |
|
|
89 |
VCSGisWorkspace ws1 = manager.openWorkspace(wsfile); |
|
90 |
utils().info_workspace(ws1); |
|
91 |
|
|
92 |
ws1.setUserIdentificationRequester(getIdentificationRequester("user1", "password")); |
|
93 |
|
|
94 |
// --------------------------------------------------------- |
|
95 |
// Adicionamos al workspace la tabla de pruebas y lo commitamos |
|
96 |
sourceTest = utils().openSourceStore2(); |
|
97 |
r = ws1.add("test", sourceTest, "text"); |
|
98 |
assertEquals("ws-add status", 0, r); |
|
99 |
|
|
100 |
r = ws1.commit(); |
|
101 |
assertEquals("ws-commit status", ERR_OK, r); |
|
102 |
|
|
103 |
enableAuthorizationByEntity(repo, "test"); |
|
104 |
|
|
105 |
// --------------------------------------------------------- |
|
106 |
// Comprobamos que tras el commit la tabla de cambios esta vacia. |
|
107 |
FeatureStore changesStore = ws1.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
108 |
assertEquals("Changes", 0, changesStore.size64()); |
|
109 |
DisposeUtils.disposeQuietly(changesStore); |
|
110 |
|
|
111 |
// --------------------------------------------------------- |
|
112 |
// Comprobamos que la tabla adicionada al espacio ed trabajo contiene |
|
113 |
// los mismos registros que la original. |
|
114 |
FeatureStore dataStore = ((VCSGisRepositoryLocaldbImpl)repo).getFeatureStore(DataRepoTable.TABLE_NAME, true); |
|
115 |
assertEquals("DataStore", sourceTest.size64(), dataStore.size64()); |
|
116 |
|
|
117 |
sourceTest.dispose(); |
|
118 |
DisposeUtils.disposeQuietly(dataStore); |
|
119 |
|
|
120 |
|
|
121 |
// ------------------------------------------------------------ |
|
122 |
// Inicializamos el workspace2 asociandolo al mismo repositorio que |
|
123 |
// workspace1 y lo abrimos. |
|
124 |
r = manager.initWorkspace(ws2file, repo, "Test update2",null); |
|
125 |
assertEquals("init_ws2 status", ERR_NO_ERROR, r); |
|
126 |
VCSGisWorkspace ws2 = manager.openWorkspace(ws2file); |
|
127 |
utils().info_workspace(ws2); |
|
128 |
|
|
129 |
ws2.setUserIdentificationRequester(getIdentificationRequester("user1", "password")); |
|
130 |
|
|
131 |
// ------------------------------------------------------------ |
|
132 |
// Hacemos un checkout en workspace2 de la tabla "test" |
|
133 |
// y comprobamos que tiene lo que toca. |
|
134 |
r = ws2.checkout("test"); |
|
135 |
assertEquals("ws2-checkout status", ERR_NO_ERROR, r); |
|
136 |
|
|
137 |
VCSGisEntity entity = ws2.getWorkspaceEntityByName("test"); |
|
138 |
assertNotNull("ws2.update-1 entity", entity); |
|
139 |
assertEquals("ws2.update-1 label", "text", entity.getFieldForLabel()); |
|
140 |
|
|
141 |
store2 = ws2.openFeatureStore("test", true); |
|
142 |
assertEquals("ws2-checkout sizes", 3, store2.size64()); |
|
143 |
features = store2.getFeatures((Expression)null, "id", true); |
|
144 |
assertEquals(1 , features.get(0).getInt("id")); |
|
145 |
assertEquals("AAA", features.get(0).getString("text")); |
|
146 |
assertEquals(2 , features.get(1).getInt("id")); |
|
147 |
assertEquals("BBB", features.get(1).getString("text")); |
|
148 |
assertEquals(3 , features.get(2).getInt("id")); |
|
149 |
assertEquals("CCC", features.get(2).getString("text")); |
|
150 |
|
|
151 |
DisposeUtils.disposeQuietly(store2); |
|
152 |
|
|
153 |
|
|
154 |
// ------------------------------------------------------------ |
|
155 |
// Modificamos la tabla "test" en el workspace1 y la commitamos. |
|
156 |
sourceTest = ws1.openFeatureStore("test",false); |
|
157 |
sourceTest.edit(); |
|
158 |
f = sourceTest.findFirst("id=2"); |
|
159 |
ef = f.getEditable(); |
|
160 |
ef.set("text", "BB2"); |
|
161 |
sourceTest.update(ef); |
|
162 |
|
|
163 |
ef = sourceTest.createNewFeature(); |
|
164 |
ef.set("id",4); |
|
165 |
ef.set("text","DDD"); |
|
166 |
sourceTest.insert(ef); |
|
167 |
sourceTest.finishEditing(); |
|
168 |
DisposeUtils.disposeQuietly(sourceTest); |
|
169 |
r = ws1.commit(); |
|
170 |
assertEquals("ws1.commit-2 status", ERR_NO_ERROR, r); |
|
171 |
|
|
172 |
// ------------------------------------------------------------ |
|
173 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
174 |
// y comprobamos que tiene lo que toca. |
|
175 |
r = ws2.updatePrepare("test"); |
|
176 |
assertEquals("ws2.update-prepare-1 status", 0, r); |
|
177 |
VCSGisWorkspaceChanges<VCSGisRepositoryChange> remoteChanges = ws2.getRemoteChanges(); |
|
178 |
assertEquals("ws2.update-prepare-1 remoteChanges size", 2L, remoteChanges.size64()); |
|
179 |
|
|
180 |
|
|
181 |
r = ws2.updatePrepare("test"); |
|
182 |
assertEquals("ws2.updatePrepare-1 status", 0, r); |
|
183 |
r = ws2.update("test"); |
|
184 |
assertEquals("ws2.update-1 status", 0, r); |
|
185 |
store2 = ws2.openFeatureStore("test",false); |
|
186 |
assertEquals("ws2-upfate sizes", 4, store2.size64()); |
|
187 |
features = store2.getFeatures((Expression)null, "id", true); |
|
188 |
assertEquals(1 , features.get(0).getInt("id")); |
|
189 |
assertEquals("AAA", features.get(0).getString("text")); |
|
190 |
assertEquals(2 , features.get(1).getInt("id")); |
|
191 |
assertEquals("BB2", features.get(1).getString("text")); |
|
192 |
assertEquals(3 , features.get(2).getInt("id")); |
|
193 |
assertEquals("CCC", features.get(2).getString("text")); |
|
194 |
assertEquals(4 , features.get(3).getInt("id")); |
|
195 |
assertEquals("DDD", features.get(3).getString("text")); |
|
196 |
DisposeUtils.disposeQuietly(store2); |
|
197 |
|
|
198 |
|
|
199 |
} |
|
200 |
|
|
201 |
protected void testAuthorizationUserCommitNotAllowed() throws Exception { |
|
202 |
try { |
|
203 |
utils().cleanRepositoryDatabase(); |
|
204 |
|
|
205 |
final String testid = "AuthorizationUserCommitNotAllowed"; |
|
206 |
|
|
207 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
208 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-"+testid); |
|
209 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs","ws-"+testid)); |
|
210 |
|
|
211 |
// --------------------------------------------------------- |
|
212 |
// Creamos el respositorio y lo abrimos. |
|
213 |
int r = manager.initRepository(server.getParameters(), null); |
|
214 |
assertEquals("srv-init status", 0, r); |
|
215 |
|
|
216 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
217 |
utils().info_repository(repo); |
|
218 |
|
|
219 |
enableAuthentication(repo); |
|
220 |
//All allowed except commit |
|
221 |
addUser(repo, "user1", "password","add,entities,update,checkout,history,topologyplans,users"); |
|
222 |
|
|
223 |
// --------------------------------------------------------- |
|
224 |
// Creamos un workspace y lo abrimos. |
|
225 |
r = manager.initWorkspace(wsfile, repo, "Test add and commit",null); |
|
226 |
assertEquals("ws-init status", 0, r); |
|
227 |
|
|
228 |
VCSGisWorkspace ws = manager.openWorkspace(wsfile); |
|
229 |
utils().info_workspace(ws); |
|
230 |
|
|
231 |
ws.setUserIdentificationRequester(getIdentificationRequester("user1", "password")); |
|
232 |
|
|
233 |
|
|
234 |
// --------------------------------------------------------- |
|
235 |
// Adicionamos al workspace la tabla de pruebas y lo commitamos |
|
236 |
FeatureStore sourceStore = utils().openSourceStore1(); |
|
237 |
r = ws.add("test", sourceStore, "ID"); |
|
238 |
assertEquals("ws-add status", 0, r); |
|
239 |
|
|
240 |
// Intentamos el commit y comprobamos que no está permitido |
|
241 |
r = ws.commit(); |
|
242 |
assertEquals("ws-commit status", ERR_USER_NOT_AUTHORIZED, r); |
|
243 |
} catch(Exception ex) { |
|
244 |
LOGGER.warn("",ex); |
|
245 |
throw ex; |
|
246 |
} |
|
247 |
} |
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
protected void testAuthorizationCheckoutNotAllowed() throws Exception { |
|
252 |
try { |
|
253 |
utils().cleanRepositoryDatabase(); |
|
254 |
|
|
255 |
final String testid = "AuthorizationCheckoutNotAllowed"; ///******************************************** |
|
256 |
|
|
257 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
258 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-"+testid); |
|
259 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs","ws-"+testid)); |
|
260 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); |
|
261 |
|
|
262 |
Feature f; |
|
263 |
EditableFeature ef; |
|
264 |
List<Feature> features; |
|
265 |
FeatureStore sourceTest; |
|
266 |
FeatureStore store2; |
|
267 |
|
|
268 |
// --------------------------------------------------------- |
|
269 |
// Creamos el respositorio y lo abrimos. |
|
270 |
int r = manager.initRepository(server.getParameters(), null); |
|
271 |
assertEquals("srv-init status", 0, r); |
|
272 |
|
|
273 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
274 |
utils().info_repository(repo); |
|
275 |
|
|
276 |
enableAuthentication(repo); |
|
277 |
addUser(repo, "user1", "password","add,entities,commit,update,checkout,history,topologyplans,users"); |
|
278 |
addUser(repo, "user2", "password","add,entities,commit,update,history,topologyplans,users"); |
|
279 |
|
|
280 |
// --------------------------------------------------------- |
|
281 |
// Creamos un workspace y lo abrimos. |
|
282 |
r = manager.initWorkspace(wsfile, repo, "Test add and commit",null); |
|
283 |
assertEquals("ws-init status", 0, r); |
|
284 |
|
|
285 |
VCSGisWorkspace ws1 = manager.openWorkspace(wsfile); |
|
286 |
utils().info_workspace(ws1); |
|
287 |
|
|
288 |
ws1.setUserIdentificationRequester(getIdentificationRequester("user1", "password")); |
|
289 |
|
|
290 |
// --------------------------------------------------------- |
|
291 |
// Adicionamos al workspace la tabla de pruebas y lo commitamos |
|
292 |
sourceTest = utils().openSourceStore2(); |
|
293 |
r = ws1.add("test", sourceTest, "text"); |
|
294 |
assertEquals("ws-add status", 0, r); |
|
295 |
|
|
296 |
r = ws1.commit(); |
|
297 |
assertEquals("ws-commit status", ERR_OK, r); |
|
298 |
|
|
299 |
enableAuthorizationByEntity(repo, "test"); |
|
300 |
|
|
301 |
// --------------------------------------------------------- |
|
302 |
// Comprobamos que tras el commit la tabla de cambios esta vacia. |
|
303 |
FeatureStore changesStore = ws1.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
304 |
assertEquals("Changes", 0, changesStore.size64()); |
|
305 |
|
|
306 |
DisposeUtils.disposeQuietly(changesStore); |
|
307 |
|
|
308 |
// --------------------------------------------------------- |
|
309 |
// Comprobamos que la tabla adicionada al espacio ed trabajo contiene |
|
310 |
// los mismos registros que la original. |
|
311 |
FeatureStore dataStore = ((VCSGisRepositoryLocaldbImpl)repo).getFeatureStore(DataRepoTable.TABLE_NAME, true); |
|
312 |
assertEquals("DataStore", sourceTest.size64(), dataStore.size64()); |
|
313 |
|
|
314 |
sourceTest.dispose(); |
|
315 |
DisposeUtils.disposeQuietly(dataStore); |
|
316 |
|
|
317 |
|
|
318 |
// ------------------------------------------------------------ |
|
319 |
// Inicializamos el workspace2 asociandolo al mismo repositorio que |
|
320 |
// workspace1 y lo abrimos. |
|
321 |
r = manager.initWorkspace(ws2file, repo, "Test update2",null); |
|
322 |
assertEquals("init_ws2 status", ERR_NO_ERROR, r); |
|
323 |
VCSGisWorkspace ws2 = manager.openWorkspace(ws2file); |
|
324 |
utils().info_workspace(ws2); |
|
325 |
|
|
326 |
ws2.setUserIdentificationRequester(getIdentificationRequester("user2", "password")); |
|
327 |
|
|
328 |
// ------------------------------------------------------------ |
|
329 |
// Hacemos un checkout en workspace2 de la tabla "test" |
|
330 |
// y comprobamos que tiene lo que toca. |
|
331 |
r = ws2.checkout("test"); |
|
332 |
assertEquals("ws2-checkout status", ERR_USER_NOT_AUTHORIZED, r); |
|
333 |
|
|
334 |
VCSGisEntity entity = ws2.getWorkspaceEntityByName("test"); |
|
335 |
assertNull("ws2.update-1 entity", entity); |
|
336 |
} catch(Exception ex) { |
|
337 |
LOGGER.warn("",ex); |
|
338 |
throw ex; |
|
339 |
} |
|
340 |
} |
|
341 |
|
|
342 |
|
|
343 |
protected void testAuthorizationCommitByEntityNotAllowed() throws Exception { |
|
344 |
utils().cleanRepositoryDatabase(); |
|
345 |
|
|
346 |
final String testid = "AuthorizationCommitByEntityNotAllowed"; |
|
347 |
|
|
348 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
349 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-"+testid); |
|
350 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs","ws-"+testid)); |
|
351 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); |
|
352 |
|
|
353 |
Feature f; |
|
354 |
EditableFeature ef; |
|
355 |
List<Feature> features; |
|
356 |
FeatureStore sourceTest; |
|
357 |
FeatureStore store2; |
|
358 |
|
|
359 |
// --------------------------------------------------------- |
|
360 |
// Creamos el respositorio y lo abrimos. |
|
361 |
int r = manager.initRepository(server.getParameters(), null); |
|
362 |
assertEquals("srv-init status", 0, r); |
|
363 |
|
|
364 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
365 |
utils().info_repository(repo); |
|
366 |
|
|
367 |
enableAuthentication(repo); |
|
368 |
addUser(repo, "user1", "password","add,entities,commit,update,checkout,history,topologyplans,users"); |
|
369 |
addUser(repo, "user2", "password","add,entities,commit,update,checkout,history,topologyplans,users"); |
|
370 |
|
|
371 |
// --------------------------------------------------------- |
|
372 |
// Creamos un workspace y lo abrimos. |
|
373 |
r = manager.initWorkspace(wsfile, repo, "Test add and commit",null); |
|
374 |
assertEquals("ws-init status", 0, r); |
|
375 |
|
|
376 |
VCSGisWorkspace ws1 = manager.openWorkspace(wsfile); |
|
377 |
utils().info_workspace(ws1); |
|
378 |
|
|
379 |
ws1.setUserIdentificationRequester(getIdentificationRequester("user1", "password")); |
|
380 |
|
|
381 |
// --------------------------------------------------------- |
|
382 |
// Adicionamos al workspace la tabla de pruebas y lo commitamos |
|
383 |
sourceTest = utils().openSourceStore2(); |
|
384 |
r = ws1.add("test", sourceTest, "text"); |
|
385 |
assertEquals("ws-add status", 0, r); |
|
386 |
|
|
387 |
r = ws1.commit(); |
|
388 |
assertEquals("ws-commit status", ERR_OK, r); |
|
389 |
|
|
390 |
enableAuthorizationByEntity(repo, "test"); |
|
391 |
|
|
392 |
// --------------------------------------------------------- |
|
393 |
// Comprobamos que tras el commit la tabla de cambios esta vacia. |
|
394 |
FeatureStore changesStore = ws1.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
395 |
assertEquals("Changes", 0, changesStore.size64()); |
|
396 |
|
|
397 |
DisposeUtils.disposeQuietly(changesStore); |
|
398 |
|
|
399 |
// --------------------------------------------------------- |
|
400 |
// Comprobamos que la tabla adicionada al espacio de trabajo contiene |
|
401 |
// los mismos registros que la original. |
|
402 |
FeatureStore dataStore = ((VCSGisRepositoryLocaldbImpl)repo).getFeatureStore(DataRepoTable.TABLE_NAME, true); |
|
403 |
assertEquals("DataStore", sourceTest.size64(), dataStore.size64()); |
|
404 |
|
|
405 |
sourceTest.dispose(); |
|
406 |
DisposeUtils.disposeQuietly(dataStore); |
|
407 |
|
|
408 |
|
|
409 |
// ------------------------------------------------------------ |
|
410 |
// Inicializamos el workspace2 asociandolo al mismo repositorio que |
|
411 |
// workspace1 y lo abrimos. |
|
412 |
r = manager.initWorkspace(ws2file, repo, "Test update2",null); |
|
413 |
assertEquals("init_ws2 status", ERR_NO_ERROR, r); |
|
414 |
VCSGisWorkspace ws2 = manager.openWorkspace(ws2file); |
|
415 |
utils().info_workspace(ws2); |
|
416 |
|
|
417 |
ws2.setUserIdentificationRequester(getIdentificationRequester("user2", "password")); |
|
418 |
|
|
419 |
// ------------------------------------------------------------ |
|
420 |
// Hacemos un checkout en workspace2 de la tabla "test" |
|
421 |
// y comprobamos que tiene lo que toca. |
|
422 |
r = ws2.checkout("test"); |
|
423 |
assertEquals("ws2-checkout status", ERR_NO_ERROR, r); |
|
424 |
|
|
425 |
VCSGisEntity entity = ws2.getWorkspaceEntityByName("test"); |
|
426 |
assertNotNull("ws2.update-1 entity", entity); |
|
427 |
assertEquals("ws2.update-1 label", "text", entity.getFieldForLabel()); |
|
428 |
|
|
429 |
store2 = ws2.openFeatureStore("test", true); |
|
430 |
assertEquals("ws2-checkout sizes", 3, store2.size64()); |
|
431 |
features = store2.getFeatures((Expression)null, "id", true); |
|
432 |
assertEquals(1 , features.get(0).getInt("id")); |
|
433 |
assertEquals("AAA", features.get(0).getString("text")); |
|
434 |
assertEquals(2 , features.get(1).getInt("id")); |
|
435 |
assertEquals("BBB", features.get(1).getString("text")); |
|
436 |
assertEquals(3 , features.get(2).getInt("id")); |
|
437 |
assertEquals("CCC", features.get(2).getString("text")); |
|
438 |
|
|
439 |
DisposeUtils.disposeQuietly(store2); |
|
440 |
|
|
441 |
|
|
442 |
// ------------------------------------------------------------ |
|
443 |
// Modificamos la tabla "test" en el workspace2, la commitamos y comprobamos que no hay permisos para hacerlo. |
|
444 |
sourceTest = ws2.openFeatureStore("test",false); |
|
445 |
sourceTest.edit(); |
|
446 |
f = sourceTest.findFirst("id=2"); |
|
447 |
ef = f.getEditable(); |
|
448 |
ef.set("text", "BB2"); |
|
449 |
sourceTest.update(ef); |
|
450 |
|
|
451 |
ef = sourceTest.createNewFeature(); |
|
452 |
ef.set("id",4); |
|
453 |
ef.set("text","DDD"); |
|
454 |
sourceTest.insert(ef); |
|
455 |
sourceTest.finishEditing(); |
|
456 |
DisposeUtils.disposeQuietly(sourceTest); |
|
457 |
r = ws2.commit(); |
|
458 |
assertEquals("ws2.commit-1 status", ERR_USER_NOT_AUTHORIZED, r); |
|
459 |
|
|
460 |
DisposeUtils.disposeQuietly(store2); |
|
461 |
|
|
462 |
} |
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
|
|
468 |
|
|
469 |
|
|
470 |
private void enableAuthentication(VCSGisRepository repo){ |
|
471 |
ConfigRepoTable varsTable = new ConfigRepoTable(); |
|
472 |
varsTable.set((VCSGisRepositoryLocaldbImpl) repo, "AUTHENTICATION", String.valueOf(true)); |
|
473 |
varsTable.set((VCSGisRepositoryLocaldbImpl) repo, "AUTHORIZATION", String.valueOf(true)); |
|
474 |
|
|
475 |
} |
|
476 |
|
|
477 |
private void addUser(VCSGisRepository repo, String userId, String password, String roles) { |
|
478 |
UsersRepoTable.UserRepoRow userRow = new UsersRepoTable.UserRepoRow((VCSGisRepositoryLocaldbImpl) repo); |
|
479 |
userRow.setIdentifier(userId); |
|
480 |
userRow.setPassword(password); |
|
481 |
userRow.setAllowedOperations(roles); |
|
482 |
userRow.insert(); |
|
483 |
} |
|
484 |
|
|
485 |
private void enableAuthorizationByEntity(VCSGisRepository repo, String entityName){ |
|
486 |
|
|
487 |
EntitiesRepoTable table = new EntitiesRepoTable(); |
|
488 |
EntitiesRepoTable.EntityRepoRow entityRow = table.getByEntityName((VCSGisRepositoryLocaldbImpl) repo, entityName); |
|
489 |
|
|
490 |
entityRow.setAuthorizations("{" |
|
491 |
+ " \"entities\": [ \"user1\", \"user2\"]," |
|
492 |
+ " \"commit\": [ \"user1\" ]," |
|
493 |
+ " \"update\": [ \"user1\", \"user2\"]," |
|
494 |
+ " \"checkout\": [ \"user1\", \"user2\"]," |
|
495 |
+ " \"history\": [ \"user1\" ],\n" |
|
496 |
+ " \"topologyplans\": [ \"user1\", \"user2\"]," |
|
497 |
+ " \"users\": [ \"user1\", \"user2\"]" |
|
498 |
+ "}"); |
|
499 |
|
|
500 |
|
|
501 |
entityRow.update(); |
|
502 |
|
|
503 |
} |
|
504 |
|
|
505 |
VCSGisUserIdentificationRequester getIdentificationRequester(String userId, String password) { |
|
506 |
return new VCSGisUserIdentificationRequester() { |
|
507 |
int retries = 0; |
|
508 |
@Override |
|
509 |
public boolean requestIdentification() { |
|
510 |
if(retries++ > 5){ |
|
511 |
return false; |
|
512 |
} |
|
513 |
return true; |
|
514 |
} |
|
515 |
|
|
516 |
@Override |
|
517 |
public String getUserId() { |
|
518 |
return userId; |
|
519 |
} |
|
520 |
|
|
521 |
@Override |
|
522 |
public String getPassword() { |
|
523 |
return password; |
|
524 |
} |
|
525 |
}; |
|
526 |
} |
|
527 |
|
|
528 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/AbstractTest07Checkout.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
import static junit.framework.TestCase.assertEquals; |
|
6 |
import org.apache.commons.io.FileUtils; |
|
7 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
8 |
import org.gvsig.fmap.dal.feature.Feature; |
|
9 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
10 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
11 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
12 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
13 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
14 |
import org.gvsig.vcsgis.lib.SequentialCodeGenerator; |
|
15 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
|
16 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
17 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
18 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_ENTITY_ALREADY_EXISTS; |
|
19 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
|
20 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_NEW; |
|
21 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
22 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
23 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
24 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable; |
|
25 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable; |
|
26 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_UNMODIFIED; |
|
27 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable; |
|
28 |
|
|
29 |
@SuppressWarnings("UseSpecificCatch") |
|
30 |
public abstract class AbstractTest07Checkout extends AbstractTestVCSGIS { |
|
31 |
|
|
32 |
public AbstractTest07Checkout(String testName) { |
|
33 |
super(testName); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
protected void setUp() throws Exception { |
|
38 |
super.setUp(); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void tearDown() throws Exception { |
|
43 |
super.tearDown(); |
|
44 |
} |
|
45 |
|
|
46 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
47 |
// public void testHello() {} |
|
48 |
protected void testCheckout() throws Exception { |
|
49 |
try { |
|
50 |
utils().cleanRepositoryDatabase(); |
|
51 |
|
|
52 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
53 |
manager.setCodeGenerator(new SequentialCodeGenerator()); |
|
54 |
|
|
55 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-checkout"); |
|
56 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs", "ws-addcheckout1")); |
|
57 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs", "ws-addcheckout2")); |
|
58 |
|
|
59 |
int r = manager.initRepository(server.getParameters(), null); |
|
60 |
assertEquals("vcsgisadmin.init status", ERR_NO_ERROR, r); |
|
61 |
|
|
62 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
63 |
utils().info_repository(repo); |
|
64 |
|
|
65 |
r = manager.initWorkspace(ws1file, repo, "Test checkout1", null); |
|
66 |
assertEquals("vcsgis.init_workspace1 status", ERR_NO_ERROR, r); |
|
67 |
|
|
68 |
VCSGisWorkspace ws1 = manager.openWorkspace(ws1file); |
|
69 |
assertNotNull("vcsgis.open_workspace1 status", ws1); |
|
70 |
utils().info_workspace(ws1); |
|
71 |
|
|
72 |
FeatureStore store1 = utils().openSourceStore1(); |
|
73 |
ws1.add("sourceStore1", store1, "ID"); |
|
74 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
|
75 |
|
|
76 |
VCSGisWorkspaceEntity entity = ws1.getWorkspaceEntityByName("sourceStore1"); |
|
77 |
assertEquals("State must be new", STATE_LOCAL_NEW, entity.getState()); |
|
78 |
|
|
79 |
ws1.commit(); |
|
80 |
assertEquals("ws1.commit status", ERR_NO_ERROR, r); |
|
81 |
|
|
82 |
entity = ws1.getWorkspaceEntityByName("sourceStore1"); |
|
83 |
assertEquals("State must be new", STATE_LOCAL_UNMODIFIED, entity.getState()); |
|
84 |
|
|
85 |
entities_setResources(server, "sourceStore1", "sourceStore1_res"); |
|
86 |
|
|
87 |
r = manager.initWorkspace(ws2file, repo, "Test checkout2", null); |
|
88 |
assertEquals("vcsgis.init_workspace2 status", ERR_NO_ERROR, r); |
|
89 |
VCSGisWorkspace ws2 = manager.openWorkspace(ws2file); |
|
90 |
assertNotNull("vcsgis.open_workspace2 status", ws2); |
|
91 |
utils().info_workspace(ws2); |
|
92 |
|
|
93 |
r = ws2.checkout("sourceStore1"); |
|
94 |
assertEquals("ws2-checkout status", ERR_NO_ERROR, r); |
|
95 |
|
|
96 |
VCSGisWorkspaceEntity ent = ws2.getWorkspaceEntityByName("sourceStore1"); |
|
97 |
assertEquals("ws2-checkout entity resources", "sourceStore1_res", ent.getResources()); |
|
98 |
assertEquals("State must be new", STATE_LOCAL_UNMODIFIED, ent.getState()); |
|
99 |
|
|
100 |
EntitiesTable.EntityRow entityRow = new EntitiesTable().getByEntityName(ws2, "sourceStore1"); |
|
101 |
assertEquals("ws2-checkout entityState", STATE_LOCAL_UNMODIFIED, entityRow.getState()); |
|
102 |
|
|
103 |
FeatureStore changesStore = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
104 |
assertEquals("ws2-checkout changesTable", 0L, changesStore.size64()); |
|
105 |
changesStore.dispose(); |
|
106 |
|
|
107 |
FeatureStore store2 = ws2.getFeatureStore("sourceStore1"); |
|
108 |
assertEquals("ws2-checkout sizes", store1.size64(), store2.size64()); |
|
109 |
|
|
110 |
DisposeUtils.disposeQuietly(store2); |
|
111 |
DisposeUtils.disposeQuietly(store1); |
|
112 |
|
|
113 |
ws1.dispose(); |
|
114 |
ws2.dispose(); |
|
115 |
|
|
116 |
repo.dispose(); |
|
117 |
server.dispose(); |
|
118 |
manager.clean(); |
|
119 |
} catch (Throwable th) { |
|
120 |
LOGGER.warn("", th); |
|
121 |
throw th; |
|
122 |
} |
|
123 |
} |
|
124 |
|
|
125 |
protected void testCheckout2() throws Exception { |
|
126 |
try { |
|
127 |
utils().cleanRepositoryDatabase(); |
|
128 |
|
|
129 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
130 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-checkout"); |
|
131 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs", "ws-addcheckout1")); |
|
132 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs", "ws-addcheckout2")); |
|
133 |
|
|
134 |
int r = manager.initRepository(server.getParameters(), null); |
|
135 |
assertEquals("vcsgisadmin.init status", ERR_NO_ERROR, r); |
|
136 |
|
|
137 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
138 |
utils().info_repository(repo); |
|
139 |
|
|
140 |
r = manager.initWorkspace(ws1file, repo, "Test checkout1", null); |
|
141 |
assertEquals("vcsgis.init_workspace1 status", ERR_NO_ERROR, r); |
|
142 |
|
|
143 |
VCSGisWorkspace ws1 = manager.openWorkspace(ws1file); |
|
144 |
assertNotNull("vcsgis.open_workspace1 status", ws1); |
|
145 |
utils().info_workspace(ws1); |
|
146 |
|
|
147 |
FeatureStore store1 = utils().openSourceStore1(); |
|
148 |
r = ws1.add("sourceStore1", store1, "ID"); |
|
149 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
|
150 |
|
|
151 |
FeatureStore store2 = utils().openSourceStore2(); |
|
152 |
r = ws1.add("sourceStore2", store2, "ID"); |
|
153 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
|
154 |
|
|
155 |
r = ws1.commit(); |
|
156 |
assertEquals("ws1.commit status", ERR_NO_ERROR, r); |
|
157 |
|
|
158 |
r = manager.initWorkspace(ws2file, repo, "Test checkout2", null); |
|
159 |
assertEquals("vcsgis.init_workspace2 status", ERR_NO_ERROR, r); |
|
160 |
VCSGisWorkspace ws2 = manager.openWorkspace(ws2file); |
|
161 |
assertNotNull("vcsgis.open_workspace2 status", ws2); |
|
162 |
utils().info_workspace(ws2); |
|
163 |
|
|
164 |
List<VCSGisEntity> repoEntities = ws2.getRepositoryEntities(); |
|
165 |
assertEquals("ws2-checkout repoEntities size", 2, repoEntities.size()); |
|
166 |
|
|
167 |
List<VCSGisWorkspaceEntity> wsEntities = ws2.getWorkspaceEntities(); |
|
168 |
assertEquals("ws2-checkout wsEntities size0", 0, wsEntities.size()); |
|
169 |
|
|
170 |
r = ws2.checkout("sourceStore1"); |
|
171 |
assertEquals("ws2-checkout status", ERR_NO_ERROR, r); |
|
172 |
|
|
173 |
r = ws2.checkout("sourceStore1"); |
|
174 |
assertEquals("ws2-checkout status", ERR_ENTITY_ALREADY_EXISTS, r); |
|
175 |
|
|
176 |
wsEntities = ws2.getWorkspaceEntities(); |
|
177 |
assertEquals("ws2-checkout wsEntities size1", 1, wsEntities.size()); |
|
178 |
|
|
179 |
FeatureStore store3 = ws2.getFeatureStore("sourceStore1"); |
|
180 |
assertEquals("ws2-checkout sizes", store1.size64(), store3.size64()); |
|
181 |
|
|
182 |
DisposeUtils.disposeQuietly(store3); |
|
183 |
DisposeUtils.disposeQuietly(store2); |
|
184 |
DisposeUtils.disposeQuietly(store1); |
|
185 |
|
|
186 |
ws1.dispose(); |
|
187 |
ws2.dispose(); |
|
188 |
|
|
189 |
repo.dispose(); |
|
190 |
server.dispose(); |
|
191 |
manager.clean(); |
|
192 |
} catch (Throwable th) { |
|
193 |
LOGGER.warn("", th); |
|
194 |
throw th; |
|
195 |
} |
|
196 |
} |
|
197 |
|
|
198 |
public static void entities_setResources(JDBCServerExplorer server, String tableName, String resource) throws Exception { |
|
199 |
JDBCStoreParameters entitiesOpenParameters = server.get(EntitiesRepoTable.TABLE_NAME); |
|
200 |
FeatureStore store = (FeatureStore) server.open(entitiesOpenParameters); |
|
201 |
store.edit(); |
|
202 |
Feature f = store.findFirst("\"" + EntitiesRepoTable.ENTITY_NAME + "\" = '" + tableName + "'"); |
|
203 |
EditableFeature ef = f.getEditable(); |
|
204 |
ef.set(EntitiesRepoTable.RESOURCES, resource); |
|
205 |
store.update(ef); |
|
206 |
store.finishEditing(); |
|
207 |
store.dispose(); |
|
208 |
} |
|
209 |
|
|
210 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/AbstractTest02Initws.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.Collections; |
|
5 |
import java.util.Comparator; |
|
6 |
import java.util.HashSet; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Map; |
|
9 |
import java.util.Set; |
|
10 |
import static junit.framework.TestCase.assertEquals; |
|
11 |
import org.apache.commons.io.FileUtils; |
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.gvsig.fmap.dal.DALLocator; |
|
14 |
import org.gvsig.fmap.dal.DataManager; |
|
15 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
16 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION_NAME; |
|
17 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_REPOSITORY_NAME; |
|
18 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES_NAME; |
|
19 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
20 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
21 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
22 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
23 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
24 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
25 |
import org.gvsig.tools.util.MapBuilder; |
|
26 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
27 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
28 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
29 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
30 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable; |
|
31 |
import org.gvsig.vcsgis.lib.workspace.tables.LocalRevisionsTable; |
|
32 |
import org.gvsig.vcsgis.lib.workspace.tables.RemoteChangesTable; |
|
33 |
import org.gvsig.vcsgis.lib.workspace.tables.TopologyplanTable; |
|
34 |
import org.gvsig.vcsgis.lib.workspace.tables.UsersTable; |
|
35 |
import org.gvsig.vcsgis.lib.workspace.tables.VarsTable; |
|
36 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable; |
|
37 |
|
|
38 |
public abstract class AbstractTest02Initws extends AbstractTestVCSGIS { |
|
39 |
|
|
40 |
public AbstractTest02Initws(String testName) { |
|
41 |
super(testName); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
protected void setUp() throws Exception { |
|
46 |
super.setUp(); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
protected void tearDown() throws Exception { |
|
51 |
super.tearDown(); |
|
52 |
} |
|
53 |
|
|
54 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
55 |
// public void testHello() {} |
|
56 |
|
|
57 |
protected void testCreateWS() throws Exception { |
|
58 |
utils().cleanRepositoryDatabase(); |
|
59 |
|
|
60 |
String testid = "initws"; |
|
61 |
VCSGisManager vcsgismanager = VCSGisLocator.getVCSGisManager(); |
|
62 |
|
|
63 |
JDBCServerExplorerParameters server = utils().getRepositoryServerExplorerParameters("srv-"+testid); |
|
64 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs","ws-"+testid)); |
|
65 |
|
|
66 |
int r = vcsgismanager.initRepository(server, null); |
|
67 |
assertEquals("initRepository status", 0, r); |
|
68 |
|
|
69 |
utils().info_repository(server); |
|
70 |
assertTrue("repository isRepository", vcsgismanager.isRepository(server)); |
|
71 |
VCSGisRepository repo = vcsgismanager.openRepository(server); |
|
72 |
|
|
73 |
r = vcsgismanager.initWorkspace(wsfile, repo, "Test initws", null); |
|
74 |
assertEquals("initWorkspace ws status", 0, r); |
|
75 |
utils().info_workspace(wsfile); |
|
76 |
|
|
77 |
VCSGisWorkspace workspace = vcsgismanager.openWorkspace(wsfile); |
|
78 |
assertNotNull("Can't open workspace", workspace); |
|
79 |
assertTrue("workspace isWorkspace", vcsgismanager.isWorkspace(workspace.getExplorerParameters())); |
|
80 |
assertFalse("workspace isRepository", vcsgismanager.isRepository(workspace.getExplorerParameters())); |
|
81 |
|
|
82 |
|
|
83 |
JDBCServerExplorer wsexplorer = utils().openWorkspaceServerExplorer(wsfile); |
|
84 |
List<DataStoreParameters> tables = wsexplorer.list(); |
|
85 |
Collections.sort(tables, new Comparator<DataStoreParameters>() { |
|
86 |
@Override |
|
87 |
public int compare(DataStoreParameters o1, DataStoreParameters o2) { |
|
88 |
return StringUtils.compare( |
|
89 |
((JDBCStoreParameters) o1).getTable(), |
|
90 |
((JDBCStoreParameters) o2).getTable() |
|
91 |
); |
|
92 |
} |
|
93 |
}); |
|
94 |
Map<String, FeatureType> expectedTables = new MapBuilder<>() |
|
95 |
.add(WorkspaceChangesTable.TABLE_NAME,WorkspaceChangesTable.featureType()) |
|
96 |
.add(VarsTable.TABLE_NAME,VarsTable.featureType()) |
|
97 |
.add(EntitiesTable.TABLE_NAME,EntitiesTable.featureType()) |
|
98 |
.add(RemoteChangesTable.TABLE_NAME,RemoteChangesTable.featureType()) |
|
99 |
.add(LocalRevisionsTable.TABLE_NAME,LocalRevisionsTable.featureType()) |
|
100 |
.add(UsersTable.TABLE_NAME,UsersTable.featureType()) |
|
101 |
.add(TopologyplanTable.TABLE_NAME,TopologyplanTable.featureType()) |
|
102 |
.add(TABLE_CONFIGURATION_NAME,null) |
|
103 |
.add(TABLE_REPOSITORY_NAME,null) |
|
104 |
.add(TABLE_RESOURCES_NAME,null) |
|
105 |
.build(); |
|
106 |
|
|
107 |
Set<String>foundTableNames = new HashSet<>(); |
|
108 |
for (DataStoreParameters table : tables) { |
|
109 |
JDBCStoreParameters params = (JDBCStoreParameters) table; |
|
110 |
String tableName = params.getTable(); |
|
111 |
if (!tableName.startsWith("VCSGIS_") && !tableName.startsWith("GVSIGD_")) { |
|
112 |
continue; |
|
113 |
} |
|
114 |
assertTrue(expectedTables.containsKey(tableName)); |
|
115 |
foundTableNames.add(tableName); |
|
116 |
} |
|
117 |
for (String tableName : expectedTables.keySet()) { |
|
118 |
assertTrue(foundTableNames.contains(tableName)); |
|
119 |
} |
|
120 |
|
|
121 |
DataManager dataManager = DALLocator.getDataManager(); |
|
122 |
for (DataStoreParameters tableParams : tables) { |
|
123 |
JDBCStoreParameters params = (JDBCStoreParameters) tableParams; |
|
124 |
String tableName = params.getTable(); |
|
125 |
if (!tableName.startsWith("VCSGIS_") && !tableName.startsWith("GVSIGD_")) { |
|
126 |
continue; |
|
127 |
} |
|
128 |
FeatureStore store = (FeatureStore) dataManager.openStore(params.getProviderName(), params); |
|
129 |
FeatureType expectedFeatureType = expectedTables.get(tableName); |
|
130 |
if( expectedFeatureType!=null ) { |
|
131 |
FeatureType ft = store.getDefaultFeatureTypeQuietly(); |
|
132 |
for (FeatureAttributeDescriptor expectedAttr : expectedFeatureType) { |
|
133 |
FeatureAttributeDescriptor attr = ft.getAttributeDescriptor(expectedAttr.getName()); |
|
134 |
assertNotNull("Attr "+expectedAttr.getName(), attr); |
|
135 |
assertEquals("Attr "+expectedAttr.getName()+" type", expectedAttr.getType(), attr.getType()); |
|
136 |
assertEquals("Attr "+expectedAttr.getName()+" size", expectedAttr.getSize(), attr.getSize()); |
|
137 |
assertEquals("Attr "+expectedAttr.getName()+" isPrimaryKey", expectedAttr.isPrimaryKey(), attr.isPrimaryKey()); |
|
138 |
assertEquals("Attr "+expectedAttr.getName()+" isIndexed", expectedAttr.isIndexed(), attr.isIndexed()); |
|
139 |
assertEquals("Attr "+expectedAttr.getName()+" allowIndexDuplicateds", expectedAttr.allowIndexDuplicateds(), attr.allowIndexDuplicateds()); |
|
140 |
assertEquals("Attr "+expectedAttr.getName()+" isReadOnly", expectedAttr.isReadOnly(), attr.isReadOnly()); |
|
141 |
assertEquals("Attr "+expectedAttr.getName()+" DefaultValue", expectedAttr.getDefaultValue(), attr.getDefaultValue()); |
|
142 |
} |
|
143 |
} |
|
144 |
store.dispose(); |
|
145 |
} |
|
146 |
repo.dispose(); |
|
147 |
workspace.dispose(); |
|
148 |
wsexplorer.dispose(); |
|
149 |
vcsgismanager.clean(); |
|
150 |
} |
|
151 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/AbstractTest18Revert.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import static junit.framework.TestCase.assertEquals; |
|
5 |
import org.apache.commons.io.FileUtils; |
|
6 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
7 |
import org.gvsig.fmap.dal.feature.Feature; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
9 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
10 |
import org.gvsig.vcsgis.lib.SequentialCodeGenerator; |
|
11 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
12 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
13 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
|
14 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_DELETE; |
|
15 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_INSERT; |
|
16 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_UPDATE; |
|
17 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_MODIFIED; |
|
18 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_UNMODIFIED; |
|
19 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
20 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
21 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
22 |
|
|
23 |
public abstract class AbstractTest18Revert extends AbstractTestVCSGIS { |
|
24 |
|
|
25 |
public AbstractTest18Revert(String testName) { |
|
26 |
super(testName); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
protected void setUp() throws Exception { |
|
31 |
super.setUp(); |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
protected void tearDown() throws Exception { |
|
36 |
super.tearDown(); |
|
37 |
} |
|
38 |
|
|
39 |
private void check(FeatureStore store2, String relatedFeatureCode, int id, String text) throws Exception { |
|
40 |
Feature f = store2.findFirst("VCSGISCODE = '"+relatedFeatureCode+"'"); |
|
41 |
assertEquals(id, f.getInt("id")); |
|
42 |
assertEquals(text, f.getString("text")); |
|
43 |
} |
|
44 |
|
|
45 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
46 |
// public void testHello() {} |
|
47 |
|
|
48 |
protected void testRevert() throws Exception { |
|
49 |
utils().cleanRepositoryDatabase(); |
|
50 |
|
|
51 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-updatelocalmodified"); |
|
52 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs","ws1-updatelocalmodified")); |
|
53 |
|
|
54 |
|
|
55 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
56 |
manager.setCodeGenerator(new SequentialCodeGenerator()); |
|
57 |
|
|
58 |
int r; |
|
59 |
Feature f; |
|
60 |
EditableFeature ef; |
|
61 |
VCSGisWorkspaceEntity entity; |
|
62 |
|
|
63 |
// ------------------------------------------------------------ |
|
64 |
// Inicializamos el repositorio y lo abrimos |
|
65 |
r = manager.initRepository(server.getParameters(), null); |
|
66 |
assertEquals("init_server status", ERR_NO_ERROR, r); |
|
67 |
|
|
68 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
69 |
utils().info_repository(repo); |
|
70 |
|
|
71 |
// ------------------------------------------------------------ |
|
72 |
// Creamos workspace1 y lo abrimos. |
|
73 |
r = manager.initWorkspace(ws1file, repo, "ws1: Test update local modified", null); |
|
74 |
assertEquals("init_ws1 status", ERR_NO_ERROR, r); |
|
75 |
|
|
76 |
VCSGisWorkspace ws1 = manager.openWorkspace(ws1file); |
|
77 |
utils().info_workspace(ws1); |
|
78 |
|
|
79 |
// ------------------------------------------------------------ |
|
80 |
// Adicionamos al workspace1 la tabla "test" y la commitamos. |
|
81 |
utils().test_add(ws1); |
|
82 |
utils().test_commit(ws1); |
|
83 |
|
|
84 |
// ------------------------------------------------------------ |
|
85 |
// Modificamos la tabla "test" en el workspace1 y la commitamos. |
|
86 |
utils().test_modify( ws1, |
|
87 |
"update", 2, "BB2", |
|
88 |
"delete", 3, "CCC", |
|
89 |
"insert", 4, "DDD" |
|
90 |
); |
|
91 |
entity = ws1.getWorkspaceEntityByName("test"); |
|
92 |
assertEquals("State must be local modified", STATE_LOCAL_MODIFIED, entity.getState()); |
|
93 |
|
|
94 |
// Comprobamos que en el workspace1 hay lo que toca |
|
95 |
utils().test_checkall(ws1, |
|
96 |
1, "AAA", |
|
97 |
2, "BB2", |
|
98 |
4, "DDD" |
|
99 |
); |
|
100 |
|
|
101 |
// Comprobamos los cambios locales |
|
102 |
utils().test_checklocalchanges(ws1, |
|
103 |
OP_UPDATE, 2, "BB2", |
|
104 |
OP_DELETE, 3, "CCC", |
|
105 |
OP_INSERT, 4, "DDD" |
|
106 |
); |
|
107 |
|
|
108 |
ws1.revert("test", null); |
|
109 |
entity = ws1.getWorkspaceEntityByName("test"); |
|
110 |
assertEquals("State must be unmodified", STATE_LOCAL_UNMODIFIED, entity.getState()); |
|
111 |
|
|
112 |
// Comprobamos que en el workspace1 se han recuperado los valores previos |
|
113 |
utils().test_checkall(ws1, |
|
114 |
1, "AAA", |
|
115 |
2, "BBB", |
|
116 |
3, "CCC" |
|
117 |
); |
|
118 |
|
|
119 |
// Comprobamos que se han eliminado los cambios locales |
|
120 |
utils().test_checklocalchanges(ws1); //No local changes |
|
121 |
|
|
122 |
} |
|
123 |
|
|
124 |
protected void testRevert2() throws Exception { |
|
125 |
utils().cleanRepositoryDatabase(); |
|
126 |
|
|
127 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-updatelocalmodified"); |
|
128 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs","ws1-updatelocalmodified")); |
|
129 |
|
|
130 |
|
|
131 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
132 |
manager.setCodeGenerator(new SequentialCodeGenerator()); |
|
133 |
|
|
134 |
int r; |
|
135 |
Feature f; |
|
136 |
EditableFeature ef; |
|
137 |
|
|
138 |
// ------------------------------------------------------------ |
|
139 |
// Inicializamos el repositorio y lo abrimos |
|
140 |
r = manager.initRepository(server.getParameters(), null); |
|
141 |
assertEquals("init_server status", ERR_NO_ERROR, r); |
|
142 |
|
|
143 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
144 |
utils().info_repository(repo); |
|
145 |
|
|
146 |
// ------------------------------------------------------------ |
|
147 |
// Creamos workspace1 y lo abrimos. |
|
148 |
r = manager.initWorkspace(ws1file, repo, "ws1: Test update local modified", null); |
|
149 |
assertEquals("init_ws1 status", ERR_NO_ERROR, r); |
|
150 |
|
|
151 |
VCSGisWorkspace ws1 = manager.openWorkspace(ws1file); |
|
152 |
utils().info_workspace(ws1); |
|
153 |
|
|
154 |
// ------------------------------------------------------------ |
|
155 |
// Adicionamos al workspace1 la tabla "test" y la commitamos. |
|
156 |
utils().test_add(ws1); |
|
157 |
utils().test_commit(ws1); |
|
158 |
|
|
159 |
// ------------------------------------------------------------ |
|
160 |
// Modificamos la tabla "test" en el workspace1 y la commitamos. |
|
161 |
utils().test_modify( ws1, |
|
162 |
"update", 2, "BB2", |
|
163 |
"delete", 3, "CCC", |
|
164 |
"insert", 4, "DDD" |
|
165 |
); |
|
166 |
|
|
167 |
// Comprobamos que en el workspace1 hay lo que toca |
|
168 |
utils().test_checkall(ws1, |
|
169 |
1, "AAA", |
|
170 |
2, "BB2", |
|
171 |
4, "DDD" |
|
172 |
); |
|
173 |
|
|
174 |
// Comprobamos los cambios locales |
|
175 |
utils().test_checklocalchanges(ws1, |
|
176 |
OP_UPDATE, 2, "BB2", |
|
177 |
OP_DELETE, 3, "CCC", |
|
178 |
OP_INSERT, 4, "DDD" |
|
179 |
); |
|
180 |
|
|
181 |
utils().test_modify( ws1, |
|
182 |
"update", 2, "BB3", |
|
183 |
"update", 4, "DD2" |
|
184 |
); |
|
185 |
|
|
186 |
// Comprobamos que en el workspace1 hay lo que toca |
|
187 |
utils().test_checkall(ws1, |
|
188 |
1, "AAA", |
|
189 |
2, "BB3", |
|
190 |
4, "DD2" |
|
191 |
); |
|
192 |
|
|
193 |
// Comprobamos los cambios locales |
|
194 |
utils().test_checklocalchanges(ws1, |
|
195 |
OP_UPDATE, 2, "BB3", |
|
196 |
OP_DELETE, 3, "CCC", |
|
197 |
OP_INSERT, 4, "DD2" |
|
198 |
); |
|
199 |
|
|
200 |
utils().test_modify( ws1, |
|
201 |
"update", 2, "BB4", |
|
202 |
"update", 4, "DD3" |
|
203 |
); |
|
204 |
|
|
205 |
// Comprobamos que en el workspace1 hay lo que toca |
|
206 |
utils().test_checkall(ws1, |
|
207 |
1, "AAA", |
|
208 |
2, "BB4", |
|
209 |
4, "DD3" |
|
210 |
); |
|
211 |
|
|
212 |
// Comprobamos los cambios locales |
|
213 |
utils().test_checklocalchanges(ws1, |
|
214 |
OP_UPDATE, 2, "BB4", |
|
215 |
OP_DELETE, 3, "CCC", |
|
216 |
OP_INSERT, 4, "DD3" |
|
217 |
); |
|
218 |
|
|
219 |
ws1.revert("test", null); |
|
220 |
|
|
221 |
// Comprobamos que en el workspace1 se han recuperado los valores previos |
|
222 |
utils().test_checkall(ws1, |
|
223 |
1, "AAA", |
|
224 |
2, "BBB", |
|
225 |
3, "CCC" |
|
226 |
); |
|
227 |
|
|
228 |
// Comprobamos que se han eliminado los cambios locales |
|
229 |
utils().test_checklocalchanges(ws1); //No local changes |
|
230 |
|
|
231 |
} |
|
232 |
|
|
233 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/AbstractTest17Geom1.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
import static junit.framework.TestCase.assertEquals; |
|
6 |
import org.apache.commons.io.FileUtils; |
|
7 |
import org.gvsig.fmap.dal.feature.Feature; |
|
8 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
9 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
10 |
import org.gvsig.fmap.geom.Geometry; |
|
11 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
12 |
import org.gvsig.vcsgis.lib.SequentialCodeGenerator; |
|
13 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
14 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
15 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
|
16 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_NEW; |
|
17 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
18 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
19 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
20 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable; |
|
21 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable; |
|
22 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_UNMODIFIED; |
|
23 |
|
|
24 |
@SuppressWarnings("UseSpecificCatch") |
|
25 |
public abstract class AbstractTest17Geom1 extends AbstractTestVCSGIS { |
|
26 |
|
|
27 |
public AbstractTest17Geom1(String testName) { |
|
28 |
super(testName); |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
protected void setUp() throws Exception { |
|
33 |
super.setUp(); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
protected void tearDown() throws Exception { |
|
38 |
super.tearDown(); |
|
39 |
} |
|
40 |
|
|
41 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
42 |
// public void testHello() {} |
|
43 |
protected void testGeom1() throws Exception { |
|
44 |
try { |
|
45 |
utils().cleanRepositoryDatabase(); |
|
46 |
|
|
47 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
|
48 |
manager.setCodeGenerator(new SequentialCodeGenerator()); |
|
49 |
|
|
50 |
JDBCServerExplorer server = utils().openRepositoryServerExplorer("srv-geom1"); |
|
51 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs", "ws-geom1_1")); |
|
52 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs", "ws-geom1_2")); |
|
53 |
|
|
54 |
int r = manager.initRepository(server.getParameters(), null); |
|
55 |
assertEquals("vcsgisadmin.init status", ERR_NO_ERROR, r); |
|
56 |
|
|
57 |
VCSGisRepository repo = manager.openRepository(server.getParameters()); |
|
58 |
utils().info_repository(repo); |
|
59 |
|
|
60 |
r = manager.initWorkspace(ws1file, repo, "Test geom1 A", null); |
|
61 |
assertEquals("vcsgis.init_workspace1 status", ERR_NO_ERROR, r); |
|
62 |
|
|
63 |
VCSGisWorkspace ws1 = manager.openWorkspace(ws1file); |
|
64 |
assertNotNull("vcsgis.open_workspace1 status", ws1); |
|
65 |
utils().info_workspace(ws1); |
|
66 |
|
|
67 |
FeatureStore store1 = utils().openGeom1Store(); |
|
68 |
ws1.add("Geom1Store", store1, "PRO_NAME"); |
|
69 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
|
70 |
|
|
71 |
VCSGisWorkspaceEntity entity = ws1.getWorkspaceEntityByName("Geom1Store"); |
|
72 |
assertEquals("State must be new", STATE_LOCAL_NEW, entity.getState()); |
|
73 |
|
|
74 |
ws1.commit(); |
|
75 |
assertEquals("ws1.commit status", ERR_NO_ERROR, r); |
|
76 |
|
|
77 |
entity = ws1.getWorkspaceEntityByName("Geom1Store"); |
|
78 |
assertEquals("State must be new", STATE_LOCAL_UNMODIFIED, entity.getState()); |
|
79 |
|
|
80 |
r = manager.initWorkspace(ws2file, repo, "Test geom1 B", null); |
|
81 |
assertEquals("vcsgis.init_workspace2 status", ERR_NO_ERROR, r); |
|
82 |
VCSGisWorkspace ws2 = manager.openWorkspace(ws2file); |
|
83 |
assertNotNull("vcsgis.open_workspace2 status", ws2); |
|
84 |
utils().info_workspace(ws2); |
|
85 |
|
|
86 |
r = ws2.checkout("Geom1Store"); |
|
87 |
assertEquals("ws2-geom1 status", ERR_NO_ERROR, r); |
|
88 |
|
|
89 |
VCSGisWorkspaceEntity ent = ws2.getWorkspaceEntityByName("Geom1Store"); |
|
90 |
assertEquals("State must be new", STATE_LOCAL_UNMODIFIED, ent.getState()); |
|
91 |
|
|
92 |
EntitiesTable.EntityRow entityRow = new EntitiesTable().getByEntityName(ws2, "Geom1Store"); |
|
93 |
assertEquals("ws2-geom1 entityState", STATE_LOCAL_UNMODIFIED, entityRow.getState()); |
|
94 |
|
|
95 |
FeatureStore changesStore = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
96 |
assertEquals("ws2-geom1 changesTable", 0L, changesStore.size64()); |
|
97 |
|
|
98 |
FeatureStore store2 = ws2.getFeatureStore("Geom1Store"); |
|
99 |
assertEquals("ws2-geom1 sizes", store1.size64(), store2.size64()); |
|
100 |
List<Feature> features1 = store1.getFeatures(); |
|
101 |
List<Feature> features2 = store2.getFeatures(); |
|
102 |
for (int i = 0; i < features1.size(); i++) { |
|
103 |
Geometry g1 = features1.get(i).getDefaultGeometry(); |
|
104 |
Geometry g2 = features2.get(i).getDefaultGeometry(); |
|
105 |
assertEquals("ws2-geom1 check geometries "+i, g1.convertToHexWKB(), g2.convertToHexWKB()); |
|
106 |
} |
|
107 |
|
|
108 |
DisposeUtils.disposeQuietly(store2); |
|
109 |
DisposeUtils.disposeQuietly(store1); |
|
110 |
} catch (Throwable th) { |
|
111 |
LOGGER.warn("", th); |
|
112 |
throw th; |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test04AddEntity.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest04AddEntity; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test04AddEntity extends AbstractTest04AddEntity { |
|
7 |
|
|
8 |
private TestUtilsH2Spatial utils; |
|
9 |
|
|
10 |
public Test04AddEntity(String testName) { |
|
11 |
super(testName); |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void setUp() throws Exception { |
|
16 |
super.setUp(); //To change body of generated methods, choose Tools | Templates. |
|
17 |
this.utils = new TestUtilsH2Spatial(); |
|
18 |
} |
|
19 |
|
|
20 |
|
|
21 |
@Override |
|
22 |
protected AbstractTestUtils utils() { |
|
23 |
return this.utils; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public void testAdd_entity1() throws Exception { |
|
28 |
super.testAdd_entity1(); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test08Update.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest08Update; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test08Update extends AbstractTest08Update { |
|
7 |
|
|
8 |
private TestUtilsH2Spatial utils; |
|
9 |
|
|
10 |
public Test08Update(String testName) { |
|
11 |
super(testName); |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void setUp() throws Exception { |
|
16 |
super.setUp(); //To change body of generated methods, choose Tools | Templates. |
|
17 |
this.utils = new TestUtilsH2Spatial(); |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
protected AbstractTestUtils utils() { |
|
22 |
return this.utils; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void testUpdate1() throws Exception { |
|
27 |
super.testUpdate1(); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public void testUpdate2() throws Exception { |
|
32 |
super.testUpdate2(); |
|
33 |
} |
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test01InitRepo.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest01InitRepo; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test01InitRepo extends AbstractTest01InitRepo { |
|
7 |
|
|
8 |
private TestUtilsH2Spatial utils; |
|
9 |
|
|
10 |
public Test01InitRepo(String testName) { |
|
11 |
super(testName); |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void setUp() throws Exception { |
|
16 |
super.setUp(); //To change body of generated methods, choose Tools | Templates. |
|
17 |
this.utils = new TestUtilsH2Spatial(); |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
protected AbstractTestUtils utils() { |
|
22 |
return this.utils; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void testInit1() throws Exception { |
|
27 |
super.testInit1(); |
|
28 |
} |
|
29 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test12Commit.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest12Commit; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test12Commit extends AbstractTest12Commit { |
|
7 |
|
|
8 |
private TestUtilsH2Spatial utils; |
|
9 |
|
|
10 |
public Test12Commit(String testName) { |
|
11 |
super(testName); |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void setUp() throws Exception { |
|
16 |
super.setUp(); //To change body of generated methods, choose Tools | Templates. |
|
17 |
this.utils = new TestUtilsH2Spatial(); |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
protected AbstractTestUtils utils() { |
|
22 |
return this.utils; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void testCommit() throws Exception { |
|
27 |
super.testCommit(); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public void testCommit700changes() throws Exception { |
|
32 |
super.testCommit700changes(); |
|
33 |
} |
|
34 |
|
|
35 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test09CommitOutdated.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest09CommitOutdated; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test09CommitOutdated extends AbstractTest09CommitOutdated { |
|
7 |
|
|
8 |
private TestUtilsH2Spatial utils; |
|
9 |
|
|
10 |
public Test09CommitOutdated(String testName) { |
|
11 |
super(testName); |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void setUp() throws Exception { |
|
16 |
super.setUp(); //To change body of generated methods, choose Tools | Templates. |
|
17 |
this.utils = new TestUtilsH2Spatial(); |
|
18 |
} |
|
19 |
|
|
20 |
@Override |
|
21 |
protected AbstractTestUtils utils() { |
|
22 |
return this.utils; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void testCommitOutdated() throws Exception { |
|
27 |
super.testCommitOutdated(); |
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test05Add.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest05Add; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test05Add extends AbstractTest05Add { |
|
7 |
|
|
8 |
private TestUtilsH2Spatial utils; |
|
9 |
|
|
10 |
public Test05Add(String testName) { |
|
11 |
super(testName); |
|
12 |
} |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void setUp() throws Exception { |
|
16 |
super.setUp(); //To change body of generated methods, choose Tools | Templates. |
|
17 |
this.utils = new TestUtilsH2Spatial(); |
|
18 |
} |
|
19 |
|
|
20 |
|
|
21 |
@Override |
|
22 |
protected AbstractTestUtils utils() { |
|
23 |
return this.utils; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public void testAdd() throws Exception { |
|
28 |
super.testAdd(); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.55/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/h2spatial/Test10UpdateLocalModified.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.lib.impl.h2spatial; |
|
2 |
|
|
3 |
import org.gvsig.vcsgis.lib.impl.AbstractTest10UpdateLocalModified; |
|
4 |
import org.gvsig.vcsgis.lib.impl.AbstractTestUtils; |
|
5 |
|
|
6 |
public class Test10UpdateLocalModified extends AbstractTest10UpdateLocalModified { |
|
7 |
|
Also available in: Unified diff