Package org.apache.vysper.xmpp.addressing

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


        return parseEntityAttribute("from");
    }

    public Entity parseEntityAttribute(String attributeName) {
        boolean isPresent = getVerifier().attributePresent(attributeName);
        EntityImpl entity = null;
        if (isPresent) {
            String attributeValue = getAttributeValue(attributeName);
            try {
                entity = EntityImpl.parse(attributeValue);
            } catch (EntityFormatException e) {
View Full Code Here


        assertEquals(resourceRegistry.getSessionContext(resourceId1), sessionContext1);
        assertEquals(resourceRegistry.getSessionContext(resourceId2), sessionContext2);
    }
   
    public void testAddOneEntityMultipleResources() throws EntityFormatException {
        EntityImpl entity = EntityImpl.parse("me@test");
       
        TestSessionContext sessionContext1 = TestSessionContext.createSessionContext(entity);
        String resourceId1 = resourceRegistry.bindSession(sessionContext1);
        resourceRegistry.setResourcePriority(resourceId1, -1);
       
View Full Code Here

        sessionContext1.getServerRuntimeContext().getServerFeatures().setDeliverMessageToHighestPriorityResourcesOnly(false);

    }

    public void testAddOneEntityMultipleResources_TolerateResourceIds() throws EntityFormatException {
        EntityImpl entity = EntityImpl.parse("me@test");
       
        TestSessionContext sessionContext1 = TestSessionContext.createSessionContext(EntityImpl.parse("me@test/xy"));
        String resourceId1 = resourceRegistry.bindSession(sessionContext1);
       
        TestSessionContext sessionContext2 = TestSessionContext.createSessionContext(EntityImpl.parse("me@test/ab"));
View Full Code Here

        assertTrue(sessionList.contains(sessionContext1));
        assertTrue(sessionList.contains(sessionContext2));
    }

    public void testSameEntityMultipleResources() throws EntityFormatException {
        EntityImpl entity = EntityImpl.parse("me@test");
       
        TestSessionContext sessionContext1 = TestSessionContext.createSessionContext(entity);
        String resourceId1 = resourceRegistry.bindSession(sessionContext1);
       
        TestSessionContext sessionContext2 = TestSessionContext.createSessionContext(entity);
View Full Code Here

        // resource ids are different
        assertFalse(resourceId1.equals(resourceId2));
    }
   
    public void testUnbindResourceSimple() throws EntityFormatException {
        EntityImpl entity = EntityImpl.parse("me@test");
       
        TestSessionContext sessionContext1 = TestSessionContext.createSessionContext(entity);
        String resourceId1 = resourceRegistry.bindSession(sessionContext1);
        assertEquals(sessionContext1, resourceRegistry.getSessionContext(resourceId1));
       
View Full Code Here

        assertNull(resourceRegistry.getSessionContext(resourceId1));
        assertEquals(0, resourceRegistry.getBoundResources(entity).size());
    }
   
    public void testUnbindSessionSimple() throws EntityFormatException {
        EntityImpl entity = EntityImpl.parse("me@test");
       
        TestSessionContext sessionContext1 = TestSessionContext.createSessionContext(entity);
        String resourceId1 = resourceRegistry.bindSession(sessionContext1);
        assertEquals(sessionContext1, resourceRegistry.getSessionContext(resourceId1));
       
View Full Code Here

        assertNull(resourceRegistry.getSessionContext(resourceId1));
        assertEquals(0, resourceRegistry.getBoundResources(entity).size());
    }

    public void testUniqueResourceIsConsistent() throws EntityFormatException {
        EntityImpl entity = EntityImpl.parse("me@test");
        TestSessionContext sessionContext = TestSessionContext.createSessionContext(entity);
        String resourceId1 = resourceRegistry.bindSession(sessionContext);

        String first1 = resourceRegistry.getUniqueResourceForSession(sessionContext);
        assertEquals(resourceId1, first1);
View Full Code Here

        String username = decodedParts.get(1); // "authentication identity (identity whose password will be used)"
        String password = decodedParts.get(2);

        if (!username.contains("@"))
            username = username + "@" + sessionContext.getServerJID().getDomain();
        EntityImpl initiatingEntity;
        try {
            initiatingEntity = EntityImpl.parse(username);
        } catch (EntityFormatException e) {
            return AUTHORIZATION_RESPONSES.getFailureNotAuthorized();
        }
View Full Code Here

            return false;
        }
    }

    public void addUser(String username, String password) throws AccountCreationException {
        final EntityImpl entity;
        try {
            entity = EntityImpl.parse(username);
        } catch (EntityFormatException e) {
            throw new AccountCreationException("username is expected to be in proper entity format, not " + username, e); // wrap as unchecked
        }
        // if already existent, don't create, throw error
        try {
            if (jcrStorage.getEntityNode(entity, CREDENTIALS_NAMESPACE, false) != null) {
                throw new AccountCreationException("account already exists: " + entity.getFullQualifiedName());
            }
        } catch (JcrStorageException e) {
            throw new AccountCreationException("account exists check failed for " + entity.getFullQualifiedName(), e);
        }
        // now, finally, create
        try {
            final Node credentialsNode = jcrStorage.getEntityNode(entity, CREDENTIALS_NAMESPACE, true);
            credentialsNode.setProperty("password", password);
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

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.