From 63017dbf08c36c639e5551f05617f31d27d596f0 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 26 Mar 2015 20:48:45 +0100 Subject: [PATCH] pmd-core: convert util/database to junit 4 tests, indentation fixes --- .../pmd/util/database/DBMSMetadataTest.java | 531 ++++---- .../pmd/util/database/DBTypeTest.java | 189 +-- .../pmd/util/database/DBURITest.java | 1146 +++++++++-------- .../pmd/util/database/ResourceLoaderTest.java | 60 +- .../util/database/ResourceResolverTest.java | 60 +- 5 files changed, 979 insertions(+), 1007 deletions(-) diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBMSMetadataTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBMSMetadataTest.java index fb38ba2dc8..a11d4d4117 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBMSMetadataTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBMSMetadataTest.java @@ -1,3 +1,6 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.util.database; import java.io.IOException; @@ -12,320 +15,274 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.junit.*; // import annotations + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; /** * * @author sturton */ @Ignore -public class DBMSMetadataTest extends TestCase { +public class DBMSMetadataTest { - final static String C_ORACLE_THIN_1 = "jdbc:oracle:thin:scott/tiger@//192.168.100.21:5521/customer_db?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25"; + final static String C_ORACLE_THIN_1 = "jdbc:oracle:thin:scott/tiger@//192.168.100.21:5521/customer_db?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25"; - final static String C_ORACLE_THIN_3 = "jdbc:oracle:thin:scott/oracle@//192.168.100.21:1521/orcl?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25"; + final static String C_ORACLE_THIN_3 = "jdbc:oracle:thin:scott/oracle@//192.168.100.21:1521/orcl?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25"; - final static String C_ORACLE_THIN_4 = "jdbc:oracle:thin:system/oracle@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25"; + final static String C_ORACLE_THIN_4 = "jdbc:oracle:thin:system/oracle@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25"; - final static String C_ORACLE_THIN_5 = "jdbc:oracle:thin:@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25&user=system&password=oracle"; + final static String C_ORACLE_THIN_5 = "jdbc:oracle:thin:@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&objectTypes=procedures,functions,triggers,package,types&languages=plsql,java&name=PKG_%25%7C%7CPRC_%25&user=system&password=oracle"; - /** - * URI with minimum information, relying on defaults in testdefaults.properties - */ - final static String C_TEST_DEFAULTS = "jdbc:oracle:testdefault://192.168.100.21:1521/ORCL"; + /** + * URI with minimum information, relying on defaults in + * testdefaults.properties + */ + final static String C_TEST_DEFAULTS = "jdbc:oracle:testdefault://192.168.100.21:1521/ORCL"; + private DBURI dbURI; + private DBURI dbURI4; + private DBURI dbURI5; + private DBURI dbURIDefault; - private DBURI dbURI; - private DBURI dbURI4; - private DBURI dbURI5; - private DBURI dbURIDefault; - - public DBMSMetadataTest(String testName) throws URISyntaxException, Exception { - super(testName); - dbURI = new DBURI (C_ORACLE_THIN_3); - dbURI4 = new DBURI (C_ORACLE_THIN_4); - dbURI5 = new DBURI (C_ORACLE_THIN_5); - dbURIDefault = new DBURI (C_TEST_DEFAULTS); - } - - public static Test suite() { - TestSuite suite = new TestSuite(DBMSMetadataTest.class); - return suite; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - /* - * Convert Readers to Strings for eay output and comparison. - */ - - private static String getStringFromReader (Reader reader) throws IOException - { - - StringBuilder stringBuilder = new StringBuilder(1024); - char[] charArray = new char[1024]; - int readChars ; - while(( readChars = reader.read(charArray)) > 0 ) - { - System.out.println("Reader.read(CharArray)=="+readChars); - stringBuilder.append(charArray, 0, readChars); + public DBMSMetadataTest() throws URISyntaxException, Exception { + dbURI = new DBURI(C_ORACLE_THIN_3); + dbURI4 = new DBURI(C_ORACLE_THIN_4); + dbURI5 = new DBURI(C_ORACLE_THIN_5); + dbURIDefault = new DBURI(C_TEST_DEFAULTS); } - reader.close(); - - return stringBuilder.toString() ; - - } + /** + * Convert Readers to Strings for eay output and comparison. + */ + private static String getStringFromReader(Reader reader) throws IOException { - /* - * Dump ResultSet - */ - - private static void dumpResultSet (ResultSet resultSet, String description) - { - - try { - - ResultSetMetaData metaData = resultSet.getMetaData(); - - int columnCount = metaData.getColumnCount() ; - - System.out.format("ResultSet \"%s\" has %d columns and contains ...\n[" - , description - , columnCount - ); - - /* - * Walk through the column names, writing out a header line - */ - for (int columnNumber = 1 - ; columnNumber <= columnCount - ; columnNumber++ - ) - { - System.out.format("%s%s" - , ((columnNumber > 1) ? "," : "" ) - , metaData.getColumnName(columnNumber) - ); - } - System.out.format("\n"); - - - // Output each row - while (resultSet.next()) - { - /* - * Walk through the columns of this row, writing out a row line - */ - for (int columnNumber = 1 - ; columnNumber <= columnCount - ; columnNumber++ - ) - { - System.out.format("%s%s" - , ((columnNumber > 0) ? "," : "" ) - , resultSet.getString(columnNumber) - ); + StringBuilder stringBuilder = new StringBuilder(1024); + char[] charArray = new char[1024]; + int readChars; + while ((readChars = reader.read(charArray)) > 0) { + System.out.println("Reader.read(CharArray)==" + readChars); + stringBuilder.append(charArray, 0, readChars); } - System.out.format("\n"); + reader.close(); - } + return stringBuilder.toString(); - } catch (SQLException ex) { - Logger.getLogger(DBMSMetadataTest.class.getName()).log(Level.SEVERE, null, ex); } - System.out.format("...\n]\n", description ); - } + /** + * Dump ResultSet + */ + private static void dumpResultSet(ResultSet resultSet, String description) { - /** - * Verify getConnection method, of class DBMSMetadata. - */ - public void testGetConnection() throws Exception { - System.out.println("getConnection"); - String driverClass = dbURI.getDriverClass(); - System.out.println("driverClass=="+driverClass); - System.out.println("URL=="+dbURI.getURL()); - Class.forName(driverClass); - Object object = DriverManager.getDriver(dbURI.getURL()) ; - //Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; - Properties properties = new Properties(); - properties.put("user","system"); - properties.put("password","oracle"); - Connection expResult = DriverManager.getDriver(dbURI.getURL()).connect(dbURI.getURL(), properties); - DBMSMetadata instance = new DBMSMetadata(dbURI ); - Connection result = instance.getConnection(); - assertNotNull(result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + try { - /** - * Verify getConnection method, of class DBMSMetadata. - */ - 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()) ; - //Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; - 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(); - assertNotNull(result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + ResultSetMetaData metaData = resultSet.getMetaData(); - /** - * Test of getSourceCode method, of class DBMSMetadata. - */ - public void testGetSourceCode() throws Exception { - System.out.println("getSourceCode"); - //String objectType = "PACKAGE"; - //String name = "DBMS_REPCAT_AUTH"; - //String schema = "SYSTEM"; - String objectType = "TABLE"; - String name = "EMP"; - String schema = "SCOTT"; - System.out.println("dbURI.driverClass=="+dbURI.getDriverClass()); - System.out.println("dbURI.URL=="+dbURI.getURL()); - System.out.println("dbURI.getDBType.getProperties()=="+dbURI.getDbType().getProperties() ); - System.out.println("dbURI.getDBType.getSourceCodeReturnType()=="+dbURI.getDbType().getSourceCodeReturnType() ); - System.out.println("dbURI.getDBType.getProperties()=="+dbURI.getDbType().getProperties().getProperty("getSourceCodeStatement") ); - DBMSMetadata instance = new DBMSMetadata(dbURI ); - Reader expResult = null; - Reader result = instance.getSourceCode(objectType, name, schema); + int columnCount = metaData.getColumnCount(); - /* - StringBuilder stringBuilder = new StringBuilder(1024); - char[] charArray = new char[1024]; - int readChars = 0; - while(( readChars = result.read(charArray)) > 0 ) - { - System.out.println("Reader.read(CharArray)=="+readChars); - stringBuilder.append(charArray, 0, readChars); + System.out.format("ResultSet \"%s\" has %d columns and contains ...\n[", description, columnCount); + + /* + * Walk through the column names, writing out a header line + */ + for (int columnNumber = 1; columnNumber <= columnCount; columnNumber++) { + System.out.format("%s%s", ((columnNumber > 1) ? "," : ""), metaData.getColumnName(columnNumber)); + } + System.out.format("\n"); + + // Output each row + while (resultSet.next()) { + /* + * Walk through the columns of this row, writing out a row line + */ + for (int columnNumber = 1; columnNumber <= columnCount; columnNumber++) { + System.out.format("%s%s", ((columnNumber > 0) ? "," : ""), resultSet.getString(columnNumber)); + } + System.out.format("\n"); + + } + + } catch (SQLException ex) { + Logger.getLogger(DBMSMetadataTest.class.getName()).log(Level.SEVERE, null, ex); + } + System.out.format("...\n]\n", description); } - result.close(); - - System.out.println("getSourceCode()==\""+stringBuilder.toString()+"\""); - - assertTrue(stringBuilder.toString().startsWith("\n CREATE ")); - */ - String resultString = getStringFromReader ( result ); - - System.out.println("getSourceCode()==\""+resultString ); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } - - - /** - * Verify getSchemas method, of class DBMSMetadata. - */ - 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()) ; - //Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; - 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(); - 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 ; - // Not until Java6 ResultSet matchedSchemas = result.getMetaData().getSchemas(catalog, schemasPattern) ; - // Not until Java6 dumpResultSet (matchedSchemas, "Matched Schemas") ; - 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() - ); - - } - - - /** - * Verify getSchemas method, of class DBMSMetadata. - */ - public void testGetSourceObjectList() throws Exception { - System.out.println("getConnection"); - 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()) ; - //Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; - 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(); - assertNotNull(result); - - List sourceObjectList = instance.getSourceObjectList(); - assertNotNull(sourceObjectList); - - 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() - ); - - System.out.printf("sourceObjectList ...\n" ); - for (SourceObject sourceObject : sourceObjectList) - { - System.out.printf("sourceObject=%s\n", sourceObject); - System.out.printf("sourceCode=[%s]\n", getStringFromReader(instance.getSourceCode(sourceObject)) ); + /** + * Verify getConnection method, of class DBMSMetadata. + */ + @org.junit.Test + public void testGetConnection() throws Exception { + System.out.println("getConnection"); + String driverClass = dbURI.getDriverClass(); + System.out.println("driverClass==" + driverClass); + System.out.println("URL==" + dbURI.getURL()); + Class.forName(driverClass); + Object object = DriverManager.getDriver(dbURI.getURL()); + // Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; + Properties properties = new Properties(); + properties.put("user", "system"); + properties.put("password", "oracle"); + Connection expResult = DriverManager.getDriver(dbURI.getURL()).connect(dbURI.getURL(), properties); + DBMSMetadata instance = new DBMSMetadata(dbURI); + Connection result = instance.getConnection(); + Assert.assertNotNull(result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } + + /** + * Verify getConnection method, of class DBMSMetadata. + */ + @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()); + // Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; + 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); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } + + /** + * Test of getSourceCode method, of class DBMSMetadata. + */ + @Test + public void testGetSourceCode() throws Exception { + System.out.println("getSourceCode"); + // String objectType = "PACKAGE"; + // String name = "DBMS_REPCAT_AUTH"; + // String schema = "SYSTEM"; + String objectType = "TABLE"; + String name = "EMP"; + String schema = "SCOTT"; + System.out.println("dbURI.driverClass==" + dbURI.getDriverClass()); + System.out.println("dbURI.URL==" + dbURI.getURL()); + System.out.println("dbURI.getDBType.getProperties()==" + dbURI.getDbType().getProperties()); + System.out.println("dbURI.getDBType.getSourceCodeReturnType()==" + dbURI.getDbType().getSourceCodeReturnType()); + System.out.println("dbURI.getDBType.getProperties()==" + + dbURI.getDbType().getProperties().getProperty("getSourceCodeStatement")); + DBMSMetadata instance = new DBMSMetadata(dbURI); + Reader expResult = null; + Reader result = instance.getSourceCode(objectType, name, schema); + + /* + * StringBuilder stringBuilder = new StringBuilder(1024); char[] + * charArray = new char[1024]; int readChars = 0; while(( readChars = + * result.read(charArray)) > 0 ) { + * System.out.println("Reader.read(CharArray)=="+readChars); + * stringBuilder.append(charArray, 0, readChars); } result.close(); + * + * System.out.println("getSourceCode()==\""+stringBuilder.toString()+"\"" + * ); + * + * assertTrue(stringBuilder.toString().startsWith("\n CREATE ")); + */ + + String resultString = getStringFromReader(result); + + System.out.println("getSourceCode()==\"" + resultString); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } + + /** + * Verify getSchemas method, of class DBMSMetadata. + */ + @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()); + // Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; + 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; + // Not until Java6 ResultSet matchedSchemas = + // result.getMetaData().getSchemas(catalog, schemasPattern) ; + // Not until Java6 dumpResultSet (matchedSchemas, "Matched Schemas") ; + 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()); + + } + + /** + * Verify getSchemas method, of class DBMSMetadata. + */ + @Test + public void testGetSourceObjectList() throws Exception { + System.out.println("getConnection"); + 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()); + // Object object = DriverManager.getDriver(C_ORACLE_OCI_3) ; + 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); + + List sourceObjectList = instance.getSourceObjectList(); + Assert.assertNotNull(sourceObjectList); + + 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()); + + System.out.printf("sourceObjectList ...\n"); + for (SourceObject sourceObject : sourceObjectList) { + System.out.printf("sourceObject=%s\n", sourceObject); + System.out.printf("sourceCode=[%s]\n", getStringFromReader(instance.getSourceCode(sourceObject))); + } } - } } diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBTypeTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBTypeTest.java index bec545c53c..c8cc04b240 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBTypeTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBTypeTest.java @@ -1,3 +1,6 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.util.database; import java.io.File; @@ -6,114 +9,116 @@ import java.io.PrintStream; import java.util.Map.Entry; import java.util.Properties; import java.util.ResourceBundle; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; + +import org.apache.commons.io.IOUtils; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; /** * * @author sturton */ -public class DBTypeTest extends TestCase { - - private static String TEST_FILE_NAME ="/tmp/test.properties"; +public class DBTypeTest { - private File absoluteFile = new File(TEST_FILE_NAME); + private static String TEST_FILE_NAME = "/tmp/test.properties"; - private Properties testProperties; - private Properties includeProperties; + private File absoluteFile = new File(TEST_FILE_NAME); - public DBTypeTest(String testName) { - super(testName); - } + private Properties testProperties; + private Properties includeProperties; - public static Test suite() { - TestSuite suite = new TestSuite(DBTypeTest.class); - return suite; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { + testProperties = new Properties(); + testProperties.put("prop1", "value1"); + testProperties.put("prop2", "value2"); + testProperties.put("prop3", "value3"); - testProperties = new Properties(); - testProperties.put("prop1", "value1"); - testProperties.put("prop2", "value2"); - testProperties.put("prop3", "value3"); + includeProperties = new Properties(); + includeProperties.putAll(testProperties); + includeProperties.put("prop3", "include3"); - includeProperties = new Properties(); - includeProperties.putAll(testProperties); - includeProperties.put("prop3", "include3"); + PrintStream printStream = null; + try { + FileOutputStream fileOutputStream = new FileOutputStream(absoluteFile); + printStream = new PrintStream(fileOutputStream); - FileOutputStream fileOutputStream = new FileOutputStream(absoluteFile); - PrintStream printStream = new PrintStream(fileOutputStream); - - for (Entry entry : testProperties.entrySet() ) - { - printStream.printf("%s=%s\n", entry.getKey(), entry.getValue()); + for (Entry entry : testProperties.entrySet()) { + printStream.printf("%s=%s\n", entry.getKey(), entry.getValue()); + } + } finally { + IOUtils.closeQuietly(printStream); + } } - } - - @Override - protected void tearDown() throws Exception { - testProperties = null; - super.tearDown(); - } + @After + public void tearDown() throws Exception { + testProperties = null; + } - /** - * Test of getProperties method, of class DBType. - */ - public void testGetPropertiesFromFile() throws Exception { - System.out.println("getPropertiesFromFile"); - DBType instance = new DBType("/tmp/test.properties"); - Properties expResult = testProperties; - Properties result = instance.getProperties(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getProperties method, of class DBType. + */ + @Test + public void testGetPropertiesFromFile() throws Exception { + System.out.println("getPropertiesFromFile"); + DBType instance = new DBType("/tmp/test.properties"); + Properties expResult = testProperties; + Properties result = instance.getProperties(); + Assert.assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getProperties method, of class DBType. - */ - public void testGetProperties() throws Exception { - System.out.println("testGetProperties"); - DBType instance = new DBType("test"); - Properties expResult = testProperties; - System.out.println("testGetProperties: expected results "+ testProperties); - Properties result = instance.getProperties(); - System.out.println("testGetProperties: actual results "+ result); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getProperties method, of class DBType. + */ + @Test + public void testGetProperties() throws Exception { + System.out.println("testGetProperties"); + DBType instance = new DBType("test"); + Properties expResult = testProperties; + System.out.println("testGetProperties: expected results " + testProperties); + Properties result = instance.getProperties(); + System.out.println("testGetProperties: actual results " + result); + Assert.assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getProperties method, of class DBType. - */ - public void testGetIncludeProperties() throws Exception { - System.out.println("testGetIncludeProperties"); - DBType instance = new DBType("include"); - Properties expResult = includeProperties; - System.out.println("testGetIncludeProperties: expected results "+ includeProperties); - Properties result = instance.getProperties(); - System.out.println("testGetIncludeProperties: actual results "+ result); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getProperties method, of class DBType. + */ + @Test + public void testGetIncludeProperties() throws Exception { + System.out.println("testGetIncludeProperties"); + DBType instance = new DBType("include"); + Properties expResult = includeProperties; + System.out.println("testGetIncludeProperties: expected results " + includeProperties); + Properties result = instance.getProperties(); + System.out.println("testGetIncludeProperties: actual results " + result); + Assert.assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getResourceBundleAsProperties method, of class DBType. - */ - public void testAsProperties() { - System.out.println("asProperties"); - ResourceBundle bundle = ResourceBundle.getBundle(DBType.class.getCanonicalName()+".test"); - Properties expResult = testProperties; - Properties result = DBType.getResourceBundleAsProperties(bundle); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getResourceBundleAsProperties method, of class DBType. + */ + @Test + public void testAsProperties() { + System.out.println("asProperties"); + ResourceBundle bundle = ResourceBundle.getBundle(DBType.class.getCanonicalName() + ".test"); + Properties expResult = testProperties; + Properties result = DBType.getResourceBundleAsProperties(bundle); + Assert.assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } } diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBURITest.java b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBURITest.java index a23b3738f3..5d51373ffa 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBURITest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/DBURITest.java @@ -1,630 +1,668 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.util.database; +import static org.junit.Assert.assertEquals; + import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import static junit.framework.Assert.assertEquals; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; + +import org.junit.Test; /** * * @author sturton */ -public class DBURITest extends TestCase { - - /** - * URI with minimum information, relying on defaults in testdefaults.properties - */ - final static String C_TEST_DEFAULTS = "jdbc:oracle:testdefault://192.168.100.21:1521/ORCL"; +public class DBURITest { - /* - * Expected values from testdefaults.properties - */ - final static String C_DEFAULT_USER = "scott"; - final static String C_DEFAULT_PASSWORD = "tiger"; - final static String C_DEFAULT_LANGUAGES = "java,plsql"; - final static String C_DEFAULT_SCHEMAS = "scott,system"; - final static String C_DEFAULT_SOURCE_CODE_TYPES = "table,view"; - final static String C_DEFAULT_SOURCE_CODE_NAMES = "emp,dept"; - final static String C_DEFAULT_CHARACTERSET = "utf8"; - - /** - * Fully specified URI, overriding defaults in testdefaults.properties - */ - final static String C_TEST_EXPLICIT = "jdbc:oracle:testdefault:system/oracle@//192.168.100.21:1521/ORCL?characterset=us7ascii&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java&sourcecodenames=PKG_%25%25,PRC_%25%25"; + /** + * URI with minimum information, relying on defaults in + * testdefaults.properties + */ + final static String C_TEST_DEFAULTS = "jdbc:oracle:testdefault://192.168.100.21:1521/ORCL"; - /* - * Expected values from testdefaults.properties, with values overridden by URI query parameters - */ - final static String C_EXPLICIT_USER = "system"; - final static String C_EXPLICIT_PASSWORD = "oracle"; - final static String C_EXPLICIT_LANGUAGES = "plsql,java"; - final static String C_EXPLICIT_SCHEMAS = "scott,hr,sh,system"; - final static String C_EXPLICIT_SOURCE_CODE_TYPES = "procedures,functions,triggers,package,types"; - final static String C_EXPLICIT_SOURCE_CODE_NAMES = "PKG_%%,PRC_%%"; - final static String C_EXPLICIT_CHARACTERSET = "us7ascii"; - - final static String C_TEST_URI = "test?param1=x%261¶m2=¶m3="; - final static String C_ORACLE_OCI_1 = "jdbc:oracle:oci:system/oracle@//192.168.100.21:1521/ORCL"; - final static String C_ORACLE_OCI_2 = "jdbc:oracle:oci:system/oracle@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java"; - final static String C_ORACLE_OCI_3 = "jdbc:oracle:oci:system/oracle@//myserver.com:1521/customer_db?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java&sourcecodenames=PKG_%25%25,PRC_%25%25"; + /* + * Expected values from testdefaults.properties + */ + final static String C_DEFAULT_USER = "scott"; + final static String C_DEFAULT_PASSWORD = "tiger"; + final static String C_DEFAULT_LANGUAGES = "java,plsql"; + final static String C_DEFAULT_SCHEMAS = "scott,system"; + final static String C_DEFAULT_SOURCE_CODE_TYPES = "table,view"; + final static String C_DEFAULT_SOURCE_CODE_NAMES = "emp,dept"; + final static String C_DEFAULT_CHARACTERSET = "utf8"; - final static String C_ORACLE_THIN_1 = "jdbc:oracle:thin:system/oracle@//192.168.100.21:1521/ORCL"; - final static String C_ORACLE_THIN_2 = "jdbc:oracle:thin:system/oracle@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java"; - final static String C_ORACLE_THIN_3 = "jdbc:oracle:thin:system/oracle@//myserver.com:1521/customer_db?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java&sourcecodenames=PKG_%25%25,PRC_%25%25"; + /** + * Fully specified URI, overriding defaults in testdefaults.properties + */ + final static String C_TEST_EXPLICIT = "jdbc:oracle:testdefault:system/oracle@//192.168.100.21:1521/ORCL?characterset=us7ascii&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java&sourcecodenames=PKG_%25%25,PRC_%25%25"; - final static String C_POSTGRES_1 = "jdbc:postgresql://host/database"; - final static String C_HTTP = "http://localhost:80?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java"; + /* + * Expected values from testdefaults.properties, with values overridden by + * URI query parameters + */ + final static String C_EXPLICIT_USER = "system"; + final static String C_EXPLICIT_PASSWORD = "oracle"; + final static String C_EXPLICIT_LANGUAGES = "plsql,java"; + final static String C_EXPLICIT_SCHEMAS = "scott,hr,sh,system"; + final static String C_EXPLICIT_SOURCE_CODE_TYPES = "procedures,functions,triggers,package,types"; + final static String C_EXPLICIT_SOURCE_CODE_NAMES = "PKG_%%,PRC_%%"; + final static String C_EXPLICIT_CHARACTERSET = "us7ascii"; - static void dump(String description , URI dburi) { - System.err.printf("Test %s\n: isOpaque=%s, isAbsolute=%s Scheme=%s,\n SchemeSpecificPart=%s,\n Host=%s,\n Port=%s,\n Path=%s,\n Fragment=%s,\n Query=%s\n" - , description - , dburi.isOpaque() - , dburi.isAbsolute() - , dburi.getScheme() - , dburi.getSchemeSpecificPart() - , dburi.getHost() - , dburi.getPort() - , dburi.getPath() - , dburi.getFragment() - , dburi.getQuery() - ); - String query = dburi.getQuery(); - if (null != query && !query.equals("")) - { - String[] params = query.split("&"); - Map map = new HashMap(); - for (String param : params) - { - String[] splits = param.split("="); - String name =splits[0]; - String value = null ; - if (splits.length > 1 ) - { - value = splits[1] ; - } - map.put(name, value); - System.err.printf("name=%s,value=%s\n",name,value); - } + final static String C_TEST_URI = "test?param1=x%261¶m2=¶m3="; + final static String C_ORACLE_OCI_1 = "jdbc:oracle:oci:system/oracle@//192.168.100.21:1521/ORCL"; + final static String C_ORACLE_OCI_2 = "jdbc:oracle:oci:system/oracle@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java"; + final static String C_ORACLE_OCI_3 = "jdbc:oracle:oci:system/oracle@//myserver.com:1521/customer_db?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java&sourcecodenames=PKG_%25%25,PRC_%25%25"; + + final static String C_ORACLE_THIN_1 = "jdbc:oracle:thin:system/oracle@//192.168.100.21:1521/ORCL"; + final static String C_ORACLE_THIN_2 = "jdbc:oracle:thin:system/oracle@//192.168.100.21:1521/ORCL?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java"; + final static String C_ORACLE_THIN_3 = "jdbc:oracle:thin:system/oracle@//myserver.com:1521/customer_db?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java&sourcecodenames=PKG_%25%25,PRC_%25%25"; + + final static String C_POSTGRES_1 = "jdbc:postgresql://host/database"; + final static String C_HTTP = "http://localhost:80?characterset=utf8&schemas=scott,hr,sh,system&sourcecodetypes=procedures,functions,triggers,package,types&languages=plsql,java"; + + static void dump(String description, URI dburi) { + System.err + .printf("Test %s\n: isOpaque=%s, isAbsolute=%s Scheme=%s,\n SchemeSpecificPart=%s,\n Host=%s,\n Port=%s,\n Path=%s,\n Fragment=%s,\n Query=%s\n", + description, dburi.isOpaque(), dburi.isAbsolute(), dburi.getScheme(), + dburi.getSchemeSpecificPart(), dburi.getHost(), dburi.getPort(), dburi.getPath(), + dburi.getFragment(), dburi.getQuery()); + String query = dburi.getQuery(); + if (null != query && !query.equals("")) { + String[] params = query.split("&"); + Map map = new HashMap(); + for (String param : params) { + String[] splits = param.split("="); + String name = splits[0]; + String value = null; + if (splits.length > 1) { + value = splits[1]; + } + map.put(name, value); + System.err.printf("name=%s,value=%s\n", name, value); + } + } + // return map; } - //return map; - } - - public DBURITest(String testName) { - super(testName); - } - public static Test suite() { - TestSuite suite = new TestSuite(DBURITest.class); - return suite; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } + /** + * Test of dump method, of class DBURI. + */ + @Test + public void testDump() throws URISyntaxException, Exception { + System.out.println("dump"); + String description = ""; + DBURI dburi = new DBURI(C_TEST_URI); + DBURI.dump(description, dburi.getUri()); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of dump method, of class DBURI. - */ - public void testDump() throws URISyntaxException, Exception { - System.out.println("dump"); - String description = ""; - DBURI dburi = new DBURI(C_TEST_URI) ; - DBURI.dump(description, dburi.getUri()); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getUri method, of class DBURI. + */ + @Test + public void testGetUri() throws URISyntaxException, Exception { + System.out.println("getUri"); + DBURI instance = new DBURI(C_ORACLE_OCI_1); + URI expResult = new URI(C_ORACLE_OCI_1); + URI result = instance.getUri(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getUri method, of class DBURI. - */ - public void testGetUri() throws URISyntaxException, Exception { - System.out.println("getUri"); - DBURI instance = new DBURI(C_ORACLE_OCI_1) ; - URI expResult = new URI(C_ORACLE_OCI_1) ; - URI result = instance.getUri(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setUri method, of class DBURI. + */ + @Test + public void testSetUri() throws URISyntaxException, Exception { + System.out.println("setUri"); + URI uri = new URI(C_ORACLE_OCI_1); + DBURI instance = new DBURI(C_TEST_URI); + instance.setUri(uri); + assertEquals(uri, instance.getUri()); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setUri method, of class DBURI. - */ - public void testSetUri() throws URISyntaxException, Exception { - System.out.println("setUri"); - URI uri = new URI(C_ORACLE_OCI_1) ; - DBURI instance = new DBURI(C_TEST_URI) ; - instance.setUri(uri); - assertEquals(uri, instance.getUri()); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getDbType method, of class DBURI. + */ + @Test + public void testGetDbType() throws URISyntaxException, Exception { + System.out.println("getDbType"); + DBURI instance = new DBURI(C_POSTGRES_1); + DBType expResult = new DBType("postgresql"); + DBType result = instance.getDbType(); + // assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getDbType method, of class DBURI. - */ - public void testGetDbType() throws URISyntaxException, Exception { - System.out.println("getDbType"); - DBURI instance = new DBURI(C_POSTGRES_1); - DBType expResult = new DBType("postgresql"); - DBType result = instance.getDbType(); - //assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getDbType method, of class DBURI. + */ + @Test + public void testGetDbType2() throws URISyntaxException, Exception { + System.out.println("getDbType"); + DBURI instance = new DBURI(C_ORACLE_OCI_1); + DBType expResult = new DBType("oci"); + DBType result = instance.getDbType(); + // assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getDbType method, of class DBURI. - */ - public void testGetDbType2() throws URISyntaxException, Exception { - System.out.println("getDbType"); - DBURI instance = new DBURI(C_ORACLE_OCI_1); - DBType expResult = new DBType("oci"); - DBType result = instance.getDbType(); - //assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setDbType method, of class DBURI. + */ + @Test + public void testSetDbType() throws URISyntaxException, Exception { + System.out.println("setDbType"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + DBType dbType = new DBType("postgresql"); + instance.setDbType(dbType); + assertEquals(dbType, instance.getDbType()); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setDbType method, of class DBURI. - */ - public void testSetDbType() throws URISyntaxException, Exception { - System.out.println("setDbType"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - DBType dbType = new DBType("postgresql"); - instance.setDbType(dbType); - assertEquals(dbType, instance.getDbType()); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getSchemasList method, of class DBURI. + */ + @Test + public void testGetSchemasList() throws URISyntaxException, Exception { + System.out.println("getSchemasList"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + List expResult; + expResult = Arrays.asList("scott,hr,sh,system".split(",")); + List result = instance.getSchemasList(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getSchemasList method, of class DBURI. - */ - public void testGetSchemasList() throws URISyntaxException, Exception { - System.out.println("getSchemasList"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - List expResult; - expResult = Arrays.asList("scott,hr,sh,system".split(",")); - List result = instance.getSchemasList(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setSchemasList method, of class DBURI. + */ + @Test + public void testSetSchemasList() throws URISyntaxException, Exception { + System.out.println("setSchemasList"); + List schemasList = Arrays.asList("scott,hr,sh,system".split(",")); + DBURI instance = new DBURI(C_ORACLE_OCI_1); + instance.setSchemasList(schemasList); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setSchemasList method, of class DBURI. - */ - public void testSetSchemasList() throws URISyntaxException, Exception { - System.out.println("setSchemasList"); - List schemasList = Arrays.asList("scott,hr,sh,system".split(",")); - DBURI instance = new DBURI(C_ORACLE_OCI_1); - instance.setSchemasList(schemasList); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getSourceCodeTypesList method, of class DBURI. + */ + @Test + public void testGetSourceCodeTypesList() throws URISyntaxException, Exception { + System.out.println("getSourceCodeTypesList"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + List expResult = Arrays.asList("procedures,functions,triggers,package,types".split(",")); + List result = instance.getSourceCodeTypesList(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getSourceCodeTypesList method, of class DBURI. - */ - public void testGetSourceCodeTypesList() throws URISyntaxException, Exception { - System.out.println("getSourceCodeTypesList"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - List expResult = Arrays.asList("procedures,functions,triggers,package,types".split(",")); - List result = instance.getSourceCodeTypesList(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setSourceCodeTypesList method, of class DBURI. + */ + @Test + public void testSetSourceCodeTypesList() throws URISyntaxException, Exception { + System.out.println("setSourceCodeTypesList"); + List sourcecodetypesList = Arrays.asList("procedures,functions,triggers,package,types".split(",")); + DBURI instance = new DBURI(C_ORACLE_OCI_1); + instance.setSourceCodeTypesList(sourcecodetypesList); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setSourceCodeTypesList method, of class DBURI. - */ - public void testSetSourceCodeTypesList() throws URISyntaxException, Exception { - System.out.println("setSourceCodeTypesList"); - List sourcecodetypesList = Arrays.asList("procedures,functions,triggers,package,types".split(",")); - DBURI instance = new DBURI(C_ORACLE_OCI_1); - instance.setSourceCodeTypesList(sourcecodetypesList); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getSourceCodeNamesList method, of class DBURI. + */ + @Test + public void testGetSourceCodeNamesList() throws URISyntaxException, Exception { + System.out.println("getSourceCodeNamesList"); + DBURI instance = new DBURI(C_ORACLE_OCI_3); + List expResult = Arrays.asList("PKG_%%,PRC_%%".split(",")); + List result = instance.getSourceCodeNamesList(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getSourceCodeNamesList method, of class DBURI. - */ - public void testGetSourceCodeNamesList() throws URISyntaxException, Exception { - System.out.println("getSourceCodeNamesList"); - DBURI instance = new DBURI(C_ORACLE_OCI_3); - List expResult = Arrays.asList("PKG_%%,PRC_%%".split(",")); - List result = instance.getSourceCodeNamesList(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setSourceCodeNamesList method, of class DBURI. + */ + @Test + public void testSetSourceCodeNamesList() throws URISyntaxException, Exception { + System.out.println("setSourceCodeNamesList"); + List sourceCodeNamesList = Arrays.asList("PKG_%%,TRG_%%".split(",")); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + instance.setSourceCodeNamesList(sourceCodeNamesList); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setSourceCodeNamesList method, of class DBURI. - */ - public void testSetSourceCodeNamesList() throws URISyntaxException, Exception { - System.out.println("setSourceCodeNamesList"); - List sourceCodeNamesList = Arrays.asList("PKG_%%,TRG_%%".split(",")); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - instance.setSourceCodeNamesList(sourceCodeNamesList); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getLanguagesList method, of class DBURI. + */ + @Test + public void testGetLanguagesList() throws URISyntaxException, Exception { + System.out.println("getLanguagesList"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + List expResult = Arrays.asList("plsql,java".split(",")); + List result = instance.getLanguagesList(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getLanguagesList method, of class DBURI. - */ - public void testGetLanguagesList() throws URISyntaxException, Exception { - System.out.println("getLanguagesList"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - List expResult = Arrays.asList("plsql,java".split(",")); - List result = instance.getLanguagesList(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setLanguagesList method, of class DBURI. + */ + @Test + public void testSetLanguagesList() throws URISyntaxException, Exception { + System.out.println("setLanguagesList"); + List languagesList = Arrays.asList("plsql,java".split(",")); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + instance.setLanguagesList(languagesList); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setLanguagesList method, of class DBURI. - */ - public void testSetLanguagesList() throws URISyntaxException, Exception { - System.out.println("setLanguagesList"); - List languagesList = Arrays.asList("plsql,java".split(",")); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - instance.setLanguagesList(languagesList); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getDriverClass method, of class DBURI. + */ + @Test + public void testGetDriverClass() throws URISyntaxException, Exception { + System.out.println("getDriverClass"); + DBURI instance = new DBURI(C_ORACLE_OCI_1); + String expResult = "oracle.jdbc.OracleDriver"; + String result = instance.getDriverClass(); + System.out.println("testGetDriverClass: driverClass=" + result); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getDriverClass method, of class DBURI. - */ - public void testGetDriverClass() throws URISyntaxException, Exception { - System.out.println("getDriverClass"); - DBURI instance = new DBURI(C_ORACLE_OCI_1); - String expResult = "oracle.jdbc.OracleDriver"; - String result = instance.getDriverClass(); - System.out.println("testGetDriverClass: driverClass="+result); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getDriverClass method, of class DBURI. + */ + @Test + public void testGetThinDriverClass() throws URISyntaxException, Exception { + System.out.println("getThinDriverClass"); + DBURI instance = new DBURI(C_ORACLE_THIN_1); + String expResult = "oracle.jdbc.OracleDriver"; + String result = instance.getDriverClass(); + System.out.println("testGetThinDriverClass: driverClass=" + result); + System.out.println("testGetThinDriverClass: getDbType().getProperties() follows"); + System.out.println("testGetThinDriverClass: getDbType().getProperties()=" + + instance.getDbType().getProperties()); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } + /** + * Test of setDriverClass method, of class DBURI. + */ + @Test + public void testSetDriverClass() throws URISyntaxException, Exception { + System.out.println("setDriverClass"); + String driverClass = "oracle.jdbc.driver.OracleDriver"; + DBURI instance = new DBURI(C_ORACLE_OCI_1); + instance.setDriverClass(driverClass); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getDriverClass method, of class DBURI. - */ - public void testGetThinDriverClass() throws URISyntaxException, Exception { - System.out.println("getThinDriverClass"); - DBURI instance = new DBURI(C_ORACLE_THIN_1); - String expResult = "oracle.jdbc.OracleDriver"; - String result = instance.getDriverClass(); - System.out.println("testGetThinDriverClass: driverClass="+result); - System.out.println("testGetThinDriverClass: getDbType().getProperties() follows"); - System.out.println("testGetThinDriverClass: getDbType().getProperties()="+instance.getDbType().getProperties()); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getCharacterSet method, of class DBURI. + */ + @Test + public void testGetCharacterSet() throws URISyntaxException, Exception { + System.out.println("getCharacterSet"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + String expResult = "utf8"; + String result = instance.getCharacterSet(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setDriverClass method, of class DBURI. - */ - public void testSetDriverClass() throws URISyntaxException, Exception { - System.out.println("setDriverClass"); - String driverClass = "oracle.jdbc.driver.OracleDriver"; - DBURI instance = new DBURI(C_ORACLE_OCI_1); - instance.setDriverClass(driverClass); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setCharacterSet method, of class DBURI. + */ + @Test + public void testSetCharacterSet() throws URISyntaxException, Exception { + System.out.println("setCharacterSet"); + String characterSet = "utf8"; + DBURI instance = new DBURI(C_POSTGRES_1); + instance.setCharacterSet(characterSet); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getCharacterSet method, of class DBURI. - */ - public void testGetCharacterSet() throws URISyntaxException, Exception { - System.out.println("getCharacterSet"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - String expResult = "utf8"; - String result = instance.getCharacterSet(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getSourceCodeType method, of class DBURI. + */ + @Test + public void testGetSourceCodeType() throws URISyntaxException, Exception { + System.out.println("getSourceCodeType"); + DBURI instance = new DBURI(C_ORACLE_OCI_1); + int expResult = 2005; // CLOB + int result = instance.getSourceCodeType(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setCharacterSet method, of class DBURI. - */ - public void testSetCharacterSet() throws URISyntaxException, Exception { - System.out.println("setCharacterSet"); - String characterSet = "utf8"; - DBURI instance = new DBURI(C_POSTGRES_1); - instance.setCharacterSet(characterSet); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setSourceCodeType method, of class DBURI. + */ + @Test + public void testSetSourceCodeType() throws URISyntaxException, Exception { + System.out.println("setSourceCodeType"); + int sourceCodeType = 5; + DBURI instance = new DBURI(C_ORACLE_OCI_1); + instance.setSourceCodeType(sourceCodeType); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getSourceCodeType method, of class DBURI. - */ - public void testGetSourceCodeType() throws URISyntaxException, Exception { - System.out.println("getSourceCodeType"); - DBURI instance = new DBURI(C_ORACLE_OCI_1); - int expResult = 2005; //CLOB - int result = instance.getSourceCodeType(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getSubprotocol method, of class DBURI. + */ + @Test + public void testGetSubprotocol() throws URISyntaxException, Exception { + System.out.println("getSubprotocol"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + String expResult = "oracle"; + String result = instance.getSubprotocol(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setSourceCodeType method, of class DBURI. - */ - public void testSetSourceCodeType() throws URISyntaxException, Exception { - System.out.println("setSourceCodeType"); - int sourceCodeType = 5; - DBURI instance = new DBURI(C_ORACLE_OCI_1); - instance.setSourceCodeType(sourceCodeType); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setSubprotocol method, of class DBURI. + */ + public void testSetSubprotocol() throws URISyntaxException, Exception { + System.out.println("setSubprotocol"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + String subprotocol = "oracle"; + instance.setSubprotocol(subprotocol); + String result = instance.getSubprotocol(); + assertEquals(subprotocol, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getSubprotocol method, of class DBURI. - */ - public void testGetSubprotocol() throws URISyntaxException, Exception { - System.out.println("getSubprotocol"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - String expResult = "oracle"; - String result = instance.getSubprotocol(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getSubnamePrefix method, of class DBURI. + */ + @Test + public void testGetSubnamePrefix() throws URISyntaxException, Exception { + System.out.println("getSubnamePrefix"); + DBURI instance = new DBURI(C_ORACLE_OCI_2); + String expResult = "oci"; + String result = instance.getSubnamePrefix(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setSubprotocol method, of class DBURI. - */ - public void testSetSubprotocol() throws URISyntaxException, Exception { - System.out.println("setSubprotocol"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - String subprotocol = "oracle"; - instance.setSubprotocol(subprotocol); - String result = instance.getSubprotocol(); - assertEquals(subprotocol, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setSubnamePrefix method, of class DBURI. + */ + @Test + public void testSetSubnamePrefix() throws URISyntaxException, Exception { + System.out.println("setSubnamePrefix"); + String subnamePrefix = "oci8"; + DBURI instance = new DBURI(C_ORACLE_OCI_2); + instance.setSubnamePrefix(subnamePrefix); + String result = instance.getSubnamePrefix(); + assertEquals(subnamePrefix, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of getSubnamePrefix method, of class DBURI. - */ - public void testGetSubnamePrefix() throws URISyntaxException, Exception { - System.out.println("getSubnamePrefix"); - DBURI instance = new DBURI(C_ORACLE_OCI_2); - String expResult = "oci"; - String result = instance.getSubnamePrefix(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getParameters method, of class DBURI. + */ + @Test + public void testGetParameters() throws URISyntaxException, Exception { + System.out.println("getParameters"); + DBURI instance = new DBURI(C_TEST_URI); + Map expResult = new HashMap(); + expResult.put("param1", "x&1"); + expResult.put("param2", null); + expResult.put("param3", null); + Map result = instance.getParameters(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Test of setSubnamePrefix method, of class DBURI. - */ - public void testSetSubnamePrefix() throws URISyntaxException, Exception { - System.out.println("setSubnamePrefix"); - String subnamePrefix = "oci8"; - DBURI instance = new DBURI(C_ORACLE_OCI_2); - instance.setSubnamePrefix(subnamePrefix); - String result = instance.getSubnamePrefix(); - assertEquals(subnamePrefix , result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of setParameters method, of class DBURI. + */ + @Test + public void testSetParameters() throws URISyntaxException, Exception { + System.out.println("setParameters"); + Map parameters = new HashMap(); + parameters.put("param1", "x%FFF"); + parameters.put("param2", "IAmParameter2"); + parameters.put("param3", "IAmParameter3"); + DBURI instance = new DBURI(C_TEST_URI); + instance.setParameters(parameters); + // TODO review the generated test code and remove the default call to + // fail. + assertEquals(parameters, instance.getParameters()); + } - /** - * Test of getParameters method, of class DBURI. - */ - public void testGetParameters() throws URISyntaxException, Exception { - System.out.println("getParameters"); - DBURI instance = new DBURI(C_TEST_URI); - Map expResult = new HashMap(); - expResult.put("param1","x&1"); - expResult.put("param2",null); - expResult.put("param3", null); - Map result = instance.getParameters(); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Verify that default languages are returned if non are provided in the + * DBURI. + */ + @Test + public void testDefaultLanguagesList() throws URISyntaxException, Exception { + System.out.println("testDefaultLanguagesList"); - /** - * Test of setParameters method, of class DBURI. - */ - public void testSetParameters() throws URISyntaxException, Exception { - System.out.println("setParameters"); - Map parameters = new HashMap(); - parameters.put("param1","x%FFF"); - parameters.put("param2","IAmParameter2"); - parameters.put("param3", "IAmParameter3"); - DBURI instance = new DBURI(C_TEST_URI); - instance.setParameters(parameters); - // TODO review the generated test code and remove the default call to fail. - assertEquals(parameters, instance.getParameters()); - } - + List defaultLanguagesList = Arrays.asList(C_DEFAULT_LANGUAGES.split(",")); - /** - * Verify that default languages are returned if non are provided in the DBURI. - */ - public void testDefaultLanguagesList() throws URISyntaxException, Exception { - System.out.println("testDefaultLanguagesList"); + DBURI instance = new DBURI(C_TEST_DEFAULTS); + List result = instance.getLanguagesList(); + assertEquals(defaultLanguagesList, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - List defaultLanguagesList = Arrays.asList(C_DEFAULT_LANGUAGES.split(",")); + /** + * Verify that default CharacterSet are returned if non are provided in the + * DBURI. + */ + @Test + public void testDefaultCharacterSet() throws URISyntaxException, Exception { + System.out.println("testDefaultCharacterSet"); - DBURI instance = new DBURI(C_TEST_DEFAULTS); - List result = instance.getLanguagesList() ; - assertEquals(defaultLanguagesList, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } - + DBURI instance = new DBURI(C_TEST_DEFAULTS); + String result = instance.getCharacterSet(); + assertEquals(C_DEFAULT_CHARACTERSET, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - /** - * Verify that default CharacterSet are returned if non are provided in the DBURI. - */ - public void testDefaultCharacterSet() throws URISyntaxException, Exception { - System.out.println("testDefaultCharacterSet"); + /** + * Verify that default languages are returned if non are provided in the + * DBURI. + */ + @Test + public void testDefaultSchemasList() throws URISyntaxException, Exception { + System.out.println("testDefaultSchemasList"); - DBURI instance = new DBURI(C_TEST_DEFAULTS); - String result = instance.getCharacterSet(); - assertEquals(C_DEFAULT_CHARACTERSET, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } - + List defaultSchemasList = Arrays.asList(C_DEFAULT_SCHEMAS.split(",")); - /** - * Verify that default languages are returned if non are provided in the DBURI. - */ - public void testDefaultSchemasList() throws URISyntaxException, Exception { - System.out.println("testDefaultSchemasList"); + DBURI instance = new DBURI(C_TEST_DEFAULTS); + List result = instance.getSchemasList(); + assertEquals(defaultSchemasList, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - List defaultSchemasList = Arrays.asList(C_DEFAULT_SCHEMAS.split(",")); + /** + * Verify that default Source Code Types are returned if non are provided in + * the DBURI. + */ + @Test + public void testDefaultSourceCodeTypesList() throws URISyntaxException, Exception { + System.out.println("testDefaultSourceCodeTypesList"); - DBURI instance = new DBURI(C_TEST_DEFAULTS); - List result = instance.getSchemasList() ; - assertEquals(defaultSchemasList, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } - + List defaultSourceCodeTypesList = Arrays.asList(C_DEFAULT_SOURCE_CODE_TYPES.split(",")); - /** - * Verify that default Source Code Types are returned if non are provided in the DBURI. - */ - public void testDefaultSourceCodeTypesList() throws URISyntaxException, Exception { - System.out.println("testDefaultSourceCodeTypesList"); + DBURI instance = new DBURI(C_TEST_DEFAULTS); + List result = instance.getSourceCodeTypesList(); + assertEquals(defaultSourceCodeTypesList, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - List defaultSourceCodeTypesList = Arrays.asList(C_DEFAULT_SOURCE_CODE_TYPES.split(",")); + /** + * Verify that default languages are returned if non are provided in the + * DBURI. + */ + @Test + public void testDefaultSourceCodeNamesList() throws URISyntaxException, Exception { + System.out.println("testDefaultSourceCodeNamesList"); - DBURI instance = new DBURI(C_TEST_DEFAULTS); - List result = instance.getSourceCodeTypesList() ; - assertEquals(defaultSourceCodeTypesList, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } - - + List defaultSourceCodeNamesList = Arrays.asList(C_DEFAULT_SOURCE_CODE_NAMES.split(",")); - /** - * Verify that default languages are returned if non are provided in the DBURI. - */ - public void testDefaultSourceCodeNamesList() throws URISyntaxException, Exception { - System.out.println("testDefaultSourceCodeNamesList"); + DBURI instance = new DBURI(C_TEST_DEFAULTS); + List result = instance.getSourceCodeNamesList(); + assertEquals(defaultSourceCodeNamesList, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } - List defaultSourceCodeNamesList = Arrays.asList(C_DEFAULT_SOURCE_CODE_NAMES.split(",")); + /** + * Verify that languages are returned if provided in the DBURI. + */ + @Test + public void testExplicitLanguagesList() throws URISyntaxException, Exception { + System.out.println("testExplicitLanguagesList"); - DBURI instance = new DBURI(C_TEST_DEFAULTS); - List result = instance.getSourceCodeNamesList() ; - assertEquals(defaultSourceCodeNamesList, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } - + List defaultLanguagesList = Arrays.asList(C_EXPLICIT_LANGUAGES.split(",")); - /** - * Verify that languages are returned if provided in the DBURI. - */ - public void testExplicitLanguagesList() throws URISyntaxException, Exception { - System.out.println("testExplicitLanguagesList"); + DBURI instance = new DBURI(C_TEST_EXPLICIT); + List result = instance.getLanguagesList(); + assertEquals(defaultLanguagesList, result); + // TODO review the generated test code and remove the call to fail. + // fail("The test case is a prototype."); + } - List defaultLanguagesList = Arrays.asList(C_EXPLICIT_LANGUAGES.split(",")); + /** + * Verify that CharacterSet are returned if provided in the DBURI. + */ + @Test + public void testExplicitCharacterSet() throws URISyntaxException, Exception { + System.out.println("testExplicitCharacterSet"); - DBURI instance = new DBURI(C_TEST_EXPLICIT); - List result = instance.getLanguagesList() ; - assertEquals(defaultLanguagesList, result); - // TODO review the generated test code and remove the call to fail. - //fail("The test case is a prototype."); - } - + DBURI instance = new DBURI(C_TEST_EXPLICIT); + String result = instance.getCharacterSet(); + assertEquals(C_EXPLICIT_CHARACTERSET, result); + // TODO review the generated test code and remove the call to fail. + // fail("The test case is a prototype."); + } - /** - * Verify that CharacterSet are returned if provided in the DBURI. - */ - public void testExplicitCharacterSet() throws URISyntaxException, Exception { - System.out.println("testExplicitCharacterSet"); + /** + * Verify that languages are returned if provided in the DBURI. + */ + @Test + public void testExplicitSchemasList() throws URISyntaxException, Exception { + System.out.println("testExplicitSchemasList"); - DBURI instance = new DBURI(C_TEST_EXPLICIT); - String result = instance.getCharacterSet(); - assertEquals(C_EXPLICIT_CHARACTERSET, result); - // TODO review the generated test code and remove the call to fail. - //fail("The test case is a prototype."); - } - + List defaultSchemasList = Arrays.asList(C_EXPLICIT_SCHEMAS.split(",")); - /** - * Verify that languages are returned if provided in the DBURI. - */ - public void testExplicitSchemasList() throws URISyntaxException, Exception { - System.out.println("testExplicitSchemasList"); + DBURI instance = new DBURI(C_TEST_EXPLICIT); + List result = instance.getSchemasList(); + assertEquals(defaultSchemasList, result); + // TODO review the generated test code and remove the call to fail. + // fail("The test case is a prototype."); + } - List defaultSchemasList = Arrays.asList(C_EXPLICIT_SCHEMAS.split(",")); + /** + * Verify that Source Code Types are returned if provided in the DBURI. + */ + @Test + public void testExplicitSourceCodeTypesList() throws URISyntaxException, Exception { + System.out.println("testExplicitSourceCodeTypesList"); - DBURI instance = new DBURI(C_TEST_EXPLICIT); - List result = instance.getSchemasList() ; - assertEquals(defaultSchemasList, result); - // TODO review the generated test code and remove the call to fail. - //fail("The test case is a prototype."); - } - + List defaultSourceCodeTypesList = Arrays.asList(C_EXPLICIT_SOURCE_CODE_TYPES.split(",")); - /** - * Verify that Source Code Types are returned if provided in the DBURI. - */ - public void testExplicitSourceCodeTypesList() throws URISyntaxException, Exception { - System.out.println("testExplicitSourceCodeTypesList"); + DBURI instance = new DBURI(C_TEST_EXPLICIT); + List result = instance.getSourceCodeTypesList(); + assertEquals(defaultSourceCodeTypesList, result); + // TODO review the generated test code and remove the call to fail. + // fail("The test case is a prototype."); + } - List defaultSourceCodeTypesList = Arrays.asList(C_EXPLICIT_SOURCE_CODE_TYPES.split(",")); + /** + * Verify that languages are returned if provided in the DBURI. + */ + @Test + public void testExplicitSourceCodeNamesList() throws URISyntaxException, Exception { + System.out.println("testExplicitSourceCodeNamesList"); - DBURI instance = new DBURI(C_TEST_EXPLICIT); - List result = instance.getSourceCodeTypesList() ; - assertEquals(defaultSourceCodeTypesList, result); - // TODO review the generated test code and remove the call to fail. - //fail("The test case is a prototype."); - } - - /** - * Verify that languages are returned if provided in the DBURI. - */ - public void testExplicitSourceCodeNamesList() throws URISyntaxException, Exception { - System.out.println("testExplicitSourceCodeNamesList"); + List defaultSourceCodeNamesList = Arrays.asList(C_EXPLICIT_SOURCE_CODE_NAMES.split(",")); - List defaultSourceCodeNamesList = Arrays.asList(C_EXPLICIT_SOURCE_CODE_NAMES.split(",")); - - DBURI instance = new DBURI(C_TEST_EXPLICIT); - List result = instance.getSourceCodeNamesList() ; - assertEquals(defaultSourceCodeNamesList, result); - // TODO review the generated test code and remove the call to fail. - //fail("The test case is a prototype."); - } - + DBURI instance = new DBURI(C_TEST_EXPLICIT); + List result = instance.getSourceCodeNamesList(); + assertEquals(defaultSourceCodeNamesList, result); + // TODO review the generated test code and remove the call to fail. + // fail("The test case is a prototype."); + } } diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceLoaderTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceLoaderTest.java index 78384bf934..4bef2543be 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceLoaderTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceLoaderTest.java @@ -1,47 +1,33 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.util.database; import java.io.InputStream; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; + +import org.junit.Assert; +import org.junit.Test; /** * * @author sturton */ -public class ResourceLoaderTest extends TestCase { - - public ResourceLoaderTest(String testName) { - super(testName); - } +public class ResourceLoaderTest { - public static Test suite() { - TestSuite suite = new TestSuite(ResourceLoaderTest.class); - return suite; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Test of getResourceStream method, of class ResourceLoader. - */ - public void testGetResourceStream() throws Exception { - System.out.println("getResourceStream"); - String path = ""; - ResourceLoader instance = new ResourceLoader(); - InputStream expResult = null; - InputStream result = instance.getResourceStream(path); - assertNotNull(result); - //assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of getResourceStream method, of class ResourceLoader. + */ + @Test + public void testGetResourceStream() throws Exception { + System.out.println("getResourceStream"); + String path = ""; + ResourceLoader instance = new ResourceLoader(); + InputStream expResult = null; + InputStream result = instance.getResourceStream(path); + Assert.assertNotNull(result); + // assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } } diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceResolverTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceResolverTest.java index 146d5f536d..a1d334fb90 100644 --- a/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceResolverTest.java +++ b/pmd-core/src/test/java/net/sourceforge/pmd/util/database/ResourceResolverTest.java @@ -1,47 +1,33 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.util.database; import javax.xml.transform.Source; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; + +import org.junit.Assert; +import org.junit.Test; /** * * @author sturton */ -public class ResourceResolverTest extends TestCase { - - public ResourceResolverTest(String testName) { - super(testName); - } +public class ResourceResolverTest { - public static Test suite() { - TestSuite suite = new TestSuite(ResourceResolverTest.class); - return suite; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - /** - * Test of resolve method, of class ResourceResolver. - */ - public void testResolve() throws Exception { - System.out.println("resolve"); - String href = ""; - String base = ""; - ResourceResolver instance = new ResourceResolver(); - Source expResult = null; - Source result = instance.resolve(href, base); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - //fail("The test case is a prototype."); - } + /** + * Test of resolve method, of class ResourceResolver. + */ + @Test + public void testResolve() throws Exception { + System.out.println("resolve"); + String href = ""; + String base = ""; + ResourceResolver instance = new ResourceResolver(); + Source expResult = null; + Source result = instance.resolve(href, base); + Assert.assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to + // fail. + // fail("The test case is a prototype."); + } }