Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.DatasetAccessor


    // DRY - test protocol?
    @BeforeClass public static void beforeClass()
    {
        ServerTest.allocServer() ;
        ServerTest.resetServer() ;
        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
        du.putModel(model1) ;
        du.putModel(gn1, model2) ;
    }
View Full Code Here


        du.putModel(gn1, model2) ;
    }
   
    @AfterClass public static void afterClass()
    {
        DatasetAccessor du = DatasetAccessorFactory.createHTTP(serviceREST) ;
        du.deleteDefault() ;
        ServerTest.freeServer() ;
    }
View Full Code Here

     *            Remote Graph Store protocol service
     * @param authenticator
     *            HTTP Authenticator
     */
    public static void copyToRemoteDataset(Dataset source, String service, HttpAuthenticator authenticator) {
        DatasetAccessor target = DatasetAccessorFactory.createHTTP(service, authenticator);
        target.putModel(source.getDefaultModel());
        Iterator<String> uris = source.listNames();
        while (uris.hasNext()) {
            String uri = uris.next();
            target.putModel(uri, source.getNamedModel(uri));
        }
       
    }
View Full Code Here

    }
   
    @Test(expected = HttpException.class)
    public void graphstore_with_auth_01() {      
        // No auth credentials
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceREST);
        accessor.getModel();
    }
View Full Code Here

    }
   
    @Test(expected = HttpException.class)
    public void graphstore_with_auth_02() {
        // Incorrect auth credentials
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceREST, new SimpleAuthenticator("allowed", "incorrect".toCharArray()));
        accessor.getModel();
    }
View Full Code Here

    }
   
    @Test
    public void graphstore_with_auth_03() {
        // Correct auth credentials
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceREST, new SimpleAuthenticator("allowed", "password".toCharArray()));
        Model m = accessor.getModel();
        Assert.assertTrue(m.isEmpty());
    }
View Full Code Here

    }
   
    @Test(expected = HttpException.class)
    public void graphstore_with_auth_04() throws URISyntaxException {
        // Correct auth credentials scoped to wrong URI
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceREST, new ScopedAuthenticator(new URI("http://example.org/"), "allowed", "password".toCharArray()));
        accessor.getModel();
    }
View Full Code Here

    }
   
    @Test
    public void graphstore_with_auth_05() throws URISyntaxException {
        // Correct auth credentials scoped to correct URI
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceREST, new ScopedAuthenticator(new URI(serviceREST), "allowed", "password".toCharArray()));
        accessor.getModel();
    }
View Full Code Here

    @Test
    public void test_404_1()
    {
        // Not the right service.
        DatasetAccessor du = DatasetAccessorFactory.createHTTP(datasetURI_not_1) ;
        Model graph = du.getModel(gn99) ;
        assertNull(graph) ;
    }
View Full Code Here

    }

    @Test
    public void test_404_2()
    {
        DatasetAccessor du = DatasetAccessorFactory.createHTTP(datasetURI_not_2) ;
        Model graph = du.getModel(gn99) ;
        assertNull(graph) ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.query.DatasetAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.