Repository: neo4j-contrib/neo4j-jdbc
Pull request #250 (2021-01-13 17:01:34)

Move to GitHub Actions

conker84: LGTM thank you!!

Patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..ef945fc6
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,26 @@
+name: CI
+
+on:
+  push:
+    branches: '**'
+  pull_request:
+    branches: '**'
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up JDK
+        uses: actions/setup-java@v1
+        with:
+          java-version: 11
+      - name: Cache ~/.m2/repository
+        uses: actions/cache@v1
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Build with Maven
+        run: mvn --batch-mode --show-version clean test
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5443a1cf..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-dist: trusty
-
-language: java
-
-jdk:
-  - openjdk11
-
-script: 
-  - mvn clean test
-  #- mvn clean test -Pperformance-test
diff --git a/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltDriver.java b/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltDriver.java
index c4c98f7a..7ecf419b 100644
--- a/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltDriver.java
+++ b/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltDriver.java
@@ -79,4 +79,9 @@ public class BoltDriver extends BoltNeo4jDriverImpl {
     protected List<URI> buildRoutingUris(String boltUrl, Properties properties) throws URISyntaxException {
         return Arrays.asList(new URI(boltUrl));
     }
+
+	// visible for testing
+	protected static void clearCache() {
+		cache.clear();
+	}
 }
diff --git a/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/cache/BoltDriverCache.java b/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/cache/BoltDriverCache.java
index 10d32258..8bac5be0 100644
--- a/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/cache/BoltDriverCache.java
+++ b/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/cache/BoltDriverCache.java
@@ -79,4 +79,9 @@ public class BoltDriverCache {
     public Map<BoltDriverCacheKey, Driver> getCache() {
         return cache;
     }
+
+    // visible for testing
+    public void clear() {
+        cache.clear();
+    }
 }


Test patch:
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java
index 7c797dcf..a54682f1 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java
@@ -19,6 +19,7 @@
  */
 package org.neo4j.jdbc.bolt;
 
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
@@ -34,7 +35,6 @@ import org.neo4j.jdbc.Neo4jDriver;
 import org.neo4j.jdbc.bolt.utils.JdbcConnectionTestUtils;
 import org.neo4j.jdbc.bolt.utils.Mocker;
 import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
@@ -47,13 +47,16 @@ import java.sql.SQLException;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
-import static org.neo4j.driver.Values.value;
 import static java.util.Collections.singletonMap;
 import static junit.framework.TestCase.assertFalse;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.internal.verification.VerificationModeFactory.atLeastOnce;
+import static org.neo4j.driver.Values.value;
 import static org.powermock.api.mockito.PowerMockito.verifyStatic;
 
 /**
@@ -75,6 +78,11 @@ public class BoltNeo4jDriverTest {
 		mockedDriver = Mocker.mockDriver();
 	}
 
+	@Before
+	public void prepare() {
+		BoltDriver.clearCache();
+	}
+
 	/*------------------------------*/
 	/*           connect            */
 	/*------------------------------*/
@@ -217,13 +225,13 @@ public class BoltNeo4jDriverTest {
 
 			assertEquals(PoolSettings.DEFAULT_CONNECTION_ACQUISITION_TIMEOUT, config.connectionAcquisitionTimeoutMillis());
 			assertEquals(PoolSettings.DEFAULT_IDLE_TIME_BEFORE_CONNECTION_TEST, config.idleTimeBeforeConnectionTest());
-			assertEquals((int) TimeUnit.SECONDS.toMillis( 5 ), config.connectionTimeoutMillis());
-			assertEquals(true, config.encrypted());
-			assertEquals(false, config.logLeakedSessions());
+			assertEquals((int) TimeUnit.SECONDS.toMillis( 30 ), config.connectionTimeoutMillis());
+			assertFalse(config.encrypted());
+			assertFalse(config.logLeakedSessions());
 			// assertEquals(Config.LoadBalancingStrategy.LEAST_CONNECTED, config.loadBalancingStrategy());
 			assertEquals(PoolSettings.DEFAULT_MAX_CONNECTION_LIFETIME, config.maxConnectionLifetimeMillis());
 			assertEquals(PoolSettings.DEFAULT_MAX_CONNECTION_POOL_SIZE, config.maxConnectionPoolSize());
-			assertEquals(Config.TrustStrategy.trustAllCertificates().strategy(), config.trustStrategy().strategy());
+			assertEquals(Config.TrustStrategy.trustSystemCertificates().strategy(), config.trustStrategy().strategy());
 
 			return mockedDriver;
 		});