DBMSMetadata { public Connection getConnection() throws SQLException { return connection; } DBMSMetadata(Connection c);  DBMSMetadata(String user, String password, DBURI dbURI);  DBMSMetadata(Properties properties, DBURI dbURI);  DBMSMetadata(DBURI dbURI); Connection getConnection(); java.io.Reader getSourceCode(SourceObject sourceObject); java.io.Reader getSourceCode(String objectType, String name, String schema); List<SourceObject> getSourceObjectList(); List<SourceObject> getSourceObjectList(List<String> languages, List<String> schemas,
            List<String> sourceCodeTypes, List<String> sourceCodeNames);  }
@Test public void testGetConnectionWithConnectionParameters() throws Exception { System.out.println("getConnection"); String driverClass = dbURI5.getDriverClass(); System.out.println("driverClass==" + driverClass); System.out.println("URL==" + dbURI5.getURL()); Class.forName(driverClass); Object object = DriverManager.getDriver(dbURI5.getURL()); Properties properties = new Properties(); properties.putAll(dbURI5.getParameters()); Connection expResult = DriverManager.getDriver(dbURI5.getURL()).connect(dbURI5.getURL(), properties); DBMSMetadata instance = new DBMSMetadata(dbURI5); Connection result = instance.getConnection(); Assert.assertNotNull(result); }
@Test public void testGetSchemas() throws Exception { System.out.println("getSchemas"); DBURI testURI = dbURI4; String driverClass = testURI.getDriverClass(); System.out.println("driverClass==" + driverClass); System.out.println("URL==" + testURI.getURL()); Class.forName(driverClass); Object object = DriverManager.getDriver(testURI.getURL()); Properties properties = new Properties(); properties.put("user", "system"); properties.put("password", "oracle"); Connection expResult = DriverManager.getDriver(testURI.getURL()).connect(testURI.getURL(), properties); DBMSMetadata instance = new DBMSMetadata(testURI); Connection result = instance.getConnection(); Assert.assertNotNull(result); ResultSet allSchemas = result.getMetaData().getSchemas(); dumpResultSet(allSchemas, "All Schemas"); ResultSet allCatalogues = result.getMetaData().getCatalogs(); dumpResultSet(allCatalogues, "All Catalogues"); String catalog = null; String schemasPattern = "PHPDEMO"; String tablesPattern = null; String proceduresPattern = null; ResultSet matchedTables = result.getMetaData().getTables(catalog, schemasPattern, tablesPattern, null); dumpResultSet(matchedTables, "Matched Tables"); ResultSet matchedProcedures = result.getMetaData().getProcedures(catalog, schemasPattern, proceduresPattern); dumpResultSet(matchedProcedures, "Matched Procedures"); System.out.format("testURI=%s,\ngetParameters()=%s\n", C_ORACLE_THIN_4, testURI.getParameters()); System.out.format( "testURI=%s,\ngetSchemasList()=%s\n,getSourceCodeTypesList()=%s\n,getSourceCodeNmesList()=%s\n", testURI, testURI.getSchemasList(), testURI.getSourceCodeTypesList(), testURI.getSourceCodeNamesList()); }