Revision 20688
trunk/libraries/libFMap_dataFile/src-test/org/gvsig/data/datastores/vectorial/file/DataStoreTest.java | ||
---|---|---|
44 | 44 |
private File dbffile = new File(DataStoreTest.class.getResource("data/prueba.dbf").getFile()); |
45 | 45 |
private File shpfile = new File(DataStoreTest.class.getResource("data/prueba.shp").getFile()); |
46 | 46 |
private File dxffile = new File(DataStoreTest.class.getResource("data/prueba.dxf").getFile()); |
47 |
private File dgnfile = new File(DataStoreTest.class.getResource("data/cv_300_todo.dgn").getFile());
|
|
47 |
private File dgnfile = new File(DataStoreTest.class.getResource("data/prueba.dgn").getFile());
|
|
48 | 48 |
|
49 | 49 |
public static void main(String[] args) { |
50 | 50 |
junit.textui.TestRunner.run(DataStoreTest.class); |
... | ... | |
835 | 835 |
|
836 | 836 |
fc = (IFeatureCollection)fs.getDataCollection(); |
837 | 837 |
|
838 |
assertEquals(14646, fc.size());
|
|
838 |
assertEquals(57, fc.size());
|
|
839 | 839 |
|
840 | 840 |
fc = (IFeatureCollection)fs.getDataCollection(null,"Color > '7'",null); |
841 | 841 |
|
842 |
assertEquals(7352, fc.size());
|
|
842 |
assertEquals(45, fc.size());
|
|
843 | 843 |
|
844 | 844 |
it = fc.iterator(); |
845 | 845 |
count=0; |
... | ... | |
848 | 848 |
assertTrue("Filter error",feature.getInt("Color")>=7); |
849 | 849 |
count++; |
850 | 850 |
} |
851 |
assertEquals("Iteration error",7352,count);
|
|
851 |
assertEquals("Iteration error",45,count);
|
|
852 | 852 |
|
853 | 853 |
|
854 | 854 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"Layer ASC"); |
855 |
assertEquals(14646, fc.size());
|
|
855 |
assertEquals(57, fc.size());
|
|
856 | 856 |
it = fc.iterator(); |
857 | 857 |
count=0; |
858 | 858 |
pfeature = (IFeature)it.next(); |
... | ... | |
867 | 867 |
pfeature=feature; |
868 | 868 |
count++; |
869 | 869 |
} |
870 |
assertEquals("Iteration error",14646,count);
|
|
870 |
assertEquals("Iteration error",57,count);
|
|
871 | 871 |
|
872 | 872 |
|
873 | 873 |
fc = (IFeatureCollection)fs.getDataCollection(null,null,"Layer DESC"); |
874 |
assertEquals(14646, fc.size());
|
|
874 |
assertEquals(57, fc.size());
|
|
875 | 875 |
it = fc.iterator(); |
876 | 876 |
|
877 | 877 |
count=0; |
... | ... | |
885 | 885 |
pfeature=feature; |
886 | 886 |
count++; |
887 | 887 |
} |
888 |
assertEquals("Iteration error",14646,count);
|
|
888 |
assertEquals("Iteration error",57,count);
|
|
889 | 889 |
|
890 | 890 |
|
891 | 891 |
fc = (IFeatureCollection)fs.getDataCollection(null,"Color > '7'","Layer ASC"); |
892 | 892 |
|
893 |
assertEquals(7352, fc.size());
|
|
893 |
assertEquals(45, fc.size());
|
|
894 | 894 |
|
895 | 895 |
it = fc.iterator(); |
896 | 896 |
|
... | ... | |
909 | 909 |
assertTrue("Short error", (i1.intValue()<=i2.intValue())); |
910 | 910 |
count++; |
911 | 911 |
} |
912 |
assertEquals("Iteration error",7352,count);
|
|
912 |
assertEquals("Iteration error",45,count);
|
|
913 | 913 |
|
914 | 914 |
|
915 | 915 |
|
... | ... | |
1114 | 1114 |
|
1115 | 1115 |
int i=0; |
1116 | 1116 |
Resource res = null; |
1117 |
Resource tmpRes = null; |
|
1117 | 1118 |
Object obj = null; |
1118 | 1119 |
|
1119 | 1120 |
Iterator iter = resMan.iterator(); |
1120 | 1121 |
while (iter.hasNext()){ |
1121 | 1122 |
obj = iter.next(); |
1122 | 1123 |
if (obj instanceof IFileResource){ |
1123 |
res = (Resource)obj;
|
|
1124 |
if (((IFileResource)res).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){
|
|
1124 |
tmpRes = (Resource)obj;
|
|
1125 |
if (((IFileResource)tmpRes).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){
|
|
1125 | 1126 |
i++; |
1127 |
res=tmpRes; |
|
1126 | 1128 |
} |
1127 | 1129 |
} |
1128 | 1130 |
} |
... | ... | |
1155 | 1157 |
|
1156 | 1158 |
|
1157 | 1159 |
|
1158 |
if (!store.isEditable() && testEdit){
|
|
1160 |
if (store.isEditable() && testEdit){ |
|
1159 | 1161 |
/*Test edition notification*/ |
1160 | 1162 |
|
1163 |
int fCountOrg=0; |
|
1164 |
int fCountFin=0; |
|
1161 | 1165 |
try { |
1166 |
fCountOrg = store.getDataCollection().size(); |
|
1167 |
} catch (ReadException e2) { |
|
1168 |
// TODO Auto-generated catch block |
|
1169 |
e2.printStackTrace();fail(); |
|
1170 |
} |
|
1171 |
try { |
|
1162 | 1172 |
store.startEditing(); |
1163 | 1173 |
} catch (ReadException e1) { |
1164 | 1174 |
e1.printStackTrace();fail(); |
... | ... | |
1179 | 1189 |
e1.printStackTrace();fail(); |
1180 | 1190 |
} |
1181 | 1191 |
|
1192 |
try { |
|
1193 |
fCountFin = store.getDataCollection().size(); |
|
1194 |
} catch (ReadException e2) { |
|
1195 |
// TODO Auto-generated catch block |
|
1196 |
e2.printStackTrace();fail(); |
|
1197 |
} |
|
1198 |
|
|
1199 |
assertEquals(fCountOrg, fCountFin); |
|
1200 |
|
|
1201 |
|
|
1182 | 1202 |
boolean isOk = false; |
1183 | 1203 |
try{ |
1184 | 1204 |
coll.iterator().next(); |
... | ... | |
1190 | 1210 |
coll.dispose(); |
1191 | 1211 |
|
1192 | 1212 |
|
1213 |
|
|
1214 |
long time = System.currentTimeMillis(); |
|
1215 |
while ((System.currentTimeMillis()-time) < 1000){ |
|
1216 |
//sleep |
|
1217 |
} |
|
1218 |
|
|
1219 |
|
|
1193 | 1220 |
((IFileResource)res).getFile().setLastModified(System.currentTimeMillis()); |
1221 |
|
|
1194 | 1222 |
isOk=false; |
1195 | 1223 |
try{ |
1196 |
store.getDataCollection(); |
|
1224 |
store.getDataCollection().iterator().next();
|
|
1197 | 1225 |
} catch (Exception e){ |
1198 | 1226 |
isOk=true; |
1199 | 1227 |
} |
... | ... | |
1236 | 1264 |
while (iter.hasNext()){ |
1237 | 1265 |
obj = iter.next(); |
1238 | 1266 |
if (obj instanceof IFileResource){ |
1239 |
res = (Resource)obj;
|
|
1240 |
if (((IFileResource)res).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){
|
|
1267 |
tmpRes = (Resource)obj;
|
|
1268 |
if (((IFileResource)tmpRes).getFile().getAbsoluteFile().equals(params.getFile().getAbsoluteFile())){
|
|
1241 | 1269 |
i++; |
1270 |
res=tmpRes; |
|
1242 | 1271 |
} |
1243 | 1272 |
} |
1244 | 1273 |
} |
Also available in: Unified diff