Package com.hp.hpl.jena.sparql.util

Examples of com.hp.hpl.jena.sparql.util.Context


        BasicPattern basicPattern = new BasicPattern();
        basicPattern.add(Triple.ANY);
        Node serviceNode = NodeFactory.createURI(SERVICE);
        OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);

        Context context = new Context();
        ARQ.setNormalMode(context);

        context.set(Service.queryTimeout, 10);

        try {
            Service.exec(opService, context);
            Assert.fail("Expected QueryExceptionHTTP");
        } catch (QueryExceptionHTTP expected) {
View Full Code Here


        BasicPattern basicPattern = new BasicPattern();
        basicPattern.add(Triple.ANY);
        Node serviceNode = NodeFactory.createURI(SERVICE);
        OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);

        Context context = new Context();
        ARQ.setNormalMode(context);

        context.set(Service.queryTimeout, "10");

        try {
            Service.exec(opService, context);
            Assert.fail("Expected QueryExceptionHTTP");
        } catch (QueryExceptionHTTP expected) {
View Full Code Here

        BasicPattern basicPattern = new BasicPattern();
        basicPattern.add(Triple.ANY);
        Node serviceNode = NodeFactory.createURI(SERVICE);
        OpService opService = new OpService(serviceNode, new OpBGP(basicPattern), false);

        Context context = new Context();
        ARQ.setNormalMode(context);

        context.set(Service.queryTimeout, "10,10000");

        try {
            Service.exec(opService, context);
            Assert.fail("Expected QueryExceptionHTTP");
        } catch (QueryExceptionHTTP expected) {
View Full Code Here

        if (serviceContextMap == null) {
            ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>());
            serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
        }
        if (serviceContextMap.get(SERVICE) == null) {
            serviceContextMap.put(SERVICE, new Context(ARQ.getContext()));
        }
        Context serviceContext = serviceContextMap.get(SERVICE);
        try {
            serviceContext.put(Service.queryAuthUser, "user");
            serviceContext.put(Service.queryAuthPwd, "password");

            Query q = QueryFactory.create("ASK { }");
            QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q);
            Assert.assertNotNull(engine);

            // Check that no settings were changed
            Assert.assertEquals(-1, engine.getTimeout1());
            Assert.assertEquals(-1, engine.getTimeout2());
            Assert.assertTrue(engine.getAllowGZip());
            Assert.assertTrue(engine.getAllowDeflate());
            Assert.assertTrue(engine.isUsingBasicAuthentication());

        } finally {
            serviceContext.remove(Service.queryAuthUser);
            serviceContext.remove(Service.queryAuthPwd);
        }
    }
View Full Code Here

        if (serviceContextMap == null) {
            ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>());
            serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
        }
        if (serviceContextMap.get(SERVICE) == null) {
            serviceContextMap.put(SERVICE, new Context(ARQ.getContext()));
        }
        Context serviceContext = serviceContextMap.get(SERVICE);
        try {
            serviceContext.put(Service.queryTimeout, "10");

            Query q = QueryFactory.create("ASK { }");
            QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q);
            Assert.assertNotNull(engine);

            // Check that no settings were changed
            Assert.assertEquals(-1, engine.getTimeout1());
            Assert.assertEquals(10, engine.getTimeout2());
            Assert.assertTrue(engine.getAllowGZip());
            Assert.assertTrue(engine.getAllowDeflate());
            Assert.assertFalse(engine.isUsingBasicAuthentication());
        } finally {
            serviceContext.remove(Service.queryTimeout);
        }
    }
View Full Code Here

        if (serviceContextMap == null) {
            ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>());
            serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
        }
        if (serviceContextMap.get(SERVICE) == null) {
            serviceContextMap.put(SERVICE, new Context(ARQ.getContext()));
        }
        Context serviceContext = serviceContextMap.get(SERVICE);
        try {
            serviceContext.put(Service.queryTimeout, "10,20");

            Query q = QueryFactory.create("ASK { }");
            QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q);
            Assert.assertNotNull(engine);

            // Check that no settings were changed
            Assert.assertEquals(20, engine.getTimeout1());
            Assert.assertEquals(10, engine.getTimeout2());
            Assert.assertTrue(engine.getAllowGZip());
            Assert.assertTrue(engine.getAllowDeflate());
            Assert.assertFalse(engine.isUsingBasicAuthentication());
        } finally {
            serviceContext.remove(Service.queryTimeout);
        }
    }
View Full Code Here

        if (serviceContextMap == null) {
            ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>());
            serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
        }
        if (serviceContextMap.get(SERVICE) == null) {
            serviceContextMap.put(SERVICE, new Context(ARQ.getContext()));
        }
        Context serviceContext = serviceContextMap.get(SERVICE);
        try {
            serviceContext.put(Service.queryGzip, false);
            serviceContext.put(Service.queryDeflate, false);

            Query q = QueryFactory.create("ASK { }");
            QueryEngineHTTP engine = QueryExecutionFactory.createServiceRequest(SERVICE, q);
            Assert.assertNotNull(engine);

            // Check that no settings were changed
            Assert.assertEquals(-1, engine.getTimeout1());
            Assert.assertEquals(-1, engine.getTimeout2());
            Assert.assertFalse(engine.getAllowGZip());
            Assert.assertFalse(engine.getAllowDeflate());
            Assert.assertFalse(engine.isUsingBasicAuthentication());
        } finally {
            serviceContext.remove(Service.queryGzip);
            serviceContext.remove(Service.queryDeflate);
        }
    }
View Full Code Here

        if (serviceContextMap == null) {
            ARQ.getContext().put(Service.serviceContext, new HashMap<String, Context>());
            serviceContextMap = (Map<String, Context>) ARQ.getContext().get(Service.serviceContext);
        }
        if (serviceContextMap.get(SERVICE) == null) {
            serviceContextMap.put(SERVICE, new Context(ARQ.getContext()));
        }
        Context serviceContext = serviceContextMap.get(SERVICE);
        try {
            serviceContext.put(Service.queryAuthUser, "user");
            serviceContext.put(Service.queryAuthPwd, "password");

            UpdateRequest updates = UpdateFactory.create("CREATE GRAPH <http://example>");
            UpdateProcessRemoteBase engine = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, SERVICE);
            Assert.assertNotNull(engine);

            // Check that auth settings were changed
            Assert.assertTrue(engine.isUsingAuthentication());

        } finally {
            serviceContext.remove(Service.queryAuthUser);
            serviceContext.remove(Service.queryAuthPwd);
        }
    }
View Full Code Here

        StreamManager.setGlobal(streamMgrStd) ;
    }
   
    private static Context context(StreamManager streamMgr)
    {
        Context context = new Context() ;
        context.put(RDFDataMgr.streamManagerSymbol, streamMgr) ;
        return context ;
    }
View Full Code Here

    public void testNoSpill()
    {
        iterator.setCallback(new Callback() { @Override
        public void call() { /* do nothing */ } });
        assertEquals(0, iterator.getReturnedElementCount());
        Context context = new Context() ;
        ExecutionContext executionContext = new ExecutionContext(context, (Graph)null, (DatasetGraph)null, (OpExecutorFactory)null) ;
        QueryIterSort qIter = new QueryIterSort(iterator, comparator, executionContext) ;
        try
        {
            assertEquals(0, iterator.getReturnedElementCount()) ;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.util.Context

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.