You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/10/14 19:22:07 UTC
[08/15] jena git commit: Rework managing the backgroud test server
Rework managing the backgroud test server
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/5b6643fe
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/5b6643fe
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/5b6643fe
Branch: refs/heads/master
Commit: 5b6643fe5f1a3c0380533d72eb6c7536276281d2
Parents: 32fb3e4
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 13 17:09:49 2016 +0100
Committer: ajs6f <aj...@virginia.edu>
Committed: Thu Oct 13 16:09:42 2016 -0400
----------------------------------------------------------------------
.../connections/RemoteEndpointConnection.java | 4 +-
.../RemoteEndpointPreparedStatement.java | 4 +-
.../statements/RemoteEndpointStatement.java | 3 +-
.../org/apache/jena/jdbc/remote/ServerCtl.java | 106 +++++++++++++++++++
.../jena/jdbc/remote/TS_JdbcDriverRemote.java | 20 ++--
.../AbstractRemoteEndpointConnectionTests.java | 5 -
.../TestRemoteEndpointConnection.java | 30 ++----
...stRemoteEndpointConnectionWithGraphUris.java | 33 ++----
...oteEndpointConnectionWithResultSetTypes.java | 29 ++---
.../metadata/TestRemoteConnectionMetadata.java | 33 ++----
.../AbstractRemoteEndpointResultSetTests.java | 4 +-
.../results/TestRemoteEndpointResults.java | 19 ++--
.../TestRemoteEndpointResultsWithGraphUris.java | 21 ++--
...RemoteEndpointResultsWithResultSetTypes.java | 26 ++---
.../TestRemoteEndpointStatements.java | 35 ++----
15 files changed, 181 insertions(+), 191 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java b/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java
index 2f26ac9..c39a76c 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/connections/RemoteEndpointConnection.java
@@ -85,8 +85,8 @@ public class RemoteEndpointConnection extends JenaConnection {
* Default Graph URIs for SPARQL updates
* @param usingNamedGraphUris
* Named Graph URIs for SPARQL updates
- * @param authenticator
- * HTTP Authenticator
+ * @param client
+ * HTTP client
* @param holdability
* Result Set holdability
* @param compatibilityLevel
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointPreparedStatement.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointPreparedStatement.java b/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointPreparedStatement.java
index 91a15d7..347b1dc 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointPreparedStatement.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointPreparedStatement.java
@@ -65,8 +65,8 @@ public class RemoteEndpointPreparedStatement extends JenaPreparedStatement {
* SPARQL command
* @param connection
* Connection
- * @param authenticator
- * HTTP Authenticator
+ * @param client
+ * HTTP client
* @param type
* Result Set type for result sets produced by this statement
* @param fetchDir
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java b/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
index d75c246..5fa5c7e 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/main/java/org/apache/jena/jdbc/remote/statements/RemoteEndpointStatement.java
@@ -63,7 +63,8 @@ public class RemoteEndpointStatement extends JenaStatement {
* Connection
* @param type
* Result Set type for result sets produced by this statement
- * @param authenticator HTTP Authenticator
+ * @param client
+ * HTTP client
* @param fetchDir
* Fetch Direction
* @param fetchSize
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/ServerCtl.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/ServerCtl.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/ServerCtl.java
new file mode 100644
index 0000000..66bc4dc
--- /dev/null
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/ServerCtl.java
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.jdbc.remote;
+
+import org.apache.http.client.HttpClient ;
+import org.apache.http.impl.client.CloseableHttpClient ;
+import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.ServerTest ;
+import org.apache.jena.riot.web.HttpOp ;
+
+public class ServerCtl {
+ static { Fuseki.init(); }
+
+ /* Put this in each test class using the Fuseki server:
+ @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
+ */
+
+ // One server, all tests.
+ //static { ServerTest.allocServer(); }
+
+ // Use HttpOp caching of connections during testing to avoid
+ // swamping kernel socket management
+ static HttpClient defaultHttpClient = HttpOp.getDefaultHttpClient();
+
+ // Used for all tests except auth tests.
+ //static final HttpClient globalPoolingClient = HttpOp.createPoolingHttpClient();
+
+ public static void ctlBeforeTestSuite() {
+ // Does not work to have pool across server free/alloc.
+ // This may be to do with timing when using localhost
+ // and a high frequence connection churn.
+ //setPoolingHttpClient() ;
+ }
+
+ public static void ctlAfterTestSuite() {
+ //resetDefaultHttpClient();
+ }
+
+ /**
+ * Setup for the tests by allocating a Fuseki instance to work with
+ */
+ public static void ctlBeforeClass() {
+ setPoolingHttpClient() ;
+ ServerTest.allocServer();
+ }
+
+ /**
+ * Clean up after tests by de-allocating the Fuseki instance
+ */
+ public static void ctlAfterClass() {
+ ServerTest.freeServer();
+ resetDefaultHttpClient() ;
+ }
+
+ /**
+ * Placeholder.
+ */
+ public static void ctlBeforeTest() {
+ }
+
+ /**
+ * Clean up after each test by resetting the Fuseki dataset
+ */
+ public static void ctlAfterTest() {
+ ServerTest.resetServer();
+ }
+
+ /** Set a PoolingHttpClient */
+ private static void setPoolingHttpClient() {
+ setHttpClient(HttpOp.createPoolingHttpClient()) ;
+ }
+
+ /** Restore the original setup */
+ private static void resetDefaultHttpClient() {
+ setHttpClient(defaultHttpClient);
+ }
+
+ /** Set the HttpClient - close the old one if appropriate */
+ private static void setHttpClient(HttpClient newHttpClient) {
+ HttpClient hc = HttpOp.getDefaultHttpClient() ;
+ if ( hc instanceof CloseableHttpClient )
+ IO.close((CloseableHttpClient)hc) ;
+ HttpOp.setDefaultHttpClient(newHttpClient) ;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TS_JdbcDriverRemote.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TS_JdbcDriverRemote.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TS_JdbcDriverRemote.java
index 1b6eb36..5fadd00 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TS_JdbcDriverRemote.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/TS_JdbcDriverRemote.java
@@ -17,7 +17,6 @@
*/
package org.apache.jena.jdbc.remote;
-import org.apache.http.client.HttpClient;
import org.apache.jena.jdbc.remote.connections.TestRemoteEndpointConnection;
import org.apache.jena.jdbc.remote.connections.TestRemoteEndpointConnectionWithAuth;
import org.apache.jena.jdbc.remote.connections.TestRemoteEndpointConnectionWithGraphUris;
@@ -28,7 +27,6 @@ import org.apache.jena.jdbc.remote.results.TestRemoteEndpointResultsWithAuth;
import org.apache.jena.jdbc.remote.results.TestRemoteEndpointResultsWithGraphUris;
import org.apache.jena.jdbc.remote.results.TestRemoteEndpointResultsWithResultSetTypes;
import org.apache.jena.jdbc.remote.statements.TestRemoteEndpointStatements;
-import org.apache.jena.riot.web.HttpOp;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -41,12 +39,15 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
TestRemoteEndpointDriver.class,
+
TestRemoteEndpointConnection.class,
TestRemoteEndpointConnectionWithAuth.class,
TestRemoteEndpointConnectionWithGraphUris.class,
- TestRemoteEndpointConnectionWithResultSetTypes.class,
+ TestRemoteEndpointConnectionWithResultSetTypes.class
+ ,
TestRemoteConnectionMetadata.class,
- TestRemoteEndpointStatements.class,
+ TestRemoteEndpointStatements.class
+ ,
TestRemoteEndpointResults.class,
TestRemoteEndpointResultsWithAuth.class,
TestRemoteEndpointResultsWithGraphUris.class,
@@ -56,20 +57,13 @@ import org.junit.runners.Suite;
public class TS_JdbcDriverRemote {
- // Use HttpOp caching of connections during testing to avoid
- // swamping kernel socket management
- static HttpClient defaultHttpClient = HttpOp.getDefaultHttpClient();
- // Used for all tests except auth tests.
- static final HttpClient globalPoolingClient = HttpOp.createPoolingHttpClient();
-
@BeforeClass
public static void beforeClassAbstract1() {
- HttpOp.setDefaultHttpClient(globalPoolingClient);
+ ServerCtl.ctlBeforeTestSuite() ;
}
@AfterClass
public static void afterClassAbstract1() {
- HttpOp.setDefaultHttpClient(defaultHttpClient);
+ ServerCtl.ctlAfterTestSuite() ;
}
-
}
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/AbstractRemoteEndpointConnectionTests.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/AbstractRemoteEndpointConnectionTests.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/AbstractRemoteEndpointConnectionTests.java
index 08da404..ea66abb 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/AbstractRemoteEndpointConnectionTests.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/AbstractRemoteEndpointConnectionTests.java
@@ -17,15 +17,10 @@
*/
package org.apache.jena.jdbc.remote.connections;
-import org.apache.jena.fuseki.Fuseki;
import org.apache.jena.jdbc.connections.AbstractJenaConnectionTests;
/**
* Abstract tests for remote endpoint driver connections
*/
public abstract class AbstractRemoteEndpointConnectionTests extends AbstractJenaConnectionTests {
-
- static {
- Fuseki.init();
- }
}
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnection.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnection.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnection.java
index 21ce9e1..37cb8ad 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnection.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnection.java
@@ -23,11 +23,12 @@ import java.sql.SQLException;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
-import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.utils.TestUtils;
import org.apache.jena.query.Dataset ;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -36,29 +37,10 @@ import org.junit.BeforeClass;
*/
public class TestRemoteEndpointConnection extends AbstractRemoteEndpointConnectionTests {
- /**
- * Setup for the tests by allocating a Fuseki instance to work with
- */
- @BeforeClass
- public static void setup() {
- ServerTest.allocServer();
- }
-
- /**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
- * Clean up after tests by de-allocating the Fuseki instance
- */
- @AfterClass
- public static void cleanup() {
- ServerTest.freeServer();
- }
+ @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
@Override
protected boolean supportsTimeouts() {
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java
index f01cd3f..e4beca0 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithGraphUris.java
@@ -26,13 +26,11 @@ import java.util.List;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.apache.jena.jdbc.utils.TestUtils;
import org.apache.jena.query.Dataset ;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
+import org.junit.* ;
/**
* Tests for the {@link RemoteEndpointConnection} where we force the default
@@ -47,29 +45,10 @@ public class TestRemoteEndpointConnectionWithGraphUris extends AbstractRemoteEnd
*/
private static final String DEFAULT_GRAPH_URI = "http://example.org/defaultGraph";
- /**
- * Setup for the tests by allocating a Fuseki instance to work with
- */
- @BeforeClass
- public static void setup() {
- ServerTest.allocServer();
- }
-
- /**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
- * Clean up after tests by de-allocating the Fuseki instance
- */
- @AfterClass
- public static void cleanup() {
- ServerTest.freeServer();
- }
+ @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
@Override
protected boolean supportsTimeouts() {
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java
index e0478cc..620b21f 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/connections/TestRemoteEndpointConnectionWithResultSetTypes.java
@@ -23,12 +23,14 @@ import java.sql.SQLException;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.apache.jena.jdbc.utils.TestUtils;
import org.apache.jena.query.Dataset ;
import org.apache.jena.riot.WebContent;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -37,29 +39,10 @@ import org.junit.BeforeClass;
*/
public class TestRemoteEndpointConnectionWithResultSetTypes extends AbstractRemoteEndpointConnectionTests {
- /**
- * Setup for the tests by allocating a Fuseki instance to work with
- */
- @BeforeClass
- public static void setup() {
- ServerTest.allocServer();
- }
-
- /**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
- * Clean up after tests by de-allocating the Fuseki instance
- */
- @AfterClass
- public static void cleanup() {
- ServerTest.freeServer();
- }
+ @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
@Override
protected boolean supportsTimeouts() {
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/metadata/TestRemoteConnectionMetadata.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/metadata/TestRemoteConnectionMetadata.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/metadata/TestRemoteConnectionMetadata.java
index 65b1110..7367d3b 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/metadata/TestRemoteConnectionMetadata.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/metadata/TestRemoteConnectionMetadata.java
@@ -28,9 +28,11 @@ import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
import org.apache.jena.jdbc.metadata.results.AbstractDatabaseMetadataTests;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -39,33 +41,10 @@ import org.junit.BeforeClass;
*/
public class TestRemoteConnectionMetadata extends AbstractDatabaseMetadataTests {
- static {
- Fuseki.init();
- }
-
- /**
- * Setup for the tests by allocating a Fuseki instance to work with
- */
- @BeforeClass
- public static void setup() {
- ServerTest.allocServer();
- }
-
- /**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
- * Clean up after tests by de-allocating the Fuseki instance
- */
- @AfterClass
- public static void cleanup() {
- ServerTest.freeServer();
- }
+ @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
@Override
protected JenaConnection getConnection() throws SQLException {
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/AbstractRemoteEndpointResultSetTests.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/AbstractRemoteEndpointResultSetTests.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/AbstractRemoteEndpointResultSetTests.java
index f1b965d..085ad10 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/AbstractRemoteEndpointResultSetTests.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/AbstractRemoteEndpointResultSetTests.java
@@ -34,12 +34,12 @@ public abstract class AbstractRemoteEndpointResultSetTests extends AbstractResul
static HttpClient defaultHttpClient = HttpOp.getDefaultHttpClient() ;
// Used for all tests except auth tests.
- static HttpClient globalCachingClient = HttpOp.createCachingHttpClient() ;
+ static HttpClient globalPoolingClient = HttpOp.createPoolingHttpClient() ;
@BeforeClass public static void beforeClassAbstract1() {
JenaSystem.init() ;
Fuseki.init();
- HttpOp.setDefaultHttpClient(globalCachingClient) ;
+ HttpOp.setDefaultHttpClient(globalPoolingClient) ;
}
@AfterClass public static void afterClassAbstract1() {
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java
index 12769c4..53711b7 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResults.java
@@ -25,12 +25,14 @@ import java.sql.Statement;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.apache.jena.jdbc.utils.TestUtils;
import org.apache.jena.query.Dataset ;
import org.apache.jena.riot.web.HttpOp;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -41,33 +43,30 @@ public class TestRemoteEndpointResults extends AbstractRemoteEndpointResultSetTe
private static RemoteEndpointConnection connection;
+ //@BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ //@AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
+
/**
* Setup for the tests by allocating a Fuseki instance to work with
* @throws SQLException
*/
@BeforeClass
public static void setup() throws SQLException {
- ServerTest.allocServer();
- HttpOp.setDefaultHttpClient(null);
+ ServerCtl.ctlBeforeClass();
connection = new RemoteEndpointConnection(ServerTest.serviceQuery, ServerTest.serviceUpdate, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT);
connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
/**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
- /**
* Clean up after tests by de-allocating the Fuseki instance
* @throws SQLException
*/
@AfterClass
public static void cleanup() throws SQLException {
connection.close();
- ServerTest.freeServer();
+ ServerCtl.ctlAfterClass();
}
@Override
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithGraphUris.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithGraphUris.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithGraphUris.java
index dfeb69d..da2e8e7 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithGraphUris.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithGraphUris.java
@@ -27,12 +27,14 @@ import org.apache.jena.ext.com.google.common.collect.Lists;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.apache.jena.jdbc.utils.TestUtils;
import org.apache.jena.query.Dataset ;
import org.apache.jena.riot.web.HttpOp;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -41,6 +43,12 @@ import org.junit.BeforeClass;
*/
public class TestRemoteEndpointResultsWithGraphUris extends AbstractRemoteEndpointResultSetTests {
+ //@BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ //@AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
+
+
/**
* Constant for default graph URI used in these tests
*/
@@ -54,29 +62,20 @@ public class TestRemoteEndpointResultsWithGraphUris extends AbstractRemoteEndpoi
*/
@BeforeClass
public static void setup() throws SQLException {
- ServerTest.allocServer();
- HttpOp.setDefaultHttpClient(null);
+ ServerCtl.ctlBeforeClass();
List<String> defaultGraphUris = Lists.newArrayList(DEFAULT_GRAPH_URI);
connection = new RemoteEndpointConnection(ServerTest.serviceQuery, ServerTest.serviceUpdate, defaultGraphUris, null, defaultGraphUris, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, null, null);
connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
/**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
* Clean up after tests by de-allocating the Fuseki instance
* @throws SQLException
*/
@AfterClass
public static void cleanup() throws SQLException {
connection.close();
- ServerTest.freeServer();
+ ServerCtl.ctlAfterClass();
}
@Override
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java
index 3b88663..7a7d46f 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/results/TestRemoteEndpointResultsWithResultSetTypes.java
@@ -25,13 +25,14 @@ import java.sql.Statement;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.apache.jena.jdbc.utils.TestUtils;
import org.apache.jena.query.Dataset ;
import org.apache.jena.riot.WebContent;
-import org.apache.jena.riot.web.HttpOp;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -39,7 +40,12 @@ import org.junit.BeforeClass;
*
*/
public class TestRemoteEndpointResultsWithResultSetTypes extends AbstractRemoteEndpointResultSetTests {
-
+
+ //@BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ //@AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
+
private static RemoteEndpointConnection connection;
/**
@@ -48,31 +54,19 @@ public class TestRemoteEndpointResultsWithResultSetTypes extends AbstractRemoteE
*/
@BeforeClass
public static void setup() throws SQLException {
- ServerTest.allocServer();
- HttpOp.setDefaultHttpClient(null);
+ ServerCtl.ctlBeforeClass();
connection = new RemoteEndpointConnection(ServerTest.serviceQuery, ServerTest.serviceUpdate, null, null, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, WebContent.contentTypeTextTSV, WebContent.contentTypeRdfJson);
connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
/**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
* Clean up after tests by de-allocating the Fuseki instance
* @throws SQLException
*/
@AfterClass
public static void cleanup() throws SQLException {
-
- // Sleep attempts to avoid a intermittent timing issue on the build server that can result in hung builds
-
connection.close();
- ServerTest.freeServer();
+ ServerCtl.ctlAfterClass();
}
@Override
http://git-wip-us.apache.org/repos/asf/jena/blob/5b6643fe/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/statements/TestRemoteEndpointStatements.java
----------------------------------------------------------------------
diff --git a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/statements/TestRemoteEndpointStatements.java b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/statements/TestRemoteEndpointStatements.java
index 4c6f52c..16b8758 100644
--- a/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/statements/TestRemoteEndpointStatements.java
+++ b/jena-jdbc/jena-jdbc-driver-remote/src/test/java/org/apache/jena/jdbc/remote/statements/TestRemoteEndpointStatements.java
@@ -24,10 +24,12 @@ import org.apache.jena.fuseki.Fuseki;
import org.apache.jena.fuseki.ServerTest;
import org.apache.jena.jdbc.JdbcCompatibility;
import org.apache.jena.jdbc.connections.JenaConnection;
+import org.apache.jena.jdbc.remote.ServerCtl ;
import org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection;
import org.apache.jena.jdbc.statements.AbstractJenaStatementTests;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before ;
import org.junit.BeforeClass;
/**
@@ -35,34 +37,11 @@ import org.junit.BeforeClass;
*
*/
public class TestRemoteEndpointStatements extends AbstractJenaStatementTests {
-
- static {
- Fuseki.init();
- }
-
- /**
- * Setup for the tests by allocating a Fuseki instance to work with
- */
- @BeforeClass
- public static void setup() {
- ServerTest.allocServer();
- }
-
- /**
- * Clean up after each test by resetting the Fuseki instance
- */
- @After
- public void cleanupTest() {
- ServerTest.resetServer();
- }
-
- /**
- * Clean up after tests by de-allocating the Fuseki instance
- */
- @AfterClass
- public static void cleanup() {
- ServerTest.freeServer();
- }
+
+ @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
+ @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
+ @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
+ @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
@Override
protected JenaConnection getConnection() throws SQLException {