public void testGetNames() throws IOException { String[] typeNames = dataStore.getTypeNames(); assertTrue(new HashSet(Arrays.asList(typeNames)).contains(tname("ft1"))); }
public void testTypeNames() throws Exception { String[] typeNamesArr = dataStore.getTypeNames(); assertNotNull("no types found", typeNamesArr); List<String> typeNames = Arrays.asList(typeNamesArr); assertFalse("no types found", typeNames.isEmpty()); List<String> expected = ((JDBCTypeNamesTestSetup) setup).getExpectedTypeNames(); // assertEquals("number of types unexpected ", expected.size(), typeNames.size()); for (String expectedType : expected) { String tn = tname(expectedType); assertTrue("type not returned by database: " + tn, typeNames.contains(tn)); } } }
public void testGetFeatureTypes() { try { String[] names = dataStore.getTypeNames(); assertTrue(contains(names, tname("road"))); assertTrue(contains(names, tname("river"))); } catch (IOException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); fail("An IOException has been thrown!"); } }
public void testCreateSchema() throws IOException { SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.init(lobSchema); tb.setName(tname("testLobCreate")); SimpleFeatureType ft = tb.buildFeatureType(); if (Arrays.asList(dataStore.getTypeNames()).contains(ft.getTypeName())) { dataStore.removeSchema(ft.getTypeName()); } dataStore.createSchema(ft); SimpleFeatureType ft2 = dataStore.getSchema(ft.getTypeName()); assertFeatureTypesEqual(ft, ft2); } }
private boolean needsToBeInitialized() throws DaoException{ try { // loop through all table names to see if the db name is one of them for (String typeName : store.getTypeNames()){ if (typeName.equals(SPATIAL_DB_NAME)) return false; } return true; }catch(IOException e){ throw new DaoException(e); } }
private boolean needsToBeInitialized() throws DaoException{ try { // loop through all table names to see if the db name is one of them for (String typeName : store.getTypeNames()){ if (typeName.equals(SPATIAL_DB_NAME)) return false; } return true; }catch(IOException e){ throw new DaoException(e); } }
protected SimpleFeatureType getFeatureType(VirtualTable vt) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works ds.addVirtualTable(new VirtualTable(vtName, vt)); return ds.getSchema(vtName); } finally { if(vtName != null) { ds.removeVirtualTable(vtName); } } }
protected SimpleFeatureType getFeatureType(VirtualTable vt) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works ds.createVirtualTable(new VirtualTable(vtName, vt)); return ds.getSchema(vtName); } finally { if (vtName != null) { ds.dropVirtualTable(vtName); } } }
/** * Checks the view definition works as expected and returns the feature type guessed solely by * looking at the sql and the first row of its output * * @param newSchema * @throws IOException */ protected SimpleFeatureType testViewDefinition(boolean guessGeometrySrid) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works VirtualTable vt = new VirtualTable(vtName, sql); paramProvider.updateVirtualTable(vt); ds.createVirtualTable(vt); return guessFeatureType(ds, vt.getName(), guessGeometrySrid); } finally { if (vtName != null) { ds.dropVirtualTable(vtName); } } }
/** * Checks the view definition works as expected and returns the feature type guessed solely by * looking at the sql and the first row of its output * * @param newSchema * @throws IOException */ protected SimpleFeatureType testViewDefinition( VirtualTable virtualTable, boolean guessGeometrySrid) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works VirtualTable vt = new VirtualTable(vtName, virtualTable); // hide the primary key definitions or we'll loose some columns vt.setPrimaryKeyColumns(Collections.emptyList()); vt.setEscapeSql(escapeSql); ds.createVirtualTable(vt); return guessFeatureType(ds, vt.getName(), guessGeometrySrid); } finally { if (vtName != null) { ds.dropVirtualTable(name); } } }
/** * Checks the view definition works as expected and returns the feature type guessed solely by * looking at the sql and the first row of its output * * @param newSchema * @return * @throws IOException */ protected SimpleFeatureType testViewDefinition(boolean guessGeometrySrid) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works VirtualTable vt = new VirtualTable(vtName, sql); paramProvider.updateVirtualTable(vt); ds.addVirtualTable(vt); return guessFeatureType(ds, vt.getName(), guessGeometrySrid); } finally { if(vtName != null) { ds.removeVirtualTable(vtName); } } }
/** * Checks the view definition works as expected and returns the feature type guessed solely by * looking at the sql and the first row of its output * * @param newSchema * @return * @throws IOException */ protected SimpleFeatureType testViewDefinition(VirtualTable virtualTable, boolean guessGeometrySrid) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works VirtualTable vt = new VirtualTable(vtName, virtualTable); // hide the primary key definitions or we'll loose some columns vt.setPrimaryKeyColumns(Collections.EMPTY_LIST); ds.addVirtualTable(vt); return guessFeatureType(ds, vt.getName(), guessGeometrySrid); } finally { if(vtName != null) { ds.removeVirtualTable(name); } } }
String granuleTableName = null; String collectionTableName = null; for (String name : delegate.getTypeNames()) { if (JDBCOpenSearchAccess.PRODUCT.equalsIgnoreCase(name)) { productTableName = name;
String granuleTableName = null; JDBCDataStore delegate = getRawDelegateStore(); for (String name : delegate.getTypeNames()) { if (JDBCOpenSearchAccess.PRODUCT.equalsIgnoreCase(name)) { productTableName = name;