mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Doud <leon.d...@gmail.com>
Subject Re: Rosters not working as expected
Date Fri, 15 Mar 2013 03:32:05 GMT
I'm still trying to figure out what I'm not doing correctly. While trying
to debug the issue I noticed that there wasn't a test case for the
MemoryRosterManager. I expected that there was a bug there related to
EntityImpl and hashmaps. I was wrong and my test case showed everything
works fine (nice job on implementing hashCode and equals in EntityImpl).

I'd like to contribute this test case. I'll attach it to this email. Just
in case the attachment is stripped off, the file is called
"MemoryRosterManagerTestCase" and it can be found in my git hub repo for
vysper (
https://github.com/ldoud/vysper/tree/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/roster/persistence
).

If anyone can provide any insight into my roster issue that I mentioned in
my previous post it would be appreicated.

Thanks,
Leon

On Mon, Mar 4, 2013 at 10:42 PM, Leon Doud <leon.doud@gmail.com> wrote:

> Hello,
>
> I'm trying to use Vysper (version 0.7)  to programmatically create an XMPP
> server instance for use in a jUnit test. For the test there are two users
> configured on the XMPP server. Each user has the other user on their own
> roster.
>
> The test sends one chat message from the first user to the second user.
> The test does not work. I figured the message was being blocked because the
> rosters are not setup correctly.
>
> To test this theory I logged into the XMPP server as both users, using
> Pidgin. When I logged in as "user1", the only person on my roster was
> "user1".  When I logged in as "user2", no one was on my roster.
>
> Below is the Java code where I attempt to programmatically create an XMPP
> server, two users and rosters for both users. I appreciate any help
> figuring out what I'm doing wrong.
>
> Thanks,
> Leon
>
>
> package org.apache.cxf.transport.xmpp.chat;
>
> import org.apache.vysper.mina.TCPEndpoint;
> import org.apache.vysper.storage.StorageProviderRegistry;
> import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> import org.apache.vysper.xmpp.addressing.Entity;
> import org.apache.vysper.xmpp.addressing.EntityImpl;
> import org.apache.vysper.xmpp.authorization.AccountManagement;
> import org.apache.vysper.xmpp.modules.roster.RosterItem;
> import org.apache.vysper.xmpp.modules.roster.SubscriptionType;
> import org.apache.vysper.xmpp.modules.roster.persistence.RosterManager;
> import org.apache.vysper.xmpp.server.XMPPServer;
>
> public class ConduitTest {
>
>     private static final String CERT_FILENAME = "bogus_mina_tls.cert";
>     private static final String CERT_PASSWORD = "boguspw";
>
>     private static final String DOMAIN_NAME = "localhost.localdomain";
>     private static final String USER2_NAME = "service1@" + DOMAIN_NAME;
>     private static final String USER2_PASSWORD = "service1";
>
>     private static final String USER1_NAME = "user1@" + DOMAIN_NAME;
>     private static final String USER1_PASSWORD = "user1";
>
>     public static void main(String[] args) throws Exception {
>         XMPPServer server = new XMPPServer(DOMAIN_NAME);
>         server.addEndpoint(new TCPEndpoint());
>
> server.setTLSCertificateInfo(ClassLoader.getSystemResourceAsStream(CERT_FILENAME),
> CERT_PASSWORD);
>
>         // Store data in memory.
>         StorageProviderRegistry providerRegistry = new
> MemoryStorageProviderRegistry();
>         server.setStorageProviderRegistry(providerRegistry);
>
>         // Create test users.
>         Entity user1Entity = EntityImpl.parse(USER1_NAME);
>         Entity user2Entity = EntityImpl.parse(USER2_NAME);
>
>         AccountManagement accountManagement =
> (AccountManagement)providerRegistry.retrieve(AccountManagement.class);
>         accountManagement.addUser(user1Entity, USER1_PASSWORD);
>         accountManagement.addUser(user2Entity, USER2_PASSWORD);
>
>         RosterManager rosterManager =
> (RosterManager)providerRegistry.retrieve(RosterManager.class);
>         rosterManager.addContact(user2Entity, new RosterItem(user1Entity,
> SubscriptionType.BOTH));
>         rosterManager.addContact(user1Entity, new RosterItem(user2Entity,
> SubscriptionType.BOTH));
>
>         server.start();
>         Thread.sleep(60000);
>         server.stop();
>     }
> }
>
>
>
>
>
>

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message