mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-15 03:59:38 +02:00
Improve PubSub API
Use Manager pattern for PubSubManager. Also improve the API of ServiceDiscoverManager.
This commit is contained in:
parent
9e351f0535
commit
001e824fb9
16 changed files with 368 additions and 140 deletions
|
@ -54,7 +54,7 @@ public class ConfigureFormTest
|
|||
public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
|
||||
PubSubManager mgr = new PubSubManager(con);
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
|
@ -81,7 +81,7 @@ public class ConfigureFormTest
|
|||
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException, XmppStringprepException
|
||||
{
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
PubSubManager mgr = new PubSubManager(con);
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
|
|
|
@ -25,13 +25,29 @@ import org.jivesoftware.smack.ThreadedDummyConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSub;
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
|
||||
public class PubSubManagerTest {
|
||||
|
||||
public static final DomainBareJid DUMMY_PUBSUB_SERVICE;
|
||||
|
||||
static {
|
||||
DomainBareJid pubSubService;
|
||||
try {
|
||||
pubSubService = JidCreate.domainBareFrom("pubsub.dummy.org");
|
||||
}
|
||||
catch (XmppStringprepException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
DUMMY_PUBSUB_SERVICE = pubSubService;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteNodeTest() throws InterruptedException, SmackException, IOException, XMPPException {
|
||||
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
|
||||
PubSubManager mgr = new PubSubManager(con);
|
||||
PubSubManager mgr = new PubSubManager(con, DUMMY_PUBSUB_SERVICE);
|
||||
|
||||
mgr.deleteNode("foo@bar.org");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue