mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-14 11:39:39 +02:00
Enfore spaces for indentation
Although I'm in the tabs camp, Smack uses mostly spaces. Therefore it is the logical choice for the indentation style.
This commit is contained in:
parent
ffe9397e66
commit
ef0af66b21
125 changed files with 5336 additions and 5344 deletions
|
@ -41,56 +41,56 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ConfigureFormTest
|
||||
{
|
||||
@Test
|
||||
public void checkChildrenAssocPolicy()
|
||||
{
|
||||
ConfigureForm form = new ConfigureForm(DataForm.Type.submit);
|
||||
form.setChildrenAssociationPolicy(ChildrenAssociationPolicy.owners);
|
||||
assertEquals(ChildrenAssociationPolicy.owners, form.getChildrenAssociationPolicy());
|
||||
}
|
||||
@Test
|
||||
public void checkChildrenAssocPolicy()
|
||||
{
|
||||
ConfigureForm form = new ConfigureForm(DataForm.Type.submit);
|
||||
form.setChildrenAssociationPolicy(ChildrenAssociationPolicy.owners);
|
||||
assertEquals(ChildrenAssociationPolicy.owners, form.getChildrenAssociationPolicy());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
con.addIQReply(info);
|
||||
@Test
|
||||
public void getConfigFormWithInsufficientPriviliges() throws XMPPException, SmackException, IOException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
con.addIQReply(info);
|
||||
|
||||
Node node = mgr.getNode("princely_musings");
|
||||
Node node = mgr.getNode("princely_musings");
|
||||
|
||||
PubSub errorIq = new PubSub();
|
||||
XMPPError.Builder error = XMPPError.getBuilder(Condition.forbidden);
|
||||
errorIq.setError(error);
|
||||
con.addIQReply(errorIq);
|
||||
PubSub errorIq = new PubSub();
|
||||
XMPPError.Builder error = XMPPError.getBuilder(Condition.forbidden);
|
||||
errorIq.setError(error);
|
||||
con.addIQReply(errorIq);
|
||||
|
||||
try
|
||||
{
|
||||
node.getNodeConfiguration();
|
||||
}
|
||||
catch (XMPPErrorException e)
|
||||
{
|
||||
Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
node.getNodeConfiguration();
|
||||
}
|
||||
catch (XMPPErrorException e)
|
||||
{
|
||||
Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
|
||||
}
|
||||
}
|
||||
|
||||
@Test (expected=SmackException.class)
|
||||
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
con.addIQReply(info);
|
||||
@Test (expected=SmackException.class)
|
||||
public void getConfigFormWithTimeout() throws XMPPException, SmackException, InterruptedException
|
||||
{
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
|
||||
DiscoverInfo info = new DiscoverInfo();
|
||||
Identity ident = new Identity("pubsub", null, "leaf");
|
||||
info.addIdentity(ident);
|
||||
con.addIQReply(info);
|
||||
|
||||
Node node = mgr.getNode("princely_musings");
|
||||
Node node = mgr.getNode("princely_musings");
|
||||
|
||||
SmackConfiguration.setDefaultReplyTimeout(100);
|
||||
con.setTimeout();
|
||||
SmackConfiguration.setDefaultReplyTimeout(100);
|
||||
con.setTimeout();
|
||||
|
||||
node.getNodeConfiguration();
|
||||
}
|
||||
node.getNodeConfiguration();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,63 +37,63 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
*
|
||||
*/
|
||||
public class ItemValidationTest extends InitExtensions {
|
||||
private ThreadedDummyConnection connection;
|
||||
private ThreadedDummyConnection connection;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
// Uncomment this to enable debug output
|
||||
// SmackConfiguration.DEBUG = true;
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
// Uncomment this to enable debug output
|
||||
// SmackConfiguration.DEBUG = true;
|
||||
|
||||
connection = new ThreadedDummyConnection();
|
||||
connection.connect();
|
||||
connection.login();
|
||||
}
|
||||
connection = new ThreadedDummyConnection();
|
||||
connection.connect();
|
||||
connection.login();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
}
|
||||
@After
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyBasicItem() throws Exception
|
||||
{
|
||||
Item simpleItem = new Item();
|
||||
String simpleCtrl = "<item />";
|
||||
assertXMLEqual(simpleCtrl, simpleItem.toXML());
|
||||
@Test
|
||||
public void verifyBasicItem() throws Exception
|
||||
{
|
||||
Item simpleItem = new Item();
|
||||
String simpleCtrl = "<item />";
|
||||
assertXMLEqual(simpleCtrl, simpleItem.toXML());
|
||||
|
||||
Item idItem = new Item("uniqueid");
|
||||
String idCtrl = "<item id='uniqueid'/>";
|
||||
assertXMLEqual(idCtrl, idItem.toXML());
|
||||
Item idItem = new Item("uniqueid");
|
||||
String idCtrl = "<item id='uniqueid'/>";
|
||||
assertXMLEqual(idCtrl, idItem.toXML());
|
||||
|
||||
Item itemWithNodeId = new Item("testId", "testNode");
|
||||
String nodeIdCtrl = "<item id='testId' node='testNode' />";
|
||||
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML());
|
||||
}
|
||||
Item itemWithNodeId = new Item("testId", "testNode");
|
||||
String nodeIdCtrl = "<item id='testId' node='testNode' />";
|
||||
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyPayloadItem() throws Exception
|
||||
{
|
||||
SimplePayload payload = new SimplePayload(null, null, "<data>This is the payload</data>");
|
||||
@Test
|
||||
public void verifyPayloadItem() throws Exception
|
||||
{
|
||||
SimplePayload payload = new SimplePayload(null, null, "<data>This is the payload</data>");
|
||||
|
||||
PayloadItem<SimplePayload> simpleItem = new PayloadItem<SimplePayload>(payload);
|
||||
String simpleCtrl = "<item>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(simpleCtrl, simpleItem.toXML());
|
||||
PayloadItem<SimplePayload> simpleItem = new PayloadItem<SimplePayload>(payload);
|
||||
String simpleCtrl = "<item>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(simpleCtrl, simpleItem.toXML());
|
||||
|
||||
PayloadItem<SimplePayload> idItem = new PayloadItem<SimplePayload>("uniqueid", payload);
|
||||
String idCtrl = "<item id='uniqueid'>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(idCtrl, idItem.toXML());
|
||||
PayloadItem<SimplePayload> idItem = new PayloadItem<SimplePayload>("uniqueid", payload);
|
||||
String idCtrl = "<item id='uniqueid'>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(idCtrl, idItem.toXML());
|
||||
|
||||
PayloadItem<SimplePayload> itemWithNodeId = new PayloadItem<SimplePayload>("testId", "testNode", payload);
|
||||
String nodeIdCtrl = "<item id='testId' node='testNode'>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML());
|
||||
}
|
||||
PayloadItem<SimplePayload> itemWithNodeId = new PayloadItem<SimplePayload>("testId", "testNode", payload);
|
||||
String nodeIdCtrl = "<item id='testId' node='testNode'>" + payload.toXML() + "</item>";
|
||||
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseBasicItem() throws Exception
|
||||
{
|
||||
@Test
|
||||
public void parseBasicItem() throws Exception
|
||||
{
|
||||
XmlPullParser parser = PacketParserUtils.getParserFor(
|
||||
"<message from='pubsub.myserver.com' to='francisco@denmark.lit' id='foo'>" +
|
||||
"<event xmlns='http://jabber.org/protocol/pubsub#event'>" +
|
||||
|
@ -116,7 +116,7 @@ public class ItemValidationTest extends InitExtensions {
|
|||
ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0);
|
||||
assertTrue(itemExt instanceof Item);
|
||||
assertEquals("testid1", ((Item)itemExt).getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseSimplePayloadItem() throws Exception
|
||||
|
|
|
@ -119,7 +119,7 @@ public class DeliveryReceiptTest extends InitExtensions {
|
|||
c.processStanza(m);
|
||||
|
||||
Stanza reply = c.getSentPacket();
|
||||
DeliveryReceipt r = DeliveryReceipt.from((Message) reply);
|
||||
DeliveryReceipt r = DeliveryReceipt.from((Message) reply);
|
||||
assertThat("romeo@montague.com", equalsCharSequence(reply.getTo()));
|
||||
assertEquals("test-receipt-request", r.getId());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue