root / trunk / libraries / libFMap_dataDB / src-test / org / gvsig / data / datastores / vectorial / db / sde / SDETest.java @ 20855
History | View | Annotate | Download (28.9 KB)
1 |
package org.gvsig.data.datastores.vectorial.db.sde; |
---|---|
2 |
|
3 |
import java.util.Iterator; |
4 |
import java.util.NoSuchElementException; |
5 |
|
6 |
import org.gvsig.data.DataManager; |
7 |
import org.gvsig.data.IDataCollection; |
8 |
import org.gvsig.data.IDataStoreParameters; |
9 |
import org.gvsig.data.Resource; |
10 |
import org.gvsig.data.ResourceManager; |
11 |
import org.gvsig.data.datastores.vectorial.db.DBAttributeDescriptor; |
12 |
import org.gvsig.data.datastores.vectorial.db.DBFeatureType; |
13 |
import org.gvsig.data.datastores.vectorial.db.DBTest; |
14 |
import org.gvsig.data.exception.CloseException; |
15 |
import org.gvsig.data.exception.DataException; |
16 |
import org.gvsig.data.exception.InitializeException; |
17 |
import org.gvsig.data.exception.OpenException; |
18 |
import org.gvsig.data.exception.ReadException; |
19 |
import org.gvsig.data.exception.WriteException; |
20 |
import org.gvsig.data.vectorial.Feature; |
21 |
import org.gvsig.data.vectorial.FeatureStore; |
22 |
import org.gvsig.data.vectorial.IFeature; |
23 |
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor; |
24 |
import org.gvsig.data.vectorial.IFeatureCollection; |
25 |
import org.gvsig.data.vectorial.IFeatureStore; |
26 |
import org.gvsig.data.vectorial.IFeatureStoreExplorer; |
27 |
import org.gvsig.data.vectorial.IFeatureType; |
28 |
import org.gvsig.data.vectorial.IsNotAttributeSettingException; |
29 |
import org.gvsig.data.vectorial.visitor.PrintlnFeaturesVisitor; |
30 |
import org.gvsig.exceptions.BaseException; |
31 |
import org.gvsig.util.observer.IObserver; |
32 |
|
33 |
import com.esri.sde.sdk.client.SeConnection; |
34 |
|
35 |
public class SDETest extends DBTest { |
36 |
|
37 |
private static String SERVER_IP="caballero"; |
38 |
private static String SERVER_PORT="5151"; |
39 |
private static String SERVER_DBNAME="sde"; |
40 |
private static String SERVER_SCHEMA=""; |
41 |
private static String SERVER_USER="sde"; |
42 |
private static String SERVER_PASWD="sde"; |
43 |
|
44 |
|
45 |
private static String DS_NAME = SDEStore.DATASTORE_NAME; |
46 |
|
47 |
private void preparar_prueba_table() throws Exception{ |
48 |
// String url;
|
49 |
// url = "jdbc:postgresql://"+SERVER_IP+":" + SERVER_PORT +"/"+SERVER_DBNAME;
|
50 |
|
51 |
SeConnection conn = null;
|
52 |
|
53 |
Class.forName("org.postgresql.Driver"); |
54 |
conn = new SeConnection(SERVER_IP,Integer.parseInt(SERVER_PORT),SERVER_DBNAME,SERVER_USER,SERVER_PASWD);//DriverManager.getConnection(url, SERVER_USER, SERVER_PASWD); |
55 |
// conn.setAutoCommit(false);
|
56 |
// Statement st = conn.createStatement();
|
57 |
// st.execute("delete from "+SERVER_SCHEMA+".prueba");
|
58 |
// st.execute("Insert into "+SERVER_SCHEMA+".prueba select * from "+SERVER_SCHEMA+".prueba_backup");
|
59 |
// st.close();
|
60 |
// conn.commit();
|
61 |
// conn.close();
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
} |
67 |
|
68 |
public void test1(){ |
69 |
Register.selfRegister(); |
70 |
|
71 |
try {
|
72 |
preparar_prueba_table(); |
73 |
} catch (Exception e) { |
74 |
e.printStackTrace(); |
75 |
fail("Inicializando tabla prueba");
|
76 |
} |
77 |
DataManager manager = DataManager.getManager(); |
78 |
|
79 |
|
80 |
SDEStoreParameters dparam = |
81 |
(SDEStoreParameters)manager.createDataStoreParameters(DS_NAME); |
82 |
|
83 |
dparam.setHost(SERVER_IP); |
84 |
dparam.setPort(SERVER_PORT); |
85 |
dparam.setUser(SERVER_USER); |
86 |
dparam.setPassw(SERVER_PASWD); |
87 |
dparam.setSchema(SERVER_SCHEMA); |
88 |
dparam.setDb(SERVER_DBNAME); |
89 |
dparam.setTableName("puntos");
|
90 |
dparam.setFieldId(new String[] {"OBJECTID"}); |
91 |
dparam.setFields(new String[] {"TEXT","TYPEFONT","STYLEFONT","COLOR","HEIGHT","ROTATE","SHAPE"}); |
92 |
dparam.setDefaultGeometryField("SHAPE");
|
93 |
dparam.setGeometryField("SHAPE");
|
94 |
|
95 |
storeTest(dparam, null, null, false); |
96 |
|
97 |
|
98 |
|
99 |
} |
100 |
|
101 |
protected void storeTest(IDataStoreParameters dp, String filter, String order, boolean testEdit) { |
102 |
DataManager dsm=DataManager.getManager(); |
103 |
|
104 |
|
105 |
IFeatureStore fs=null;
|
106 |
try {
|
107 |
fs = (IFeatureStore)dsm.createDataStore(dp); |
108 |
} catch (InitializeException e) {
|
109 |
e.printStackTrace(); |
110 |
fail("Exception:" + e);
|
111 |
} |
112 |
|
113 |
try {
|
114 |
fs.open(); |
115 |
} catch (OpenException e2) {
|
116 |
e2.printStackTrace(); |
117 |
fail(); |
118 |
} |
119 |
|
120 |
if (fs.isEditable() && testEdit) {
|
121 |
|
122 |
try {
|
123 |
fs.startEditing(); |
124 |
} catch (ReadException e) {
|
125 |
e.printStackTrace(); |
126 |
fail(); |
127 |
} |
128 |
try{
|
129 |
IFeature feature1 = fs.createDefaultFeature(false);
|
130 |
feature1.editing(); |
131 |
feature1.set("OBJECTID",1); |
132 |
IFeature feature2 = fs.createDefaultFeature(false);
|
133 |
feature2.editing(); |
134 |
feature2.set("OBJECTID",2); |
135 |
IFeature feature3 = fs.createDefaultFeature(false);
|
136 |
feature3.editing(); |
137 |
feature3.set("OBJECTID",3); |
138 |
|
139 |
|
140 |
fs.insert(feature1); |
141 |
fs.insert(feature2); |
142 |
feature1.editing(); |
143 |
feature1.set(1,111111); |
144 |
fs.update(feature1); |
145 |
fs.delete(feature3); |
146 |
fs.delete(feature2); |
147 |
}catch (DataException e) {
|
148 |
e.printStackTrace(); |
149 |
fail(); |
150 |
} |
151 |
} |
152 |
|
153 |
//Mostrar por consola todos los registros.
|
154 |
IFeatureType ft= fs.getDefaultFeatureType(); |
155 |
IFeatureCollection featureCollection=null;
|
156 |
// featureCollection = (IFeatureCollection)fs.getDataCollection();
|
157 |
// featureCollection = (IFeatureCollection)fs.getDataCollection(ft,"NOMBRE = 'CALPE'",null);
|
158 |
// featureCollection = (IFeatureCollection)fs.getDataCollection(ft,"AREA > 3.2213163729E7 and AREA < 3.2213163749E7",null);
|
159 |
try {
|
160 |
featureCollection = (IFeatureCollection)fs.getDataCollection(ft,filter,order); |
161 |
} catch (ReadException e2) {
|
162 |
e2.printStackTrace();fail(); |
163 |
} |
164 |
|
165 |
PrintlnFeaturesVisitor visitor=new PrintlnFeaturesVisitor(ft);
|
166 |
try {
|
167 |
featureCollection.accept(visitor); |
168 |
} catch (BaseException e1) {
|
169 |
e1.printStackTrace(); |
170 |
fail("Exception: "+e1);
|
171 |
} |
172 |
featureCollection.dispose(); |
173 |
|
174 |
if (fs.isEditable() && testEdit){
|
175 |
try {
|
176 |
fs.finishEditing(); |
177 |
// fs.cancelEditing();
|
178 |
} catch (WriteException e) {
|
179 |
e.printStackTrace(); |
180 |
fail("Exception: "+e);
|
181 |
} catch (ReadException e) {
|
182 |
e.printStackTrace(); |
183 |
fail("Exception: "+e);
|
184 |
} |
185 |
} |
186 |
try {
|
187 |
fs.close(); |
188 |
} catch (CloseException e) {
|
189 |
e.printStackTrace(); |
190 |
fail("Exception: "+e);
|
191 |
} |
192 |
try {
|
193 |
fs.dispose(); |
194 |
} catch (CloseException e) {
|
195 |
e.printStackTrace();fail(); |
196 |
} |
197 |
} |
198 |
|
199 |
|
200 |
|
201 |
public void testSimpleIteration38K_regs(){ |
202 |
Register.selfRegister(); |
203 |
DataManager manager = DataManager.getManager(); |
204 |
|
205 |
|
206 |
SDEStoreParameters dparam = |
207 |
(SDEStoreParameters)manager.createDataStoreParameters(DS_NAME); |
208 |
|
209 |
dparam.setHost(SERVER_IP); |
210 |
dparam.setPort(SERVER_PORT); |
211 |
dparam.setUser(SERVER_USER); |
212 |
dparam.setPassw(SERVER_PASWD); |
213 |
dparam.setSchema(SERVER_SCHEMA); |
214 |
dparam.setDb(SERVER_DBNAME); |
215 |
dparam.setTableName("puntos");
|
216 |
dparam.setFieldId(new String[] {"OBJECTID"}); |
217 |
dparam.setFields(new String[] {"TEXT","TYPEFONT","STYLEFONT","COLOR","HEIGHT","ROTATE","SHAPE"}); |
218 |
dparam.setDefaultGeometryField("SHAPE");
|
219 |
dparam.setGeometryField("SHAPE");
|
220 |
|
221 |
// storeTest(dparam, null, null, false);
|
222 |
|
223 |
IFeatureStore fs=null;
|
224 |
try {
|
225 |
fs = (IFeatureStore) manager.createDataStore(dparam); |
226 |
} catch (InitializeException e) {
|
227 |
e.printStackTrace(); |
228 |
fail(); |
229 |
} |
230 |
IFeatureCollection fc=null;
|
231 |
try {
|
232 |
fc = (IFeatureCollection) fs.getDataCollection(); |
233 |
} catch (ReadException e) {
|
234 |
e.printStackTrace(); |
235 |
fail(); |
236 |
} |
237 |
|
238 |
int i=0; |
239 |
int count = fc.size();
|
240 |
Iterator iter = fc.iterator();
|
241 |
while (true){ |
242 |
try{
|
243 |
iter.next(); |
244 |
i++; |
245 |
} catch (NoSuchElementException e) { |
246 |
break;
|
247 |
} |
248 |
} |
249 |
assertEquals(count, i); |
250 |
|
251 |
fc.dispose(); |
252 |
|
253 |
try {
|
254 |
fs.close(); |
255 |
} catch (CloseException e) {
|
256 |
e.printStackTrace(); |
257 |
fail("Exception: "+e);
|
258 |
} |
259 |
try {
|
260 |
fs.dispose(); |
261 |
} catch (CloseException e) {
|
262 |
e.printStackTrace();fail(); |
263 |
} |
264 |
|
265 |
|
266 |
} |
267 |
|
268 |
public void test__sqlMode(){ |
269 |
Register.selfRegister(); |
270 |
DataManager manager = DataManager.getManager(); |
271 |
|
272 |
|
273 |
SDEStoreParameters dparam = |
274 |
(SDEStoreParameters)manager.createDataStoreParameters(DS_NAME); |
275 |
|
276 |
dparam.setHost(SERVER_IP); |
277 |
dparam.setPort(SERVER_PORT); |
278 |
dparam.setUser(SERVER_USER); |
279 |
dparam.setPassw(SERVER_PASWD); |
280 |
dparam.setSchema(SERVER_SCHEMA); |
281 |
dparam.setDb(SERVER_DBNAME); |
282 |
dparam.setTableName("puntos");
|
283 |
dparam.setFieldId(new String[] {"OBJECTID"}); |
284 |
dparam.setFields(new String[] {"TEXT","TYPEFONT","STYLEFONT","COLOR","HEIGHT","ROTATE","SHAPE"}); |
285 |
dparam.setDefaultGeometryField("SHAPE");
|
286 |
dparam.setGeometryField("SHAPE");
|
287 |
|
288 |
storeTest(dparam, null, null, false); |
289 |
|
290 |
Exception exc = null; |
291 |
|
292 |
IFeatureStore fs=null;
|
293 |
try {
|
294 |
fs = (IFeatureStore)manager.createDataStore(dparam); |
295 |
} catch (InitializeException e) {
|
296 |
e.printStackTrace(); |
297 |
fail("Exception:" + e);
|
298 |
} |
299 |
assertNotNull("Can't create Feature Store", fs);
|
300 |
|
301 |
try {
|
302 |
fs.open(); |
303 |
} catch (OpenException e2) {
|
304 |
e2.printStackTrace(); |
305 |
fail(); |
306 |
} |
307 |
|
308 |
|
309 |
IFeatureCollection fc =null;
|
310 |
|
311 |
try {
|
312 |
fc = (IFeatureCollection)fs.getDataCollection(); |
313 |
} catch (ReadException e1) {
|
314 |
e1.printStackTrace(); |
315 |
fail(); |
316 |
} |
317 |
|
318 |
assertEquals(135, fc.size());
|
319 |
|
320 |
fc.dispose(); |
321 |
|
322 |
// assertFalse("Edition allowed in sqlSource mode", fs.isEditable());
|
323 |
|
324 |
try {
|
325 |
fs.startEditing(); |
326 |
} catch (ReadException e1) {
|
327 |
exc=e1; |
328 |
} |
329 |
// assertNotNull("Edition allowed in sqlSource mode",exc);
|
330 |
|
331 |
exc=null;
|
332 |
try {
|
333 |
fc = (IFeatureCollection)fs.getDataCollection(null,"nombre like 'B%'",null); |
334 |
} catch (ReadException e1) {
|
335 |
exc=e1; |
336 |
} |
337 |
// assertNotNull("Filter allowed in sqlSource mode",exc);
|
338 |
|
339 |
exc=null;
|
340 |
try {
|
341 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TEXT"); |
342 |
} catch (ReadException e1) {
|
343 |
exc=e1; |
344 |
} |
345 |
// assertNotNull("Order allowed in sqlSource mode",exc);
|
346 |
|
347 |
|
348 |
try {
|
349 |
fs.close(); |
350 |
} catch (CloseException e) {
|
351 |
e.printStackTrace(); |
352 |
fail("Exception:" + e);
|
353 |
} |
354 |
|
355 |
try{
|
356 |
fs.dispose(); |
357 |
}catch (Exception e) { |
358 |
e.printStackTrace(); |
359 |
fail("Exception:" + e);
|
360 |
} |
361 |
|
362 |
} |
363 |
|
364 |
public void test2(){ |
365 |
|
366 |
try {
|
367 |
preparar_prueba_table(); |
368 |
} catch (Exception e) { |
369 |
e.printStackTrace(); |
370 |
fail("Inicializando tabla prueba");
|
371 |
} |
372 |
|
373 |
Register.selfRegister(); |
374 |
DataManager manager = DataManager.getManager(); |
375 |
|
376 |
|
377 |
SDEStoreParameters dparam = |
378 |
(SDEStoreParameters)manager.createDataStoreParameters(DS_NAME); |
379 |
|
380 |
dparam.setHost(SERVER_IP); |
381 |
dparam.setPort(SERVER_PORT); |
382 |
dparam.setUser(SERVER_USER); |
383 |
dparam.setPassw(SERVER_PASWD); |
384 |
dparam.setSchema(SERVER_SCHEMA); |
385 |
dparam.setDb(SERVER_DBNAME); |
386 |
dparam.setTableName("puntos");
|
387 |
dparam.setFieldId(new String[] {"OBJECTID"}); |
388 |
dparam.setFields(new String[] {"TEXT","TYPEFONT","STYLEFONT","COLOR","HEIGHT","ROTATE","SHAPE"}); |
389 |
dparam.setDefaultGeometryField("SHAPE");
|
390 |
dparam.setGeometryField("SHAPE");
|
391 |
|
392 |
// storeTest(dparam, null, null, true);
|
393 |
storeTest(dparam, null, null, false); |
394 |
|
395 |
IFeatureStore fs=null;
|
396 |
try {
|
397 |
fs = (IFeatureStore)manager.createDataStore(dparam); |
398 |
} catch (InitializeException e) {
|
399 |
e.printStackTrace(); |
400 |
fail("Exception:" + e);
|
401 |
} |
402 |
assertNotNull("Can't create Feature Store", fs);
|
403 |
|
404 |
try {
|
405 |
fs.open(); |
406 |
} catch (OpenException e2) {
|
407 |
e2.printStackTrace(); |
408 |
fail(); |
409 |
} |
410 |
|
411 |
Iterator it;
|
412 |
IFeatureCollection fc =null;
|
413 |
Comparable v1,v2;
|
414 |
IFeature feature=null,pfeature=null; |
415 |
long count;
|
416 |
|
417 |
|
418 |
try {
|
419 |
fc = (IFeatureCollection)fs.getDataCollection(); |
420 |
} catch (ReadException e1) {
|
421 |
e1.printStackTrace(); |
422 |
fail(); |
423 |
} |
424 |
|
425 |
assertEquals(135, fc.size());
|
426 |
|
427 |
fc.dispose(); |
428 |
|
429 |
try {
|
430 |
fc = (IFeatureCollection)fs.getDataCollection(null,"lower(TEXT) like 'b%'",null); |
431 |
} catch (ReadException e1) {
|
432 |
e1.printStackTrace(); |
433 |
fail(); |
434 |
} |
435 |
|
436 |
assertEquals(11, fc.size());
|
437 |
|
438 |
it = fc.iterator(); |
439 |
count=0;
|
440 |
while (it.hasNext()){
|
441 |
feature = (IFeature)it.next(); |
442 |
// assertTrue("Filter error",feature.getString("TEXT").toLowerCase().startsWith("b"));
|
443 |
count++; |
444 |
} |
445 |
assertEquals("Iteration error",11,count); |
446 |
|
447 |
fc.dispose(); |
448 |
|
449 |
|
450 |
try {
|
451 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TEXT ASC"); |
452 |
} catch (ReadException e1) {
|
453 |
e1.printStackTrace(); |
454 |
fail(); |
455 |
} |
456 |
assertEquals(135, fc.size());
|
457 |
it = fc.iterator(); |
458 |
count=0;
|
459 |
pfeature = (IFeature)it.next(); |
460 |
count++; |
461 |
while (it.hasNext()){
|
462 |
feature = (IFeature)it.next(); |
463 |
v1 = (Comparable)pfeature.get("TEXT"); |
464 |
v2 = (Comparable)feature.get("TEXT"); |
465 |
pfeature=feature; |
466 |
assertTrue("Short error", (v1.compareTo(v1) <= 0)); |
467 |
count++; |
468 |
} |
469 |
assertEquals("Iteration error",135,count); |
470 |
|
471 |
fc.dispose(); |
472 |
|
473 |
|
474 |
try {
|
475 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TEXT DESC"); |
476 |
} catch (ReadException e1) {
|
477 |
e1.printStackTrace(); |
478 |
fail(); |
479 |
} |
480 |
assertEquals(135, fc.size());
|
481 |
it = fc.iterator(); |
482 |
|
483 |
count=0;
|
484 |
pfeature = (IFeature)it.next(); |
485 |
count++; |
486 |
while (it.hasNext()){
|
487 |
feature = (IFeature)it.next(); |
488 |
v1 = (Comparable)pfeature.get("TEXT"); |
489 |
v2 = (Comparable)feature.get("TEXT"); |
490 |
pfeature=feature; |
491 |
assertTrue("Short error", (v1.compareTo(v1) >= 0)); |
492 |
count++; |
493 |
} |
494 |
assertEquals("Iteration error",135,count); |
495 |
|
496 |
fc.dispose(); |
497 |
|
498 |
|
499 |
|
500 |
try {
|
501 |
fc = (IFeatureCollection)fs.getDataCollection(null,"lower(TEXT) like 'b%'","TEXT"); |
502 |
} catch (ReadException e1) {
|
503 |
e1.printStackTrace(); |
504 |
fail(); |
505 |
} |
506 |
|
507 |
assertEquals(11, fc.size());
|
508 |
|
509 |
it = fc.iterator(); |
510 |
|
511 |
count=0;
|
512 |
pfeature = (IFeature)it.next(); |
513 |
// assertTrue(pfeature.getString("TEXT").toLowerCase().startsWith("b"));
|
514 |
count++; |
515 |
while (it.hasNext()){
|
516 |
feature = (IFeature)it.next(); |
517 |
// assertTrue("Filter error",feature.getString("TEXT").toLowerCase().startsWith("b"));
|
518 |
v1 = (Comparable)pfeature.get("TEXT"); |
519 |
v2 = (Comparable)feature.get("TEXT"); |
520 |
pfeature=feature; |
521 |
assertTrue("Short error", (v1.compareTo(v1) <= 0)); |
522 |
count++; |
523 |
} |
524 |
assertEquals("Iteration error",11,count); |
525 |
fc.dispose(); |
526 |
|
527 |
|
528 |
|
529 |
try {
|
530 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TYPEFONT,lower(TEXT) Desc"); |
531 |
} catch (ReadException e1) {
|
532 |
e1.printStackTrace(); |
533 |
fail(); |
534 |
} |
535 |
assertEquals(135, fc.size());
|
536 |
it = fc.iterator(); |
537 |
count=0;
|
538 |
pfeature = (IFeature)it.next(); |
539 |
System.out.println(pfeature.getString("TEXT")); |
540 |
count++; |
541 |
while (it.hasNext()){
|
542 |
feature = (IFeature)it.next(); |
543 |
v1 = (Comparable)((String)pfeature.get("TEXT")).toLowerCase(); |
544 |
v2 = (Comparable)((String)feature.get("TEXT")).toLowerCase(); |
545 |
pfeature=feature; |
546 |
// assertTrue("Short error", (v1.compareTo(v2) >= 0));
|
547 |
System.out.println(pfeature.getString("TEXT")); |
548 |
count++; |
549 |
} |
550 |
assertEquals("Iteration error",135,count); |
551 |
fc.dispose(); |
552 |
|
553 |
|
554 |
|
555 |
/// CON EDICION
|
556 |
try {
|
557 |
fs.startEditing(); |
558 |
} catch (ReadException e1) {
|
559 |
e1.printStackTrace(); |
560 |
fail(); |
561 |
} |
562 |
|
563 |
try{
|
564 |
IFeature newFeature = fs.createFeature(fs.getDefaultFeatureType()); |
565 |
newFeature.editing(); |
566 |
newFeature.set("TEXT","BuRjaSOT"); |
567 |
newFeature.set("TYPEFONT","Arial"); |
568 |
fs.insert(newFeature); |
569 |
}catch (DataException e) {
|
570 |
e.printStackTrace(); |
571 |
fail(); |
572 |
} |
573 |
|
574 |
try {
|
575 |
fc = (IFeatureCollection)fs.getDataCollection(); |
576 |
} catch (ReadException e1) {
|
577 |
e1.printStackTrace(); |
578 |
fail(); |
579 |
} |
580 |
|
581 |
assertEquals(136, fc.size());
|
582 |
fc.dispose(); |
583 |
|
584 |
try {
|
585 |
fc = (IFeatureCollection)fs.getDataCollection(null,"lower(TEXT) like 'b%'",null); |
586 |
} catch (ReadException e1) {
|
587 |
e1.printStackTrace(); |
588 |
fail(); |
589 |
} |
590 |
|
591 |
assertEquals(12, fc.size());
|
592 |
|
593 |
it = fc.iterator(); |
594 |
count=0;
|
595 |
while (it.hasNext()){
|
596 |
feature = (IFeature)it.next(); |
597 |
// assertTrue("Filter error",feature.getString("TEXT").toLowerCase().startsWith("b"));
|
598 |
count++; |
599 |
} |
600 |
assertEquals("Iteration error",12,count); |
601 |
fc.dispose(); |
602 |
|
603 |
|
604 |
try {
|
605 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TEXT ASC"); |
606 |
} catch (ReadException e1) {
|
607 |
e1.printStackTrace(); |
608 |
fail(); |
609 |
} |
610 |
assertEquals(136, fc.size());
|
611 |
it = fc.iterator(); |
612 |
count=0;
|
613 |
pfeature = (IFeature)it.next(); |
614 |
count++; |
615 |
while (it.hasNext()){
|
616 |
feature = (IFeature)it.next(); |
617 |
v1 = (Comparable)pfeature.get("TEXT"); |
618 |
v2 = (Comparable)feature.get("TEXT"); |
619 |
pfeature=feature; |
620 |
assertTrue("Short error", (v1.compareTo(v1) <= 0)); |
621 |
count++; |
622 |
} |
623 |
assertEquals("Iteration error",136,count); |
624 |
fc.dispose(); |
625 |
|
626 |
|
627 |
try {
|
628 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TEXT DESC"); |
629 |
} catch (ReadException e1) {
|
630 |
e1.printStackTrace(); |
631 |
fail(); |
632 |
} |
633 |
assertEquals(136, fc.size());
|
634 |
it = fc.iterator(); |
635 |
|
636 |
count=0;
|
637 |
pfeature = (IFeature)it.next(); |
638 |
count++; |
639 |
while (it.hasNext()){
|
640 |
feature = (IFeature)it.next(); |
641 |
v1 = (Comparable)pfeature.get("TEXT"); |
642 |
v2 = (Comparable)feature.get("TEXT"); |
643 |
pfeature=feature; |
644 |
assertTrue("Short error", (v1.compareTo(v1) >= 0)); |
645 |
count++; |
646 |
} |
647 |
assertEquals("Iteration error",136,count); |
648 |
fc.dispose(); |
649 |
|
650 |
|
651 |
try {
|
652 |
fc = (IFeatureCollection)fs.getDataCollection(null,"lower(TEXT) like 'b%'","TEXT"); |
653 |
} catch (ReadException e1) {
|
654 |
e1.printStackTrace(); |
655 |
fail(); |
656 |
} |
657 |
|
658 |
assertEquals(12, fc.size());
|
659 |
|
660 |
it = fc.iterator(); |
661 |
|
662 |
count=0;
|
663 |
pfeature = (IFeature)it.next(); |
664 |
assertTrue(pfeature.getString("TEXT").toLowerCase().startsWith("b")); |
665 |
count++; |
666 |
while (it.hasNext()){
|
667 |
feature = (IFeature)it.next(); |
668 |
assertTrue("Filter error",feature.getString("TEXT").toLowerCase().startsWith("b")); |
669 |
v1 = (Comparable)pfeature.get("TEXT"); |
670 |
v2 = (Comparable)feature.get("TEXT"); |
671 |
pfeature=feature; |
672 |
assertTrue("Short error", (v1.compareTo(v1) <= 0)); |
673 |
count++; |
674 |
} |
675 |
assertEquals("Iteration error",12,count); |
676 |
fc.dispose(); |
677 |
|
678 |
|
679 |
|
680 |
try {
|
681 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"TYPEFONT,lower(TEXT) Desc"); |
682 |
} catch (ReadException e1) {
|
683 |
e1.printStackTrace(); |
684 |
fail(); |
685 |
} |
686 |
assertEquals(136, fc.size());
|
687 |
it = fc.iterator(); |
688 |
count=0;
|
689 |
pfeature = (IFeature)it.next(); |
690 |
System.out.println(pfeature.getString("TEXT")); |
691 |
count++; |
692 |
while (it.hasNext()){
|
693 |
feature = (IFeature)it.next(); |
694 |
v1 = (Comparable)((String)pfeature.get("TEXT")).toLowerCase(); |
695 |
v2 = (Comparable)((String)feature.get("TEXT")).toLowerCase(); |
696 |
pfeature=feature; |
697 |
assertTrue("Short error", (v1.compareTo(v2) >= 0)); |
698 |
System.out.println(pfeature.getString("TEXT")); |
699 |
count++; |
700 |
} |
701 |
assertEquals("Iteration error",136,count); |
702 |
fc.dispose(); |
703 |
|
704 |
|
705 |
fs.cancelEditing(); |
706 |
|
707 |
|
708 |
//Insertar un elemento
|
709 |
try{
|
710 |
fs.startEditing(); |
711 |
} catch (ReadException e1) {
|
712 |
e1.printStackTrace(); |
713 |
fail(); |
714 |
} |
715 |
try{
|
716 |
feature = fs.createDefaultFeature(true);
|
717 |
feature.editing(); |
718 |
// feature.set("id", 90000);
|
719 |
feature.set("TEXT","BurJASOT"); |
720 |
feature.set("TYPEFONT", "Arial"); |
721 |
fs.insert(feature); |
722 |
}catch (DataException e) {
|
723 |
e.printStackTrace(); |
724 |
fail(); |
725 |
} |
726 |
try {
|
727 |
fs.finishEditing(); |
728 |
} catch (WriteException e) {
|
729 |
e.printStackTrace(); |
730 |
fail("Exception: "+e);
|
731 |
} catch (ReadException e) {
|
732 |
e.printStackTrace(); |
733 |
fail("Exception: "+e);
|
734 |
} |
735 |
|
736 |
try{
|
737 |
fs.startEditing(); |
738 |
} catch (ReadException e1) {
|
739 |
e1.printStackTrace(); |
740 |
fail(); |
741 |
} |
742 |
try {
|
743 |
fs.delete(feature); |
744 |
} catch (DataException e3) {
|
745 |
e3.printStackTrace();fail(); |
746 |
} |
747 |
|
748 |
try {
|
749 |
fs.finishEditing(); |
750 |
} catch (WriteException e) {
|
751 |
e.printStackTrace(); |
752 |
fail("Exception: "+e);
|
753 |
} catch (ReadException e) {
|
754 |
e.printStackTrace(); |
755 |
fail("Exception: "+e);
|
756 |
} |
757 |
|
758 |
|
759 |
|
760 |
|
761 |
try {
|
762 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"lower(TEXT) Desc"); |
763 |
} catch (ReadException e1) {
|
764 |
e1.printStackTrace(); |
765 |
fail(); |
766 |
} |
767 |
assertEquals(136, fc.size());
|
768 |
it = fc.iterator(); |
769 |
count=0;
|
770 |
pfeature = (IFeature)it.next(); |
771 |
System.out.println(pfeature.getString("TEXT")); |
772 |
count++; |
773 |
while (it.hasNext()){
|
774 |
feature = (IFeature)it.next(); |
775 |
v1 = (Comparable)((String)pfeature.get("TEXT")).toLowerCase(); |
776 |
v2 = (Comparable)((String)feature.get("TEXT")).toLowerCase(); |
777 |
pfeature=feature; |
778 |
// assertTrue("Short error: "+ v1.toString() + " >= " +v2.toString(), (v1.compareTo(v2) >= 0));
|
779 |
System.out.println(pfeature.getString("TEXT")); |
780 |
count++; |
781 |
} |
782 |
assertEquals("Iteration error",136,count); |
783 |
fc.dispose(); |
784 |
|
785 |
|
786 |
|
787 |
//Actualizacion
|
788 |
try{
|
789 |
fs.startEditing(); |
790 |
} catch (ReadException e1) {
|
791 |
e1.printStackTrace(); |
792 |
fail(); |
793 |
} |
794 |
|
795 |
|
796 |
try {
|
797 |
fc = (IFeatureCollection)fs.getDataCollection(null,"lower(TEXT) = 'burjasot'",null); |
798 |
} catch (ReadException e1) {
|
799 |
e1.printStackTrace(); |
800 |
fail(); |
801 |
} |
802 |
assertEquals(1, fc.size());
|
803 |
feature =(Feature)fc.iterator().next(); |
804 |
try {
|
805 |
feature.editing(); |
806 |
feature.set("TEXT", feature.getString("TEXT")+"__KK__"); |
807 |
} catch (DataException e2) {
|
808 |
e2.printStackTrace();fail(); |
809 |
} |
810 |
try {
|
811 |
fs.update(feature); |
812 |
} catch (DataException e2) {
|
813 |
e2.printStackTrace();fail(); |
814 |
} |
815 |
try {
|
816 |
fs.finishEditing(); |
817 |
} catch (WriteException e) {
|
818 |
e.printStackTrace(); |
819 |
fail("Exception: "+e);
|
820 |
} catch (ReadException e) {
|
821 |
e.printStackTrace(); |
822 |
fail("Exception: "+e);
|
823 |
} |
824 |
|
825 |
try {
|
826 |
fc = (IFeatureCollection)fs.getDataCollection(null,"TEXT like '%__KK__'",null); |
827 |
} catch (ReadException e1) {
|
828 |
e1.printStackTrace(); |
829 |
fail(); |
830 |
} |
831 |
assertEquals(1, fc.size());
|
832 |
fc.dispose(); |
833 |
|
834 |
|
835 |
//Eliminacion
|
836 |
try{
|
837 |
fs.startEditing(); |
838 |
} catch (ReadException e1) {
|
839 |
e1.printStackTrace(); |
840 |
fail(); |
841 |
} |
842 |
|
843 |
|
844 |
try {
|
845 |
fc = (IFeatureCollection)fs.getDataCollection(null,"TEXT like '%__KK__'",null); |
846 |
} catch (ReadException e1) {
|
847 |
e1.printStackTrace(); |
848 |
fail(); |
849 |
} |
850 |
assertEquals(1, fc.size());
|
851 |
try {
|
852 |
fs.delete((IFeature)fc.iterator().next()); |
853 |
} catch (DataException e2) {
|
854 |
e2.printStackTrace();fail(); |
855 |
} |
856 |
fc.dispose(); |
857 |
try {
|
858 |
fs.finishEditing(); |
859 |
} catch (WriteException e) {
|
860 |
e.printStackTrace(); |
861 |
fail("Exception: "+e);
|
862 |
} catch (ReadException e) {
|
863 |
e.printStackTrace(); |
864 |
fail("Exception: "+e);
|
865 |
} |
866 |
|
867 |
try {
|
868 |
fc = (IFeatureCollection)fs.getDataCollection(); |
869 |
} catch (ReadException e1) {
|
870 |
e1.printStackTrace(); |
871 |
fail(); |
872 |
} |
873 |
assertEquals(135, fc.size());
|
874 |
fc.dispose(); |
875 |
|
876 |
|
877 |
|
878 |
try {
|
879 |
fs.close(); |
880 |
} catch (CloseException e) {
|
881 |
e.printStackTrace(); |
882 |
fail("Exception:" + e);
|
883 |
} |
884 |
|
885 |
try {
|
886 |
fs.dispose(); |
887 |
} catch (CloseException e) {
|
888 |
e.printStackTrace();fail(); |
889 |
} |
890 |
|
891 |
testResources(dparam); |
892 |
|
893 |
} |
894 |
|
895 |
|
896 |
public void testResources(SDEStoreParameters params){ |
897 |
DataManager manager = DataManager.getManager(); |
898 |
|
899 |
ResourceManager resMan = ResourceManager.getResourceManager(); |
900 |
|
901 |
FeatureStore store=null;
|
902 |
FeatureStore store2=null;
|
903 |
FeatureStore store3=null;
|
904 |
try {
|
905 |
store = (FeatureStore)manager.createDataStore(params); |
906 |
store2 = (FeatureStore)manager.createDataStore(params); |
907 |
store3 = (FeatureStore)manager.createDataStore(params); |
908 |
} catch (InitializeException e1) {
|
909 |
e1.printStackTrace();fail(); |
910 |
} |
911 |
|
912 |
int i=0; |
913 |
Resource res = null;
|
914 |
Resource tmpRes = null;
|
915 |
Object obj = null; |
916 |
|
917 |
Iterator iter = resMan.iterator();
|
918 |
while (iter.hasNext()){
|
919 |
obj = iter.next(); |
920 |
if (obj instanceof SDEResource){ |
921 |
tmpRes = (Resource)obj; |
922 |
if (isTheSame((SDEResource)tmpRes,params)){
|
923 |
i++; |
924 |
res=tmpRes; |
925 |
} |
926 |
} |
927 |
} |
928 |
|
929 |
assertEquals(1, i);
|
930 |
|
931 |
assertEquals(3, res.getRefencesCount());
|
932 |
|
933 |
try {
|
934 |
store.close(); |
935 |
} catch (CloseException e1) {
|
936 |
e1.printStackTrace();fail(); |
937 |
} |
938 |
|
939 |
assertEquals(false, res.isOpen());
|
940 |
|
941 |
IDataCollection coll = null;
|
942 |
|
943 |
try {
|
944 |
coll =store.getDataCollection(); |
945 |
} catch (ReadException e1) {
|
946 |
e1.printStackTrace();fail(); |
947 |
} |
948 |
|
949 |
coll.iterator().next(); |
950 |
|
951 |
assertEquals(true, res.isOpen());
|
952 |
|
953 |
coll.dispose(); |
954 |
|
955 |
|
956 |
|
957 |
if (store.isEditable()){
|
958 |
/*Test edition notification*/
|
959 |
|
960 |
int fCountOrg=0; |
961 |
int fCountFin=0; |
962 |
try {
|
963 |
fCountOrg = store.getDataCollection().size(); |
964 |
} catch (ReadException e2) {
|
965 |
e2.printStackTrace();fail(); |
966 |
} |
967 |
try {
|
968 |
store.startEditing(); |
969 |
} catch (ReadException e1) {
|
970 |
e1.printStackTrace();fail(); |
971 |
} |
972 |
|
973 |
try {
|
974 |
coll = store2.getDataCollection(); |
975 |
} catch (ReadException e1) {
|
976 |
e1.printStackTrace();fail(); |
977 |
} |
978 |
|
979 |
try {
|
980 |
store.finishEditing(); |
981 |
} catch (WriteException e1) {
|
982 |
e1.printStackTrace();fail(); |
983 |
} catch (ReadException e1) {
|
984 |
e1.printStackTrace();fail(); |
985 |
} |
986 |
|
987 |
try {
|
988 |
fCountFin = store.getDataCollection().size(); |
989 |
} catch (ReadException e2) {
|
990 |
e2.printStackTrace();fail(); |
991 |
} |
992 |
|
993 |
assertEquals(fCountOrg, fCountFin); |
994 |
|
995 |
|
996 |
boolean isOk = false; |
997 |
try{
|
998 |
coll.iterator().next(); |
999 |
} catch (Exception e){ |
1000 |
isOk=true;
|
1001 |
} |
1002 |
assertTrue("Resource Changed Notification fails",isOk);
|
1003 |
|
1004 |
coll.dispose(); |
1005 |
|
1006 |
/*Test edition notification END*/
|
1007 |
|
1008 |
} |
1009 |
|
1010 |
|
1011 |
SDEExplorer explorer = null;
|
1012 |
try {
|
1013 |
explorer = (SDEExplorer) store.getExplorer(); |
1014 |
} catch (ReadException e) {
|
1015 |
e.printStackTrace();fail(); |
1016 |
} |
1017 |
|
1018 |
if (explorer != null){ |
1019 |
assertEquals(4, res.getRefencesCount());
|
1020 |
|
1021 |
// try {
|
1022 |
// explorer.add(SDEExplorer);
|
1023 |
// } catch (ReadException e) {
|
1024 |
// e.printStackTrace();fail();
|
1025 |
// }
|
1026 |
|
1027 |
|
1028 |
|
1029 |
try {
|
1030 |
explorer.list(); |
1031 |
} catch (ReadException e) {
|
1032 |
e.printStackTrace();fail(); |
1033 |
} |
1034 |
|
1035 |
try {
|
1036 |
explorer.dispose(); |
1037 |
} catch (DataException e1) {
|
1038 |
e1.printStackTrace();fail(); |
1039 |
} |
1040 |
assertEquals(3, res.getRefencesCount());
|
1041 |
} |
1042 |
try {
|
1043 |
store3.dispose(); |
1044 |
} catch (CloseException e1) {
|
1045 |
e1.printStackTrace();fail(); |
1046 |
} |
1047 |
|
1048 |
assertEquals(2, res.getRefencesCount());
|
1049 |
|
1050 |
try {
|
1051 |
store2.dispose(); |
1052 |
} catch (CloseException e1) {
|
1053 |
e1.printStackTrace();fail(); |
1054 |
} |
1055 |
|
1056 |
assertEquals(1, res.getRefencesCount());
|
1057 |
|
1058 |
try {
|
1059 |
store.dispose(); |
1060 |
} catch (CloseException e1) {
|
1061 |
e1.printStackTrace();fail(); |
1062 |
} |
1063 |
|
1064 |
assertEquals(0, res.getRefencesCount());
|
1065 |
res = null;
|
1066 |
|
1067 |
i=0;
|
1068 |
iter = resMan.iterator(); |
1069 |
while (iter.hasNext()){
|
1070 |
obj = iter.next(); |
1071 |
if (obj instanceof SDEResource){ |
1072 |
tmpRes = (Resource)obj; |
1073 |
if (isTheSame((SDEResource)tmpRes,params)){
|
1074 |
i++; |
1075 |
res=tmpRes; |
1076 |
} |
1077 |
} |
1078 |
} |
1079 |
|
1080 |
assertEquals(0, i);
|
1081 |
|
1082 |
doPrepareFileResourceTest(params); |
1083 |
|
1084 |
} |
1085 |
|
1086 |
public static boolean isTheSame(SDEResource resource,SDEStoreParameters params){ |
1087 |
return resource.getServer().equals(params.getHost()) &&
|
1088 |
resource.getPort().equals(params.getPort()) && |
1089 |
resource.getDatabase().equals(params.getDb()) && |
1090 |
resource.getUser().equals(params.getUser()); |
1091 |
} |
1092 |
|
1093 |
public void doPrepareFileResourceTest(SDEStoreParameters params){ |
1094 |
DataManager manager = DataManager.getManager(); |
1095 |
|
1096 |
ResourceManager resMan = ResourceManager.getResourceManager(); |
1097 |
|
1098 |
String passw = params.getPassw();
|
1099 |
params.setPassw("--------------");
|
1100 |
|
1101 |
IObserver obs = new PrepareResourceObserver(params, passw);
|
1102 |
|
1103 |
|
1104 |
resMan.addObserver(obs); |
1105 |
|
1106 |
FeatureStore store=null;
|
1107 |
try {
|
1108 |
store = (FeatureStore)manager.createDataStore(params); |
1109 |
} catch (InitializeException e1) {
|
1110 |
e1.printStackTrace();fail(); |
1111 |
} catch (Exception e2){ |
1112 |
e2.printStackTrace();fail(); |
1113 |
} |
1114 |
|
1115 |
try {
|
1116 |
store.getDataCollection().iterator().next(); |
1117 |
} catch (ReadException e) {
|
1118 |
e.printStackTrace();fail(); |
1119 |
} |
1120 |
|
1121 |
try {
|
1122 |
store.close(); |
1123 |
} catch (CloseException e) {
|
1124 |
e.printStackTrace();fail(); |
1125 |
} |
1126 |
try {
|
1127 |
store.dispose(); |
1128 |
} catch (CloseException e) {
|
1129 |
e.printStackTrace();fail(); |
1130 |
} |
1131 |
params.setPassw(passw); |
1132 |
|
1133 |
} |
1134 |
public void testSDE_explorer_add_remove(){ |
1135 |
System.out.println("======= SDE explorer add/remove=============="); |
1136 |
Register.selfRegister(); |
1137 |
|
1138 |
DataManager dm=DataManager.getManager(); |
1139 |
|
1140 |
|
1141 |
SDEExplorerParameters dex=(SDEExplorerParameters)dm.createDataExplorerParameters(SDEExplorer.DATAEXPLORER_NAME); |
1142 |
|
1143 |
|
1144 |
dex.setHost("caballero");
|
1145 |
dex.setUser("sde");
|
1146 |
dex.setPassw("sde");
|
1147 |
dex.setDb("sde");
|
1148 |
dex.setPort("5151");
|
1149 |
|
1150 |
IFeatureStoreExplorer explorer=null;
|
1151 |
try {
|
1152 |
explorer = (IFeatureStoreExplorer)dm.createDataExplorer(dex); |
1153 |
} catch (InitializeException e1) {
|
1154 |
e1.printStackTrace(); |
1155 |
fail(); return;
|
1156 |
} |
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
SDENewStoreParameter newdp = (SDENewStoreParameter) explorer.createNewDataStoreParameter(); |
1162 |
|
1163 |
newdp.getSDEParameters().setTableName("Prueba");
|
1164 |
newdp.getSDEParameters().setFieldId(new String[] {"OBJECTID"}); |
1165 |
|
1166 |
|
1167 |
DBFeatureType ftype = new DBFeatureType();
|
1168 |
try {
|
1169 |
ftype.setFieldsId(newdp.getSDEParameters().getFieldsId()); |
1170 |
} catch (DataException e3) {
|
1171 |
e3.printStackTrace();fail(); |
1172 |
} |
1173 |
newdp.setFeatureType(ftype); |
1174 |
DBAttributeDescriptor attr; |
1175 |
|
1176 |
attr = new DBAttributeDescriptor();
|
1177 |
try {
|
1178 |
attr.loading(); |
1179 |
attr.setName("OBJECTID");
|
1180 |
attr.setAutoIncrement(true);
|
1181 |
attr.setType(IFeatureAttributeDescriptor.TYPE_INT); |
1182 |
attr.setPrimaryKey(true);
|
1183 |
attr.stopLoading(); |
1184 |
ftype.add(attr); |
1185 |
|
1186 |
attr = new DBAttributeDescriptor();
|
1187 |
attr.loading(); |
1188 |
attr.setName("MYSTRING");
|
1189 |
attr.setSize(50);
|
1190 |
attr.setDefaultValue("def");
|
1191 |
attr.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
1192 |
attr.stopLoading(); |
1193 |
ftype.add(attr); |
1194 |
|
1195 |
|
1196 |
attr = new DBAttributeDescriptor();
|
1197 |
attr.loading(); |
1198 |
attr.setName("MYDOUBLE");
|
1199 |
|
1200 |
attr.setType(IFeatureAttributeDescriptor.TYPE_DOUBLE); |
1201 |
attr.stopLoading(); |
1202 |
ftype.add(attr); |
1203 |
|
1204 |
|
1205 |
// attr = new DBAttributeDescriptor();
|
1206 |
// attr.loading();
|
1207 |
// attr.setName("SHAPE");
|
1208 |
// attr.setType(IFeatureAttributeDescriptor.TYPE_GEOMETRY);
|
1209 |
// attr.stopLoading();
|
1210 |
// ftype.add(attr);
|
1211 |
// ftype.setDefaultGeometry(attr.getName());
|
1212 |
|
1213 |
attr.stopLoading(); |
1214 |
} catch (IsNotAttributeSettingException e2) {
|
1215 |
e2.printStackTrace(); |
1216 |
fail();return;
|
1217 |
} |
1218 |
|
1219 |
|
1220 |
try {
|
1221 |
explorer.add(newdp); |
1222 |
} catch (InitializeException e1) {
|
1223 |
e1.printStackTrace(); |
1224 |
fail();return;
|
1225 |
} catch (WriteException e1) {
|
1226 |
e1.printStackTrace(); |
1227 |
fail();return;
|
1228 |
} |
1229 |
|
1230 |
|
1231 |
IDataStoreParameters[] list= null; |
1232 |
|
1233 |
try {
|
1234 |
list = explorer.list(); |
1235 |
} catch (ReadException e) {
|
1236 |
e.printStackTrace(); |
1237 |
fail();return;
|
1238 |
} |
1239 |
|
1240 |
if (list.length < 1){ |
1241 |
fail(); return;
|
1242 |
} |
1243 |
int i;
|
1244 |
boolean found=false; |
1245 |
SDEStoreParameters dsaux=null;
|
1246 |
for(i=0;i<list.length;i++){ |
1247 |
dsaux = (SDEStoreParameters)list[i]; |
1248 |
if (dsaux.getTableName().equalsIgnoreCase(newdp.getSDEParameters().getTableName())){
|
1249 |
found=true;
|
1250 |
break;
|
1251 |
} |
1252 |
} |
1253 |
if (!found){
|
1254 |
fail(); |
1255 |
} |
1256 |
|
1257 |
try {
|
1258 |
explorer.remove(dsaux); |
1259 |
} catch (ReadException e) {
|
1260 |
e.printStackTrace(); |
1261 |
fail();return;
|
1262 |
} |
1263 |
|
1264 |
try {
|
1265 |
list = explorer.list(); |
1266 |
} catch (ReadException e) {
|
1267 |
e.printStackTrace(); |
1268 |
fail();return;
|
1269 |
} |
1270 |
|
1271 |
found = false;
|
1272 |
for(i=0;i<list.length;i++){ |
1273 |
dsaux = (SDEStoreParameters)list[i]; |
1274 |
if (dsaux.getTableName().equalsIgnoreCase(newdp.getSDEParameters().getTableName())){
|
1275 |
found=true;
|
1276 |
break;
|
1277 |
} |
1278 |
} |
1279 |
if (found){
|
1280 |
fail(); |
1281 |
} |
1282 |
|
1283 |
try {
|
1284 |
explorer.dispose(); |
1285 |
} catch (DataException e) {
|
1286 |
e.printStackTrace();fail(); |
1287 |
} |
1288 |
|
1289 |
System.out.println("======= /SDE explorer add/remove=============="); |
1290 |
} |
1291 |
|
1292 |
} |