Package org.apache.vysper.xmpp.stanza

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


    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();
View Full Code Here


        assertTrue("error", verifier.nameEquals("error"));
    }

    public void testMissingID() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaBuilder.addAttribute("type", "get");
        assertIQError(stanzaBuilder.build());
    }

    public void testDoNotRespondToErrorWithError() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
View Full Code Here

        assertIQError(stanzaBuilder.build());
    }

    public void testDoNotRespondToErrorWithError() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaBuilder.addAttribute("type", "error");
        Stanza stanza = stanzaBuilder.build(); // this stanza has no ID

        IQHandler iqHandler = new IQHandler();
        ResponseStanzaContainer responseStanzaContainer = iqHandler.execute(stanza, sessionContext
                .getServerRuntimeContext(), true, sessionContext, null);
View Full Code Here

        assertTrue("iq-error", verifier.subElementPresent("error"));
    }

    public void testMissingType() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaBuilder.addAttribute("id", "1");
        // missing: stanzaBuilder.addAttribute("type", "get");
        assertIQError(stanzaBuilder.build());
    }

    public void testUnsupportedType() {
View Full Code Here

        assertIQError(stanzaBuilder.build());
    }

    public void testUnsupportedType() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaBuilder.addAttribute("id", "1");
        stanzaBuilder.addAttribute("type", "bogus");
        assertIQError(stanzaBuilder.build());
    }

    public void testGetAndSetSubelements() {
View Full Code Here

    }

    public void testUnsupportedType() {
        StanzaBuilder stanzaBuilder = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaBuilder.addAttribute("id", "1");
        stanzaBuilder.addAttribute("type", "bogus");
        assertIQError(stanzaBuilder.build());
    }

    public void testGetAndSetSubelements() {
        // get and set must have exactly one subelement
View Full Code Here

        assertNotTwoSubs(type); // test with two
    }

    private void assertNotTwoSubs(String type) {
        StanzaBuilder stanzaTwoSubs = new StanzaBuilder("iq", NamespaceURIs.JABBER_CLIENT);
        stanzaTwoSubs.addAttribute("id", "1");
        stanzaTwoSubs.addAttribute("type", type);
        stanzaTwoSubs.startInnerElement("firstSub", NamespaceURIs.JABBER_CLIENT).endInnerElement();
        stanzaTwoSubs.startInnerElement("secondSub", NamespaceURIs.JABBER_CLIENT).endInnerElement();
        assertIQError(stanzaTwoSubs.build());
    }
View Full Code Here

        CallTestStanzaHandler stanzaHandler = new CallTestStanzaHandler("iq");
        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);
View Full Code Here

        namespaceHandlerDictionary.register(stanzaHandler);

        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);
View Full Code Here

        String onlyBoundResource = sessionContext.bindResource();
        String arbitraryUnboundResource = "unboundResourceID";

        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);
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.