Package xbird.engine

Examples of xbird.engine.XQEngine.execute()


        XQEngine engine = new XQEngineClient("//" + bindHost + ":1099/xbird/srv-01");

        CommandRequest request1 = new CommandRequest(new String[] { "import", "document",
                "C:/Software/xmark/xmark001.xml" });
        request1.setBaseCollection("/xmark");
        Object result1 = engine.execute(request1);
        Assert.assertEquals(Boolean.TRUE, result1);
    }

    @Test
    public void testExecuteQuery() throws RemoteException, UnknownHostException {
View Full Code Here


    @Test
    public void testExecuteQuery() throws RemoteException, UnknownHostException {
        XQEngine engine = new XQEngineClient("//" + bindHost + ":1099/xbird/srv-01");

        QueryRequest request1 = new QueryRequest("1+2", ReturnType.STRING);
        Object result1 = engine.execute(request1);
        Assert.assertEquals("3", result1);

        QueryRequest request2 = new QueryRequest("1+4");
        Object result2 = engine.execute(request2);
        Assert.assertEquals(new XInteger(5), result2);
View Full Code Here

        QueryRequest request1 = new QueryRequest("1+2", ReturnType.STRING);
        Object result1 = engine.execute(request1);
        Assert.assertEquals("3", result1);

        QueryRequest request2 = new QueryRequest("1+4");
        Object result2 = engine.execute(request2);
        Assert.assertEquals(new XInteger(5), result2);
    }

    @Test
    public void testExecuteQueryRemoteSequence() throws RemoteException, UnknownHostException {
View Full Code Here

    public void testExecuteQueryRemoteSequence() throws RemoteException, UnknownHostException {
        XQEngine engine = new XQEngineClient("//" + bindHost + ":1099/xbird/srv-01");

        QueryRequest request1 = new QueryRequest("1+2", ReturnType.REMOTE_SEQUENCE);

        Object result1 = engine.execute(request1);
        RemoteSequence remoteSequence = (RemoteSequence) result1;

        Assert.assertFalse(remoteSequence.isEmpty());
        IFocus<Item> focus = remoteSequence.iterator();
        Assert.assertEquals(new XInteger(3), focus.next());
View Full Code Here

        QueryRequest request1 = new QueryRequest("1+2", ReturnType.STRING);
        request1.setReplyPattern(ReplyPattern.POLL);
        // not send
        Assert.assertNull(engine.poll(request1));
        // send#1
        Assert.assertNull(engine.execute(request1));
        // poll#1            
        Thread.sleep(3000);
        Assert.assertEquals("3", engine.poll(request1));
        // after polled
        Assert.assertNull(engine.poll(request1));
View Full Code Here

        // after polled
        Assert.assertNull(engine.poll(request1));
        // send#2
        QueryRequest request2 = new QueryRequest("1+4");
        request2.setReplyPattern(ReplyPattern.POLL);
        Assert.assertNull(engine.execute(request2));
        // poll#2
        Thread.sleep(3000);
        Assert.assertEquals(new XInteger(5), engine.poll(request2));
    }
View Full Code Here

        // not send
        Assert.assertNull(engine.poll(request1));
        // send#2
        QueryRequest request2 = new QueryRequest("1+4");
        request2.setReplyPattern(ReplyPattern.POLL);
        Assert.assertNull(engine.execute(request2));

        // send#1
        Assert.assertNull(engine.execute(request1));
        // poll#1
        Thread.sleep(3000);
View Full Code Here

        QueryRequest request2 = new QueryRequest("1+4");
        request2.setReplyPattern(ReplyPattern.POLL);
        Assert.assertNull(engine.execute(request2));

        // send#1
        Assert.assertNull(engine.execute(request1));
        // poll#1
        Thread.sleep(3000);
        Assert.assertEquals("3", engine.poll(request1));
        // after polled
        Assert.assertNull(engine.poll(request1));
View Full Code Here

        XQEngine engine = new XQEngineClient(remoteEndpoint);
        String query = IOUtils.toString(reader);
        QueryRequest request = new QueryRequest(query, ReturnType.ASYNC_REMOTE_SEQUENCE);
        final Sequence<Item> resultSeq;
        try {
            resultSeq = (Sequence<Item>) engine.execute(request);
        } catch (RemoteException e) {
            throw new XQueryException("failed to execute a query", e);
        }

        SAXWriter saxwr = prepareSAXWriter(writer);
View Full Code Here

    public void scenario01(String remoteEndpoint, String fileName) throws FileNotFoundException,
            IOException, XQueryException {
        XQEngine engine = new XQEngineClient(remoteEndpoint);
        String query = IOUtils.toString(new FileInputStream(fileName));
        QueryRequest request = new QueryRequest(query, ReturnType.ASYNC_REMOTE_SEQUENCE);
        Sequence<Item> resultSeq = (Sequence<Item>) engine.execute(request);
        Writer writer = new FastBufferedWriter(new OutputStreamWriter(System.out), 4096);
        SAXWriter saxwr = new SAXWriter(writer, "UTF-8");
        Serializer ser = new SAXSerializer(saxwr, writer);
        ser.emit(resultSeq);
        writer.flush();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.