Search in sources :

Example 1 with RemoteEndpointConnection

use of org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection in project jena by apache.

the class TestRemoteEndpointDriver method remote_driver_graph_uris_01.

/**
     * Tests the different ways of specifying multiple values for a parameter
     * @throws SQLException 
     */
@Test
public void remote_driver_graph_uris_01() throws SQLException {
    // May specify key=value pairs multiple times
    String url = JenaDriver.DRIVER_PREFIX + RemoteEndpointDriver.REMOTE_DRIVER_PREFIX + RemoteEndpointDriver.PARAM_QUERY_ENDPOINT + "=http://example.org/query&" + RemoteEndpointDriver.PARAM_DEFAULT_GRAPH_URI + "=http://graph/1&" + RemoteEndpointDriver.PARAM_DEFAULT_GRAPH_URI + "=http://graph/2";
    RemoteEndpointDriver driver = (RemoteEndpointDriver) this.getDriver();
    try (RemoteEndpointConnection conn = (RemoteEndpointConnection) driver.connect(url, new Properties())) {
        Assert.assertEquals(2, conn.getDefaultGraphURIs().size());
    }
}
Also used : RemoteEndpointConnection(org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection) Properties(java.util.Properties) Test(org.junit.Test)

Example 2 with RemoteEndpointConnection

use of org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection in project jena by apache.

the class TestRemoteEndpointResultsWithGraphUris method setup.

/**
     * Setup for the tests by allocating a Fuseki instance to work with
     * @throws SQLException 
     */
@BeforeClass
public static void setup() throws SQLException {
    FusekiTestServer.ctlBeforeClass();
    List<String> defaultGraphUris = Lists.newArrayList(DEFAULT_GRAPH_URI);
    connection = new RemoteEndpointConnection(FusekiTestServer.serviceQuery(), FusekiTestServer.serviceUpdate(), defaultGraphUris, null, defaultGraphUris, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, null, null);
    connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
Also used : RemoteEndpointConnection(org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection) BeforeClass(org.junit.BeforeClass)

Example 3 with RemoteEndpointConnection

use of org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection in project jena by apache.

the class TestRemoteEndpointResultsWithResultSetTypes method setup.

/**
     * Setup for the tests by allocating a Fuseki instance to work with
     * @throws SQLException 
     */
@BeforeClass
public static void setup() throws SQLException {
    FusekiTestServer.ctlBeforeClass();
    connection = new RemoteEndpointConnection(FusekiTestServer.serviceQuery(), FusekiTestServer.serviceUpdate(), null, null, null, null, null, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, WebContent.contentTypeTextTSV, WebContent.contentTypeRDFJSON);
    connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
Also used : RemoteEndpointConnection(org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection) BeforeClass(org.junit.BeforeClass)

Example 4 with RemoteEndpointConnection

use of org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection in project jena by apache.

the class TestRemoteEndpointResults method setup.

/**
     * Setup for the tests by allocating a Fuseki instance to work with
     * @throws SQLException 
     */
@BeforeClass
public static void setup() throws SQLException {
    FusekiTestServer.ctlBeforeClass();
    connection = new RemoteEndpointConnection(FusekiTestServer.serviceQuery(), FusekiTestServer.serviceUpdate(), JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT);
    connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
Also used : RemoteEndpointConnection(org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection) BeforeClass(org.junit.BeforeClass)

Example 5 with RemoteEndpointConnection

use of org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection in project jena by apache.

the class TestRemoteEndpointResultsWithAuth method setup.

/**
     * Setup for the tests by allocating a Fuseki instance to work with
     * 
     * @throws SQLException
     * @throws IOException
     */
@BeforeClass
public static void setup() throws SQLException, IOException {
    SecurityHandler sh = FusekiTestAuth.makeSimpleSecurityHandler("/*", USER, PASSWORD);
    FusekiTestAuth.setupServer(true, sh);
    BasicCredentialsProvider credsProv = new BasicCredentialsProvider();
    credsProv.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(USER, PASSWORD));
    client = HttpClients.custom().setDefaultCredentialsProvider(credsProv).build();
    connection = new RemoteEndpointConnection(FusekiTestAuth.serviceQuery(), FusekiTestAuth.serviceUpdate(), null, null, null, null, client, JenaConnection.DEFAULT_HOLDABILITY, JdbcCompatibility.DEFAULT, null, null);
    connection.setJdbcCompatibilityLevel(JdbcCompatibility.HIGH);
}
Also used : SecurityHandler(org.eclipse.jetty.security.SecurityHandler) BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) RemoteEndpointConnection(org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials) BeforeClass(org.junit.BeforeClass)

Aggregations

RemoteEndpointConnection (org.apache.jena.jdbc.remote.connections.RemoteEndpointConnection)7 BeforeClass (org.junit.BeforeClass)4 Properties (java.util.Properties)3 Test (org.junit.Test)3 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)1 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)1 SecurityHandler (org.eclipse.jetty.security.SecurityHandler)1