Package org.apache.vysper.xmpp.stanza

Examples of org.apache.vysper.xmpp.stanza.StanzaBuilder.startInnerElement()


        //    </iq>
        //
        // S: <iq from='capulet.lit' to='juliet@capulet.lit/balcony' id='c2s1' type='result'/>

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(boundClient, server, IQStanzaType.GET, IQ_ID);
        stanzaBuilder.startInnerElement("ping", NamespaceURIs.URN_XMPP_PING).endInnerElement();

        Stanza requestStanza = stanzaBuilder.build();
        ResponseStanzaContainer resp = handler.execute(requestStanza, sessionContext.getServerRuntimeContext(), true,
                sessionContext, null);
View Full Code Here


    public void testStanzaError() throws ParsingException {
        StanzaBuilder builder = new StanzaBuilder("iq");
        builder.addAttribute("to", SERVER_JID);
        builder.addAttribute("from", CLIENT_JID);
        builder.startInnerElement("ping", NamespaceURIs.URN_XMPP_PING);
        builder.endInnerElement();

        Stanza request = builder.build();
        IQStanza requestIq = new IQStanza(request);
View Full Code Here

    }

    private StanzaBuilder createRosterGet() {
        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(new EntityImpl(client, boundResourceId), null,
                IQStanzaType.GET, "id1");
        stanzaBuilder.startInnerElement("query", NamespaceURIs.JABBER_IQ_ROSTER).endInnerElement();
        return stanzaBuilder;
    }

    private ResourceState getResourceState() {
        return sessionContext.getServerRuntimeContext().getResourceRegistry().getResourceState(boundResourceId);
View Full Code Here

        String timestamp = "" + System.currentTimeMillis();

        StanzaBuilder stanzaBuilder = new StanzaBuilder("message", NamespaceURIs.JABBER_SERVER);
        // receiver@vysper.org, NOT receiver@vysper.org/resourceID
        stanzaBuilder.addAttribute("to", receiverUser.getEntity().getBareJID().getFullQualifiedName());
        stanzaBuilder.startInnerElement("timestamp", NamespaceURIs.JABBER_SERVER).addAttribute("value", timestamp)
                .endInnerElement();

        senderSessionContext.setClientToServer();

        assertNull(receiverUser.getNextStanza()); // nothing there yet
View Full Code Here

    public void testMissingToInServerCall() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_SERVER);
        stanzaBuilder.addAttribute("type", "get");
        // missing stanzaBuilder.addAttribute("to", "test@example.com");
        stanzaBuilder.addAttribute("id", "anyway");
        stanzaBuilder.startInnerElement("inner", NamespaceURIs.JABBER_SERVER).endInnerElement();

        TestSessionContext sessionContext = this.sessionContext;
        sessionContext.setServerToServer();

        TestIQHandler iqHandler = new TestIQHandler();
View Full Code Here

        namespaceHandlerDictionary.register(stanzaHandler);

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(null, null, IQStanzaType.GET, "test");
        // we set a different from user name 'ernest'!
        stanzaBuilder.addAttribute("from", new EntityImpl("ernest", server.getDomain(), null).getFullQualifiedName());
        stanzaBuilder.startInnerElement("query", "jabber:iq:roster").endInnerElement();

        protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.build(),
                sessionStateHolder);

        try {
View Full Code Here

        String onlyBoundResource = sessionContext.bindResource();

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(null, null, IQStanzaType.GET, "test");
        stanzaBuilder.addAttribute("from", new EntityImpl("charlotte", server.getDomain(), onlyBoundResource)
                .getFullQualifiedName());
        stanzaBuilder.startInnerElement("query", "testNSURI").endInnerElement();

        protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.build(),
                sessionStateHolder);

        stanzaHandler.assertHandlerCalled();
View Full Code Here

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(null, null, IQStanzaType.GET, "test");

        stanzaBuilder.addAttribute("from", new EntityImpl("charlotte", server.getDomain(), arbitraryUnboundResource)
                .getFullQualifiedName());
        stanzaBuilder.startInnerElement("query", "testNSURI").endInnerElement();

        protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.build(),
                sessionStateHolder);

        try {
View Full Code Here

        String firstBoundResource = sessionContext.bindResource();
        String secondBoundResource = sessionContext.bindResource();

        StanzaBuilder stanzaBuilder = StanzaBuilder.createIQStanza(null, null, IQStanzaType.GET, "test");
        stanzaBuilder.addAttribute("from", new EntityImpl("lea", server.getDomain(), null).getFullQualifiedName());
        stanzaBuilder.startInnerElement("query", "testNSURI").endInnerElement();

        protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.build(),
                sessionStateHolder);
        Stanza recordedResponse = sessionContext.getNextRecordedResponse();
        assertUnknownSenderError(recordedResponse); // not allowed, bare id without resource and two resources bound
View Full Code Here

        assertFalse(noResourceRemains);

        // bare id allowed, only one resource is bound
        stanzaBuilder = StanzaBuilder.createIQStanza(null, null, IQStanzaType.GET, "test");
        stanzaBuilder.addAttribute("from", new EntityImpl("lea", server.getDomain(), null).getFullQualifiedName());
        stanzaBuilder.startInnerElement("query", "testNSURI").endInnerElement();
        protocolWorker.processStanza(sessionContext.getServerRuntimeContext(), sessionContext, stanzaBuilder.build(),
                sessionStateHolder);
        stanzaHandler.assertHandlerCalled();
        sessionContext.reset();
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.