mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Added a few more tests for pubsub configuration
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_2_0@12587 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
fdd60122d3
commit
ec66d6ea52
1 changed files with 63 additions and 0 deletions
|
@ -2,6 +2,17 @@ package org.jivesoftware.smackx.pubsub;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.SmackConfiguration;
|
||||||
|
import org.jivesoftware.smack.ThreadedDummyConnection;
|
||||||
|
import org.jivesoftware.smack.XMPPException;
|
||||||
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
|
import org.jivesoftware.smack.packet.PacketExtension;
|
||||||
|
import org.jivesoftware.smack.packet.XMPPError;
|
||||||
|
import org.jivesoftware.smack.packet.XMPPError.Condition;
|
||||||
|
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
||||||
|
import org.jivesoftware.smackx.packet.DiscoverInfo.Identity;
|
||||||
|
import org.jivesoftware.smackx.pubsub.packet.PubSub;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class ConfigureFormTest
|
public class ConfigureFormTest
|
||||||
|
@ -13,4 +24,56 @@ public class ConfigureFormTest
|
||||||
form.setChildrenAssociationPolicy(ChildrenAssociationPolicy.owners);
|
form.setChildrenAssociationPolicy(ChildrenAssociationPolicy.owners);
|
||||||
assertEquals(ChildrenAssociationPolicy.owners, form.getChildrenAssociationPolicy());
|
assertEquals(ChildrenAssociationPolicy.owners, form.getChildrenAssociationPolicy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfigFormWithInsufficientPriviliges() throws XMPPException
|
||||||
|
{
|
||||||
|
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||||
|
PubSubManager mgr = new PubSubManager(con);
|
||||||
|
DiscoverInfo info = new DiscoverInfo();
|
||||||
|
Identity ident = new Identity("pubsub", null);
|
||||||
|
ident.setType("leaf");
|
||||||
|
info.addIdentity(ident);
|
||||||
|
con.addIQReply(info);
|
||||||
|
|
||||||
|
Node node = mgr.getNode("princely_musings");
|
||||||
|
|
||||||
|
PubSub errorIq = new PubSub();
|
||||||
|
XMPPError error = new XMPPError(Condition.forbidden);
|
||||||
|
errorIq.setError(error);
|
||||||
|
con.addIQReply(errorIq);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
node.getNodeConfiguration();
|
||||||
|
}
|
||||||
|
catch (XMPPException e)
|
||||||
|
{
|
||||||
|
Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getConfigFormWithTimeout() throws XMPPException
|
||||||
|
{
|
||||||
|
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||||
|
PubSubManager mgr = new PubSubManager(con);
|
||||||
|
DiscoverInfo info = new DiscoverInfo();
|
||||||
|
Identity ident = new Identity("pubsub", null);
|
||||||
|
ident.setType("leaf");
|
||||||
|
info.addIdentity(ident);
|
||||||
|
con.addIQReply(info);
|
||||||
|
|
||||||
|
Node node = mgr.getNode("princely_musings");
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
SmackConfiguration.setPacketReplyTimeout(100);
|
||||||
|
node.getNodeConfiguration();
|
||||||
|
// }
|
||||||
|
// catch (XMPPException e)
|
||||||
|
// {
|
||||||
|
// Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue