private void assertFeatures(DataStore store, String typeName, Feature... expected) throws Exception { try (Connection connection = ((JDBCDataStore) store).getConnection(Transaction.AUTO_COMMIT); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { Map<String, String> mappings = metadata.getFidMappings(typeName); SimpleFeatureSource source = store.getFeatureSource(typeName); SimpleFeatureCollection features = source.getFeatures(); Map<String, Feature> expectedFeatures; { List<Feature> list = Lists.newArrayList(expected); expectedFeatures = Maps.uniqueIndex(list, (f) -> ((SimpleFeature) f).getID()); } Set<String> actualFeatureIDs = new HashSet<String>(); { try (SimpleFeatureIterator fiter = features.features()) { while (fiter.hasNext()) { SimpleFeature feature = fiter.next(); actualFeatureIDs.add(mappings.get(feature.getID().split("\\.")[1])); } } } Set<String> expectedFeatureIDs = expectedFeatures.keySet(); assertEquals(expectedFeatureIDs, actualFeatureIDs); } }
private void assertFeatures(DataStore store, String typeName, Feature... expected) throws Exception { try (Connection connection = ((JDBCDataStore) store).getConnection(Transaction.AUTO_COMMIT); GeopkgGeogigMetadata metadata = new GeopkgGeogigMetadata(connection)) { Map<String, String> mappings = metadata.getFidMappings(typeName); SimpleFeatureSource source = store.getFeatureSource(typeName); SimpleFeatureCollection features = source.getFeatures(); Map<String, Feature> expectedFeatures; { List<Feature> list = Lists.newArrayList(expected); expectedFeatures = Maps.uniqueIndex(list, (f) -> ((SimpleFeature) f).getID()); } Set<String> actualFeatureIDs = new HashSet<String>(); { try (SimpleFeatureIterator fiter = features.features()) { while (fiter.hasNext()) { SimpleFeature feature = fiter.next(); actualFeatureIDs.add(mappings.get(feature.getID().split("\\.")[1])); } } } Set<String> expectedFeatureIDs = expectedFeatures.keySet(); assertEquals(expectedFeatureIDs, actualFeatureIDs); } }
assertEquals(1, auditTables.size()); AuditTable table = auditTables.get(0); assertEquals("Points_audit", table.getAuditTable()); assertEquals("Points", table.getFeatureTreePath()); assertEquals("Points", table.getTableName()); assertEquals(headCommitId, table.getCommitId()); } finally { gttx.close();
assertEquals(1, auditTables.size()); AuditTable table = auditTables.get(0); assertEquals("Points_audit", table.getAuditTable()); assertEquals("Points", table.getFeatureTreePath()); assertEquals("Points", table.getTableName()); assertEquals(headCommitId, table.getCommitId()); } finally { gttx.close();