You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Leon Doud <le...@gmail.com> on 2013/03/05 04:42:11 UTC

Rosters not working as expected

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();
    }
}

Re: Rosters not working as expected

Posted by Emmanuel Lecharny <el...@apache.org>.
Le 22 mars 2013 03:10, "Leon Doud" <le...@gmail.com> a écrit :
>
> I may have given the wrong impression. I understand its a volunteer
effort.

Your question was perfectly legitimate. As you can imagine, there is not
enough traffic to justify the creatiin if a deducated maling list for
Vysper.

> I was afraid that there might have been a Vysper specific mailing list and
> I was emailing the wrong project mailing list. :)
>
> I'd really like to contribute. Currently I'm looking at a possible issue
> with presence notifications.
>
> On Thu, Mar 21, 2013 at 1:20 AM, Emmanuel Lécharny <elecharny@gmail.com
>wrote:
>
> > Le 3/21/13 2:20 AM, Leon Doud a écrit :
> > > Is there a better mailing list to use for Vysper API questions?  The
lack
> > > of response makes me feel that I'm asking in the wrong place.
> > No, this is the place.
> >
> > People don't reply if they don't have an answer to you question, or when
> > they are busy, or when they have some vacations.
> >
> > Keep in mind this is a volunteers effort, so it's likely that people
> > have a day job, and may be extremely busy...
> >
> > We are just doing the best we can. Sometime, this is not enough :/ OTOH,
> > we would be pleased to get some more contributors, ths is an open
> > community :)
> >
> > --
> > Regards,
> > Cordialement,
> > Emmanuel Lécharny
> > www.iktek.com
> >
> >

Re: Rosters not working as expected

Posted by Bernd Fondermann <bf...@brainlounge.de>.
Leon,

On 22.03.13 03:10, Leon Doud wrote:
> I may have given the wrong impression. I understand its a volunteer effort.
> I was afraid that there might have been a Vysper specific mailing list and
> I was emailing the wrong project mailing list. :)

I'm personally sorry that your request got dropped.
Yet, you did the right thing and followed up on-list.

   Bernd


Re: Rosters not working as expected

Posted by Leon Doud <le...@gmail.com>.
I may have given the wrong impression. I understand its a volunteer effort.
I was afraid that there might have been a Vysper specific mailing list and
I was emailing the wrong project mailing list. :)

I'd really like to contribute. Currently I'm looking at a possible issue
with presence notifications.

On Thu, Mar 21, 2013 at 1:20 AM, Emmanuel Lécharny <el...@gmail.com>wrote:

> Le 3/21/13 2:20 AM, Leon Doud a écrit :
> > Is there a better mailing list to use for Vysper API questions?  The lack
> > of response makes me feel that I'm asking in the wrong place.
> No, this is the place.
>
> People don't reply if they don't have an answer to you question, or when
> they are busy, or when they have some vacations.
>
> Keep in mind this is a volunteers effort, so it's likely that people
> have a day job, and may be extremely busy...
>
> We are just doing the best we can. Sometime, this is not enough :/ OTOH,
> we would be pleased to get some more contributors, ths is an open
> community :)
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Re: Rosters not working as expected

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 3/21/13 2:20 AM, Leon Doud a écrit :
> Is there a better mailing list to use for Vysper API questions?  The lack
> of response makes me feel that I'm asking in the wrong place.
No, this is the place.

People don't reply if they don't have an answer to you question, or when
they are busy, or when they have some vacations.

Keep in mind this is a volunteers effort, so it's likely that people
have a day job, and may be extremely busy...

We are just doing the best we can. Sometime, this is not enough :/ OTOH,
we would be pleased to get some more contributors, ths is an open
community :)

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: Rosters not working as expected

Posted by Leon Doud <le...@gmail.com>.
I tried my code with Vysper 0.8 snapshot, and that fixed the isue. There
were some minor updates required to the code as some classes are now
deprecated. Afer those updates I was able to run an embedded Vysper server
and connect using both Spark and Pidgin, with working rosters.

Is there a better mailing list to use for Vysper API questions?  The lack
of response makes me feel that I'm asking in the wrong place.

On Thu, Mar 14, 2013 at 11:32 PM, Leon Doud <le...@gmail.com> wrote:

> 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 <le...@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();
>>     }
>> }
>>
>>
>>
>>
>>
>>
>

Re: Rosters not working as expected

Posted by Leon Doud <le...@gmail.com>.
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 <le...@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();
>     }
> }
>
>
>
>
>
>