Revision 46507 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/test/java/org/gvsig/fmap/dal/store/jdbc2/AbstractTestComputedAttributes.java
AbstractTestComputedAttributes.java | ||
---|---|---|
176 | 176 |
List<Feature> features0 = dbstore.getFeatures(query); |
177 | 177 |
ArrayList<Feature> features = new ArrayList<>(); |
178 | 178 |
|
179 |
System.out.println("ID,Comunidad,Provincia,Ciudad,Poblacion,Densidad,Fecha,CompuID,CompuPob,CompuProv,ExtraID900,ExtraPobDen,ExtraAno"); |
|
179 |
ArrayList<Object[]> expected_values = new ArrayList<>(); |
|
180 |
expected_values.add(new Object[]{5, "GVA", null, null, 200, null, null, 5, 201, "ALICANTE", 905, 206, 2019}); |
|
181 |
expected_values.add(new Object[]{6, "GVA", null, null, 20, null, null, 6, 422, "ALICANTE", 1813, 1135, 2020}); |
|
182 |
expected_values.add(new Object[]{8, "GVA", null, null, 100, null, null, 8, 702, "CASTELLON", 1817, 719, 2019}); |
|
183 |
expected_values.add(new Object[]{1, "GVA", null, null, 500, null, null, 1, 1502, "VALENCIA", 1803, 1505, 2019}); |
|
184 |
expected_values.add(new Object[]{3, "GVA", null, null, 50, null, null, 3, 352, "VALENCIA", 1807, 359, 2020}); |
|
185 |
expected_values.add(new Object[]{0, null, null, null, null, null, null, 0, null, "", 900, null, null}); |
|
186 |
|
|
180 | 187 |
for (int i = 0; i < features0.size(); i++) { |
181 | 188 |
Feature feature = features0.get(i); |
189 |
if( i==0 ) { |
|
190 |
System.out.println("Expected values:"); |
|
191 |
for (Object[] expected_line : expected_values) { |
|
192 |
for (Object cell : expected_line) { |
|
193 |
System.out.print(cell); |
|
194 |
System.out.print(", "); |
|
195 |
} |
|
196 |
System.out.println(); |
|
197 |
} |
|
198 |
System.out.println("Calculated values:"); |
|
199 |
System.out.println("ID,Comunidad,Provincia,Ciudad,Poblacion,Densidad,Fecha,CompuID,CompuPob,CompuProv,ExtraID900,ExtraPobDen,ExtraAno"); |
|
200 |
} |
|
182 | 201 |
features.add(feature.getCopy()); |
183 | 202 |
System.out.print(feature.toString()); |
184 | 203 |
System.out.print("," + feature.get("ExtraID900")); |
... | ... | |
189 | 208 |
|
190 | 209 |
features0 = null; |
191 | 210 |
String[] header = new String[]{"ID", "Comunidad", "Provincia", "Ciudad", "Poblacion", "Densidad", "Fecha", "CompuID", "CompuPob", "CompuProv", "ExtraID900", "ExtraPobDen", "ExtraAno"}; |
192 |
ArrayList<Object[]> values = new ArrayList<>(); |
|
193 |
values.add(new Object[]{5, "GVA", null, null, 200, null, null, 5, 201, "ALICANTE", 905, 206, 2019}); |
|
194 |
values.add(new Object[]{6, "GVA", null, null, 20, null, null, 6, 422, "ALICANTE", 1813, 1135, 2020}); |
|
195 |
values.add(new Object[]{8, "GVA", null, null, 100, null, null, 8, 702, "CASTELLON", 1817, 719, 2019}); |
|
196 |
values.add(new Object[]{1, "GVA", null, null, 500, null, null, 1, 1502, "VALENCIA", 1803, 1505, 2019}); |
|
197 |
values.add(new Object[]{3, "GVA", null, null, 50, null, null, 3, 352, "VALENCIA", 1807, 359, 2020}); |
|
198 |
values.add(new Object[]{0, null, null, null, null, null, null, 0, null, "", 900, null, null}); |
|
199 | 211 |
for (int i = 0; i < features.size(); i++) { |
200 | 212 |
for (int j = 0; j < header.length; j++) { |
201 |
assertEquals("feature[" + i + "][" + header[j] + "]:", values.get(i)[j], features.get(i).get(header[j])); |
|
213 |
assertEquals("feature[" + i + "][" + header[j] + "]:", expected_values.get(i)[j], features.get(i).get(header[j]));
|
|
202 | 214 |
} |
203 | 215 |
} |
204 | 216 |
|
Also available in: Unified diff