cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [01/17] cayenne git commit: CAY-2026 Java 7
Date Sat, 12 Sep 2015 10:02:29 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 9e5adbf96 -> e9dd773b5


CAY-2026 Java 7

* Closeable warning


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/cc9ccc30
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/cc9ccc30
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/cc9ccc30

Branch: refs/heads/master
Commit: cc9ccc30065c888f15d6d219c26b760ed27fe0ad
Parents: 9e5adbf
Author: aadamchik <aadamchik@apache.org>
Authored: Sat Sep 12 08:35:09 2015 +0300
Committer: aadamchik <aadamchik@apache.org>
Committed: Sat Sep 12 08:56:24 2015 +0300

----------------------------------------------------------------------
 .../server/DBCP2DataSourceFactoryTest.java      | 101 +++++++++----------
 1 file changed, 49 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/cc9ccc30/cayenne-dbcp2/src/test/java/org/apache/cayenne/configuration/server/DBCP2DataSourceFactoryTest.java
----------------------------------------------------------------------
diff --git a/cayenne-dbcp2/src/test/java/org/apache/cayenne/configuration/server/DBCP2DataSourceFactoryTest.java
b/cayenne-dbcp2/src/test/java/org/apache/cayenne/configuration/server/DBCP2DataSourceFactoryTest.java
index 62ca6ca..0d7d522 100644
--- a/cayenne-dbcp2/src/test/java/org/apache/cayenne/configuration/server/DBCP2DataSourceFactoryTest.java
+++ b/cayenne-dbcp2/src/test/java/org/apache/cayenne/configuration/server/DBCP2DataSourceFactoryTest.java
@@ -35,57 +35,54 @@ import static org.junit.Assert.fail;
 
 public class DBCP2DataSourceFactoryTest {
 
-    @Test
-    public void testGetDataSource() throws Exception {
-
-        String baseUrl = getClass().getPackage().getName().replace('.', '/');
-        URL url = getClass().getClassLoader().getResource(baseUrl + "/");
-        assertNotNull(url);
-
-        DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
-        nodeDescriptor.setConfigurationSource(new URLResource(url));
-        nodeDescriptor.setParameters("testDBCP2.properties");
-
-        DBCPDataSourceFactory factory = new DBCPDataSourceFactory();
-        DataSource dataSource = factory.getDataSource(nodeDescriptor);
-        assertNotNull(dataSource);
-
-        assertTrue(dataSource instanceof BasicDataSource);
-        BasicDataSource basicDataSource = (BasicDataSource) dataSource;
-        assertEquals("com.example.jdbc.Driver", basicDataSource.getDriverClassName());
-        assertEquals("jdbc:somedb://localhost/cayenne", basicDataSource.getUrl());
-        assertEquals("john", basicDataSource.getUsername());
-        assertEquals("secret", basicDataSource.getPassword());
-        assertEquals(20, basicDataSource.getMaxTotal());
-        assertEquals(5, basicDataSource.getMinIdle());
-        assertEquals(8, basicDataSource.getMaxIdle());
-        assertEquals(10000, basicDataSource.getMaxWaitMillis());
-        assertEquals("select 1 from xyz;", basicDataSource.getValidationQuery());
-
-
-        System.out.println(DBCPDataSourceFactory.class.getName());
-    }
-
-    @Test
-    public void testGetDataSource_InvalidLocation() throws Exception {
-
-        String baseUrl = getClass().getPackage().getName().replace('.', '/');
-        URL url = getClass().getClassLoader().getResource(baseUrl + "/");
-        assertNotNull(url);
-
-        DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
-        nodeDescriptor.setConfigurationSource(new URLResource(url));
-        nodeDescriptor.setParameters("testDBCP2.properties.nosuchfile");
-
-        DBCPDataSourceFactory factory = new DBCPDataSourceFactory();
-
-        try {
-            factory.getDataSource(nodeDescriptor);
-            fail("didn't throw on absent config file");
-        }
-        catch (IOException ex) {
-            // expected
-        }
-    }
+	@Test
+	public void testGetDataSource() throws Exception {
+
+		String baseUrl = getClass().getPackage().getName().replace('.', '/');
+		URL url = getClass().getClassLoader().getResource(baseUrl + "/");
+		assertNotNull(url);
+
+		DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
+		nodeDescriptor.setConfigurationSource(new URLResource(url));
+		nodeDescriptor.setParameters("testDBCP2.properties");
+
+		DBCPDataSourceFactory factory = new DBCPDataSourceFactory();
+		DataSource dataSource = factory.getDataSource(nodeDescriptor);
+		assertNotNull(dataSource);
+
+		assertTrue(dataSource instanceof BasicDataSource);
+		try (BasicDataSource basicDataSource = (BasicDataSource) dataSource;) {
+			assertEquals("com.example.jdbc.Driver", basicDataSource.getDriverClassName());
+			assertEquals("jdbc:somedb://localhost/cayenne", basicDataSource.getUrl());
+			assertEquals("john", basicDataSource.getUsername());
+			assertEquals("secret", basicDataSource.getPassword());
+			assertEquals(20, basicDataSource.getMaxTotal());
+			assertEquals(5, basicDataSource.getMinIdle());
+			assertEquals(8, basicDataSource.getMaxIdle());
+			assertEquals(10000, basicDataSource.getMaxWaitMillis());
+			assertEquals("select 1 from xyz;", basicDataSource.getValidationQuery());
+		}
+	}
+
+	@Test
+	public void testGetDataSource_InvalidLocation() throws Exception {
+
+		String baseUrl = getClass().getPackage().getName().replace('.', '/');
+		URL url = getClass().getClassLoader().getResource(baseUrl + "/");
+		assertNotNull(url);
+
+		DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
+		nodeDescriptor.setConfigurationSource(new URLResource(url));
+		nodeDescriptor.setParameters("testDBCP2.properties.nosuchfile");
+
+		DBCPDataSourceFactory factory = new DBCPDataSourceFactory();
+
+		try {
+			factory.getDataSource(nodeDescriptor);
+			fail("didn't throw on absent config file");
+		} catch (IOException ex) {
+			// expected
+		}
+	}
 
 }


Mime
View raw message