bump version to 0.1.0 , test cleanup Signed-off-by: Toivo Adams <[email protected]> Signed-off-by: Mark Payne <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/78906a94 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/78906a94 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/78906a94 Branch: refs/heads/develop Commit: 78906a9427757b5d387a18282191835089faebac Parents: 1682d62 Author: Toivo Adams <[email protected]> Authored: Sun Mar 22 15:10:37 2015 +0200 Committer: Mark Payne <[email protected]> Committed: Wed May 20 08:35:55 2015 -0400 ---------------------------------------------------------------------- .../nifi-dbcp-service-api/pom.xml | 2 +- .../nifi-dbcp-service-nar/pom.xml | 4 +- .../nifi-dbcp-service/pom.xml | 4 +- .../org/apache/nifi/dbcp/DBCPServiceTest.java | 58 +++++++++----------- .../nifi-dbcp-service-bundle/pom.xml | 2 +- 5 files changed, 32 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/78906a94/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-api/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-api/pom.xml b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-api/pom.xml index f8ea08a..1eec223 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-api/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-api/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.apache.nifi</groupId> <artifactId>nifi-standard-services</artifactId> - <version>0.0.2-incubating-SNAPSHOT</version> + <version>0.1.0-incubating-SNAPSHOT</version> </parent> <artifactId>nifi-dbcp-service-api</artifactId> <packaging>jar</packaging> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/78906a94/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service-nar/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service-nar/pom.xml b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service-nar/pom.xml index 37722db..e7cd28e 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service-nar/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service-nar/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.apache.nifi</groupId> <artifactId>nifi-dbcp-service-bundle</artifactId> - <version>0.0.2-incubating-SNAPSHOT</version> + <version>0.1.0-incubating-SNAPSHOT</version> </parent> <artifactId>nifi-dbcp-service-nar</artifactId> <packaging>nar</packaging> @@ -19,7 +19,7 @@ <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-dbcp-service</artifactId> - <version>0.0.2-incubating-SNAPSHOT</version> + <version>0.1.0-incubating-SNAPSHOT</version> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/78906a94/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/pom.xml b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/pom.xml index a17ddff..eec2a17 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.apache.nifi</groupId> <artifactId>nifi-dbcp-service-bundle</artifactId> - <version>0.0.2-incubating-SNAPSHOT</version> + <version>0.1.0-incubating-SNAPSHOT</version> </parent> <artifactId>nifi-dbcp-service</artifactId> <packaging>jar</packaging> @@ -14,7 +14,7 @@ <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-dbcp-service-api</artifactId> - <version>0.0.2-incubating-SNAPSHOT</version> + <version>0.1.0-incubating-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.nifi</groupId> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/78906a94/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/DBCPServiceTest.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/DBCPServiceTest.java b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/DBCPServiceTest.java index cb9c208..d5ea3da 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/DBCPServiceTest.java +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/test/java/org/apache/nifi/dbcp/DBCPServiceTest.java @@ -39,6 +39,7 @@ import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -120,6 +121,7 @@ public class DBCPServiceTest { * Connect, create table, insert, select, drop table. * */ + @Ignore @Test public void testExternalJDBCDriverUsage() throws InitializationException, SQLException { final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class); @@ -244,7 +246,6 @@ public class DBCPServiceTest { ClassLoader parent = Thread.currentThread().getContextClassLoader(); URLClassLoader ucl = new URLClassLoader(urls,parent); -// URLClassLoader ucl = new URLClassLoader(urls); Class<?> clazz = Class.forName("org.mariadb.jdbc.Driver", true, ucl); assertNotNull(clazz); @@ -253,19 +254,32 @@ public class DBCPServiceTest { Driver shim = new DriverShim(driver); DriverManager.registerDriver( shim ); - // Driver is found when using URL ClassLoader - assertTrue( isDriverAllowed(driver, ucl) ); + Driver driver2 = DriverManager.getDriver("jdbc:mariadb://localhost:3306/testdb"); + assertNotNull(driver2); + } + + /** + * NB!!!! + * Prerequisite: file should be present in /var/tmp/mariadb-java-client-1.1.7.jar + * Prerequisite: access to running MariaDb database server + */ + @Ignore + @Test + public void testURLClassLoaderGetConnection() throws ClassNotFoundException, MalformedURLException, SQLException, InstantiationException, IllegalAccessException { - // Driver is not found when using parent ClassLoader - // unfortunately DriverManager will use caller ClassLoadar and driver is not found !!! -// assertTrue( isDriverAllowed(driver, parent) ); + URL url = new URL("file:///var/tmp/mariadb-java-client-1.1.7.jar"); + URL[] urls = new URL[] { url }; + + ClassLoader parent = Thread.currentThread().getContextClassLoader(); + URLClassLoader ucl = new URLClassLoader(urls,parent); + + Class<?> clazz = Class.forName("org.mariadb.jdbc.Driver", true, ucl); + assertNotNull(clazz); + + Driver driver = (Driver) clazz.newInstance(); + Driver shim = new DriverShim(driver); + DriverManager.registerDriver( shim ); - Enumeration<Driver> drivers = DriverManager.getDrivers(); - while (drivers.hasMoreElements()) { - driver = (Driver) drivers.nextElement(); - System.out.println(driver); - } - Driver driver2 = DriverManager.getDriver("jdbc:mariadb://localhost:3306/testdb"); assertNotNull(driver2); @@ -304,25 +318,5 @@ public class DBCPServiceTest { st.close(); } - - //==================================== problem solving - no suitable driver found, mariadb ========================================= - // method isDriverAllowed is from DriverManager - private static boolean isDriverAllowed(Driver driver, ClassLoader classLoader) { - boolean result = false; - if(driver != null) { - Class<?> aClass = null; - try { - aClass = Class.forName(driver.getClass().getName(), true, classLoader); - } catch (Exception ex) { - System.out.println(ex); - result = false; - } - - result = ( aClass == driver.getClass() ) ? true : false; - } - - return result; - } - } http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/78906a94/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/pom.xml b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/pom.xml index 2a2c74b..5f5b916 100644 --- a/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.apache.nifi</groupId> <artifactId>nifi-standard-services</artifactId> - <version>0.0.2-incubating-SNAPSHOT</version> + <version>0.1.0-incubating-SNAPSHOT</version> </parent> <artifactId>nifi-dbcp-service-bundle</artifactId> <packaging>pom</packaging>
