Examples of Rpc


Examples of rocks.xmpp.extensions.rpc.model.Rpc

                "    </methodResponse>\n" +
                "  </query>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        Rpc rpc = iq.getExtension(Rpc.class);
        Assert.assertNotNull(rpc);
        Assert.assertEquals(rpc.getMethodResponse().getResponse().getAsString(), "Colorado");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

                "</methodResponse>" +
                "  </query>\n" +
                "</iq>";

        IQ iq = unmarshal(xml, IQ.class);
        Rpc rpc = iq.getExtension(Rpc.class);
        Assert.assertNotNull(rpc);
        Assert.assertNotNull(rpc.getMethodResponse().getFault());
        Assert.assertEquals(rpc.getMethodResponse().getFault().getFaultCode(), 4);
        Assert.assertEquals(rpc.getMethodResponse().getFault().getFaultString(), "Too many parameters.");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

                "      </params>\n" +
                "    </methodCall>\n" +
                "  </query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Rpc rpc = iq.getExtension(Rpc.class);
        Assert.assertNotNull(rpc);
        Assert.assertEquals(rpc.getMethodCall().getMethodName(), "examples.getStateName");
        Assert.assertEquals(rpc.getMethodCall().getParameters().size(), 4);
        Assert.assertEquals(rpc.getMethodCall().getParameters().get(0).getAsInteger(), (Integer) 6);
        Assert.assertEquals(rpc.getMethodCall().getParameters().get(1).getAsBoolean(), Boolean.FALSE);
        Assert.assertEquals(rpc.getMethodCall().getParameters().get(2).getAsArray().get(0).getAsBoolean(), Boolean.TRUE);
        Assert.assertEquals(rpc.getMethodCall().getParameters().get(3).getAsMap().get("key").getAsBoolean(), Boolean.TRUE);
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

        Assert.assertEquals(rpc.getMethodCall().getParameters().get(3).getAsMap().get("key").getAsBoolean(), Boolean.TRUE);
    }

    @Test
    public void marshalRpcMethodCallWithInteger() throws JAXBException, XMLStreamException {
        Rpc rpc = new Rpc("testMethod", new Value(1));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><int>1</int></value></param></params></methodCall></query>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><int>1</int></value></param></params></methodCall></query>");
    }

    @Test
    public void marshalRpcMethodCallWithString() throws JAXBException, XMLStreamException {
        Rpc rpc = new Rpc("testMethod", new Value("test"));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><string>test</string></value></param></params></methodCall></query>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><string>test</string></value></param></params></methodCall></query>");
    }

    @Test
    public void marshalRpcMethodCallWithDouble() throws JAXBException, XMLStreamException {
        Rpc rpc = new Rpc("testMethod", new Value(10.4));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><double>10.4</double></value></param></params></methodCall></query>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

    @Test
    public void marshalRpcMethodCallWithBase64() throws JAXBException, XMLStreamException {
        byte[] bytes = new byte[1];
        bytes[0] = 65;
        Rpc rpc = new Rpc("testMethod", new Value(bytes));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><base64>QQ==</base64></value></param></params></methodCall></query>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

        calendar.set(Calendar.DATE, 23);
        calendar.set(Calendar.HOUR_OF_DAY, 22);
        calendar.set(Calendar.MINUTE, 37);
        calendar.set(Calendar.SECOND, 34);
        calendar.set(Calendar.MILLISECOND, 0);
        Rpc rpc = new Rpc("testMethod", new Value(calendar.getTime()));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><dateTime.iso8601>" + DatatypeConverter.printDateTime(calendar) + "</dateTime.iso8601></value></param></params></methodCall></query>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

    @Test
    public void marshalRpcMethodCallWithArray() throws JAXBException, XMLStreamException {
        List<Value> values = new ArrayList<>();
        values.add(new Value(1));
        values.add(new Value(2));
        Rpc rpc = new Rpc("testMethod", new Value(values));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><array><data><value><int>1</int></value><value><int>2</int></value></data></array></value></param></params></methodCall></query>");
    }
View Full Code Here

Examples of rocks.xmpp.extensions.rpc.model.Rpc

    @Test
    public void marshalRpcMethodCallWithMap() throws JAXBException, XMLStreamException {
        Map<String, Value> map = new LinkedHashMap<>();
        map.put("key1", new Value(1));
        map.put("key2", new Value(true));
        Rpc rpc = new Rpc("testMethod", new Value(map));
        String xml = marshal(rpc);
        Assert.assertEquals(xml, "<query xmlns=\"jabber:iq:rpc\"><methodCall><methodName>testMethod</methodName><params><param><value><struct><member><name>key1</name><value><int>1</int></value></member><member><name>key2</name><value><boolean>1</boolean></value></member></struct></value></param></params></methodCall></query>");
    }
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.