Package org.apache.vysper.xmpp.addressing

Examples of org.apache.vysper.xmpp.addressing.EntityImpl


        dictionaries.add(new org.apache.vysper.xmpp.modules.core.session.SessionStanzaDictionary());
        dictionaries.add(new org.apache.vysper.xmpp.modules.core.compatibility.jabber_iq_auth.JabberIQAuthDictionary());
        dictionaries.add(new org.apache.vysper.xmpp.modules.roster.RosterDictionary());
       
        DefaultServerRuntimeContext serverContext = new DefaultServerRuntimeContext(
                new EntityImpl(null, "test", null),
                relay,
                new ServerFeatures(),
                dictionaries,
                new ResourceRegistry());
View Full Code Here


            Entity from = stanza.getFrom();
            if (from == null || !from.isResourceSet()) {
                // rewrite stanza with new from
                String resource = serverRuntimeContext.getResourceRegistry().getUniqueResourceForSession(sessionContext);
                if (resource == null) throw new IllegalStateException("could not determine unique resource");
                from = new EntityImpl(sessionContext.getInitiatingEntity(), resource);
                StanzaBuilder stanzaBuilder = new StanzaBuilder(stanza.getName());
                for (Attribute attribute : stanza.getAttributes()) {
                    if ("from".equals(attribute.getName())) continue;
                    stanzaBuilder.addAttribute(attribute);
                }
View Full Code Here

    public void testSimpleRelay() throws EntityFormatException, XMLSemanticError, DeliveryException {
        DefaultServerRuntimeContext serverRuntimeContext = new DefaultServerRuntimeContext(null, null);
        stanzaRelay.setServerRuntimeContext(serverRuntimeContext);
       
        EntityImpl fromEntity = EntityImpl.parse("userFrom@vysper.org");
        EntityImpl toEntity = EntityImpl.parse("userTo@vysper.org");
        TestSessionContext sessionContext = TestSessionContext.createSessionContext(toEntity);
        sessionContext.setSessionState(SessionState.AUTHENTICATED);
        resourceRegistry.bindSession(sessionContext);

        Stanza stanza = StanzaBuilder.createMessageStanza(fromEntity, toEntity, "en", "Hello").build();
View Full Code Here

            throw e;
        }
    }
   
    public void testSimpleRelayToUnboundSession() throws EntityFormatException, XMLSemanticError, DeliveryException {
        EntityImpl fromEntity = EntityImpl.parse("userFrom@vysper.org");
        EntityImpl toEntity = EntityImpl.parse("userTo@vysper.org");
        TestSessionContext sessionContext = TestSessionContext.createSessionContext(toEntity);
        String resource = resourceRegistry.bindSession(sessionContext);
        boolean noResourceRemains = resourceRegistry.unbindResource(resource);
        assertTrue(noResourceRemains);
View Full Code Here

        // !! DeliverMessageToHighestPriorityResourcesOnly = FALSE
        serverRuntimeContext.getServerFeatures().setDeliverMessageToHighestPriorityResourcesOnly(false);

        stanzaRelay.setServerRuntimeContext(serverRuntimeContext);

        EntityImpl fromEntity = EntityImpl.parse("userFrom@vysper.org");

        EntityImpl toEntity = EntityImpl.parse("userTo@vysper.org");


        TestSessionContext sessionContextToEntity_1_prio3 = createSessionForTo(toEntity, 3); // NON-NEGATIVE
        TestSessionContext sessionContextToEntity_2_prio0 = createSessionForTo(toEntity, 0); // NON-NEGATIVE
        TestSessionContext sessionContextToEntity_3_prio3 = createSessionForTo(toEntity, 3); // NON-NEGATIVE
View Full Code Here

        // !! DeliverMessageToHighestPriorityResourcesOnly = TRUE
        serverRuntimeContext.getServerFeatures().setDeliverMessageToHighestPriorityResourcesOnly(true);

        stanzaRelay.setServerRuntimeContext(serverRuntimeContext);

        EntityImpl fromEntity = EntityImpl.parse("userFrom@vysper.org");

        EntityImpl toEntity = EntityImpl.parse("userTo@vysper.org");


        TestSessionContext sessionContextToEntity_1_prio3 = createSessionForTo(toEntity, 3); // HIGHEST PRIO
        TestSessionContext sessionContextToEntity_2_prio0 = createSessionForTo(toEntity, 1); // not receiving
        TestSessionContext sessionContextToEntity_3_prio3 = createSessionForTo(toEntity, 3); // HIGHEST PRIO
View Full Code Here

            assertEquals(expectedAskSubscriptionType, item.getAskSubscriptionType());
        }
    }

    private RosterItem prepareItem(SubscriptionType initialSubscriptionType, AskSubscriptionType initialAskSubscriptionType) {
        EntityImpl jid = null;
        try {
            jid = EntityImpl.parse("test@test.org");
        } catch (EntityFormatException e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }
View Full Code Here

     * @param sessionStateHolder
     * @return
     */
    public static TestSessionContext createWithStanzaReceiverRelay(SessionStateHolder sessionStateHolder) {
        StanzaReceiverRelay relay = new org.apache.vysper.xmpp.delivery.StanzaReceiverRelay();
        DefaultServerRuntimeContext serverContext = new DefaultServerRuntimeContext(new EntityImpl(null, "test", null), relay);
        relay.setServerRuntimeContext(serverContext);
        return new TestSessionContext(serverContext, sessionStateHolder);
    }
View Full Code Here

        return new TestSessionContext(serverContext, sessionStateHolder);
    }

    public TestSessionContext(SessionStateHolder sessionStateHolder) {
        this(new DefaultServerRuntimeContext(
                new EntityImpl(null, "test", null),
                new RecordingStanzaRelay(),
                new MemoryStorageProviderRegistry()),
             sessionStateHolder);
    }
View Full Code Here

    public StanzaReceiverQueue addReceiver(Entity entity, String resourceId) {
        if (!(getServerRuntimeContext().getStanzaRelay() instanceof StanzaReceiverRelay)) {
            throw new RuntimeException("cannot add receiver - the stanza relay is of a different kind");
        }
        StanzaReceiverQueue relay = new StanzaReceiverQueue();
        if (resourceId != null) entity = new EntityImpl(entity.getNode(), entity.getDomain(), resourceId);
        ((StanzaReceiverRelay) getServerRuntimeContext().getStanzaRelay()).add(entity, relay);
        return relay;
    }
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.addressing.EntityImpl

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.