mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-13 06:21:08 +01:00
Fix minor codestyle issues
This commit is contained in:
parent
200f90ffdc
commit
cb18056613
422 changed files with 1404 additions and 1444 deletions
|
|
@ -61,7 +61,7 @@ public class MamFinProviderTest extends MamTest {
|
|||
+ "</iq>";
|
||||
// @formatter:on
|
||||
|
||||
IQ iq = (IQ) PacketParserUtils.parseStanza(IQ_LIMITED_RESULTS_EXAMPLE);
|
||||
IQ iq = PacketParserUtils.parseStanza(IQ_LIMITED_RESULTS_EXAMPLE);
|
||||
|
||||
MamFinIQ mamFinIQ = (MamFinIQ) iq;
|
||||
Assert.assertEquals(mamFinIQ.getType(), Type.result);
|
||||
|
|
|
|||
|
|
@ -31,18 +31,18 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
|
||||
public class MamPrefIQProviderTest extends MamTest {
|
||||
|
||||
String exampleMamPrefsIQ1 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
||||
private static final String exampleMamPrefsIQ1 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
||||
+ "<always>" + "<jid>romeo@montague.lit</jid>" + "</always>" + "<never>"
|
||||
+ "<jid>montague@montague.lit</jid>" + "</never>" + "</prefs>" + "</iq>";
|
||||
|
||||
String exampleMamPrefsIQ2 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
||||
private static final String exampleMamPrefsIQ2 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
||||
+ "<always>" + "<jid>romeo@montague.lit</jid>" + "<jid>montague@montague.lit</jid>" + "</always>"
|
||||
+ "<never>" + "</never>" + "</prefs>" + "</iq>";
|
||||
|
||||
String exampleMamPrefsIQ3 = "<iq type='get' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1'>" + "</prefs>"
|
||||
private static final String exampleMamPrefsIQ3 = "<iq type='get' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1'>" + "</prefs>"
|
||||
+ "</iq>";
|
||||
|
||||
String exampleMamPrefsResultIQ = "<iq type='result' id='juliet3'>"
|
||||
private static final String exampleMamPrefsResultIQ = "<iq type='result' id='juliet3'>"
|
||||
+ "<prefs xmlns='urn:xmpp:mam:1' default='roster'>" + "<always>" + "<jid>romeo@montague.lit</jid>"
|
||||
+ "</always>" + "<never>" + "<jid>sarasa@montague.lit</jid>" + "<jid>montague@montague.lit</jid>"
|
||||
+ "</never>" + "</prefs>" + "</iq>";
|
||||
|
|
@ -53,14 +53,14 @@ public class MamPrefIQProviderTest extends MamTest {
|
|||
MamPrefsIQ mamPrefIQ1 = new MamPrefsIQProvider().parse(parser1);
|
||||
|
||||
Assert.assertEquals(IQ.Type.set, mamPrefIQ1.getType());
|
||||
Assert.assertEquals(mamPrefIQ1.getAlwaysJids().get(0), "romeo@montague.lit");
|
||||
Assert.assertEquals(mamPrefIQ1.getNeverJids().get(0), "montague@montague.lit");
|
||||
Assert.assertEquals(mamPrefIQ1.getAlwaysJids().get(0).toString(), "romeo@montague.lit");
|
||||
Assert.assertEquals(mamPrefIQ1.getNeverJids().get(0).toString(), "montague@montague.lit");
|
||||
|
||||
XmlPullParser parser2 = PacketParserUtils.getParserFor(exampleMamPrefsIQ2);
|
||||
MamPrefsIQ mamPrefIQ2 = new MamPrefsIQProvider().parse(parser2);
|
||||
Assert.assertEquals(IQ.Type.set, mamPrefIQ2.getType());
|
||||
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(0), "romeo@montague.lit");
|
||||
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(1), "montague@montague.lit");
|
||||
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(0).toString(), "romeo@montague.lit");
|
||||
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(1).toString(), "montague@montague.lit");
|
||||
Assert.assertTrue(mamPrefIQ2.getNeverJids().isEmpty());
|
||||
|
||||
XmlPullParser parser3 = PacketParserUtils.getParserFor(exampleMamPrefsIQ3);
|
||||
|
|
@ -70,7 +70,7 @@ public class MamPrefIQProviderTest extends MamTest {
|
|||
|
||||
@Test
|
||||
public void checkMamPrefResult() throws Exception {
|
||||
IQ iq = (IQ) PacketParserUtils.parseStanza(exampleMamPrefsResultIQ);
|
||||
IQ iq = PacketParserUtils.parseStanza(exampleMamPrefsResultIQ);
|
||||
|
||||
MamPrefsIQ mamPrefsIQ = (MamPrefsIQ) iq;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import org.junit.Test;
|
|||
|
||||
public class MamQueryIQProviderTest {
|
||||
|
||||
String exampleMamQueryIQ1 = "<iq type='set' id='query4'>" + "<query xmlns='urn:xmpp:mam:1' queryid='test'>"
|
||||
private static final String exampleMamQueryIQ1 = "<iq type='set' id='query4'>" + "<query xmlns='urn:xmpp:mam:1' queryid='test'>"
|
||||
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field type='hidden' var='FORM_TYPE'>"
|
||||
+ "<value>urn:xmpp:mam:1</value>" + "</field>"
|
||||
+ "<field type='text-single' var='urn:example:xmpp:free-text-search'>"
|
||||
|
|
@ -41,7 +41,7 @@ public class MamQueryIQProviderTest {
|
|||
+ "<value>{http://jabber.org/protocol/mood}mood/lonely</value>" + "</field>" + "</x>" + "</query>"
|
||||
+ "</iq>";
|
||||
|
||||
String exampleMamQueryIQ2 = "<iq type='result' id='form1'>" + "<query xmlns='urn:xmpp:mam:1'>"
|
||||
private static final String exampleMamQueryIQ2 = "<iq type='result' id='form1'>" + "<query xmlns='urn:xmpp:mam:1'>"
|
||||
+ "<x xmlns='jabber:x:data' type='form'>" + "<field type='hidden' var='FORM_TYPE'>"
|
||||
+ "<value>urn:xmpp:mam:1</value>" + "</field>" + "<field type='jid-single' var='with'/>"
|
||||
+ "<field type='text-single' var='start'/>" + "<field type='text-single' var='end'/>"
|
||||
|
|
@ -51,7 +51,7 @@ public class MamQueryIQProviderTest {
|
|||
@Test
|
||||
public void checkMamQueryIQProvider() throws Exception {
|
||||
// example 1
|
||||
IQ iq1 = (IQ) PacketParserUtils.parseStanza(exampleMamQueryIQ1);
|
||||
IQ iq1 = PacketParserUtils.parseStanza(exampleMamQueryIQ1);
|
||||
MamQueryIQ mamQueryIQ1 = (MamQueryIQ) iq1;
|
||||
|
||||
Assert.assertEquals(mamQueryIQ1.getType(), Type.set);
|
||||
|
|
@ -67,7 +67,7 @@ public class MamQueryIQProviderTest {
|
|||
Assert.assertEquals(fields1.get(2).getValues().get(0), "{http://jabber.org/protocol/mood}mood/lonely");
|
||||
|
||||
// example2
|
||||
IQ iq2 = (IQ) PacketParserUtils.parseStanza(exampleMamQueryIQ2);
|
||||
IQ iq2 = PacketParserUtils.parseStanza(exampleMamQueryIQ2);
|
||||
MamQueryIQ mamQueryIQ2 = (MamQueryIQ) iq2;
|
||||
|
||||
Assert.assertEquals(mamQueryIQ2.getType(), Type.result);
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
|
||||
public class MamResultProviderTest {
|
||||
|
||||
String exampleMamResultXml = "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
||||
private static final String exampleMamResultXml = "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
||||
+ "<forwarded xmlns='urn:xmpp:forward:0'>" + "<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
|
||||
+ "<message xmlns='jabber:client'" + "to='juliet@capulet.lit/balcony'" + "from='romeo@montague.lit/orchard'"
|
||||
+ "type='chat'>"
|
||||
+ "<body>Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.</body>"
|
||||
+ "</message>" + "</forwarded>" + "</result>";
|
||||
|
||||
String exampleResultMessage = "<message id='aeb213' to='juliet@capulet.lit/chamber'>"
|
||||
private static final String exampleResultMessage = "<message id='aeb213' to='juliet@capulet.lit/chamber'>"
|
||||
+ "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
||||
+ "<forwarded xmlns='urn:xmpp:forward:0'>" + "<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
|
||||
+ "<message xmlns='jabber:client' from='witch@shakespeare.lit' to='macbeth@shakespeare.lit'>"
|
||||
|
|
@ -62,15 +62,15 @@ public class MamResultProviderTest {
|
|||
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
|
||||
|
||||
Message message = (Message) forwarded.getForwardedStanza();
|
||||
Assert.assertEquals(message.getFrom(), "romeo@montague.lit/orchard");
|
||||
Assert.assertEquals(message.getTo(), "juliet@capulet.lit/balcony");
|
||||
Assert.assertEquals(message.getFrom().toString(), "romeo@montague.lit/orchard");
|
||||
Assert.assertEquals(message.getTo().toString(), "juliet@capulet.lit/balcony");
|
||||
Assert.assertEquals(message.getBody(),
|
||||
"Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkResultsParse() throws Exception {
|
||||
Message message = (Message) PacketParserUtils.parseStanza(exampleResultMessage);
|
||||
Message message = PacketParserUtils.parseStanza(exampleResultMessage);
|
||||
MamResultExtension mamResultExtension = MamResultExtension.from(message);
|
||||
|
||||
Assert.assertEquals(mamResultExtension.getQueryId(), "f27");
|
||||
|
|
@ -84,8 +84,8 @@ public class MamResultProviderTest {
|
|||
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
|
||||
|
||||
Message forwardedMessage = (Message) forwarded.getForwardedStanza();
|
||||
Assert.assertEquals(forwardedMessage.getFrom(), "witch@shakespeare.lit");
|
||||
Assert.assertEquals(forwardedMessage.getTo(), "macbeth@shakespeare.lit");
|
||||
Assert.assertEquals(forwardedMessage.getFrom().toString(), "witch@shakespeare.lit");
|
||||
Assert.assertEquals(forwardedMessage.getTo().toString(), "macbeth@shakespeare.lit");
|
||||
Assert.assertEquals(forwardedMessage.getBody(), "Hail to thee");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
|
||||
public class PreferencesTest {
|
||||
|
||||
String retrievePrefsStanzaExample = "<iq id='sarasa' type='get'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
||||
private static final String retrievePrefsStanzaExample = "<iq id='sarasa' type='get'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
||||
+ "'/>" + "</iq>";
|
||||
|
||||
String updatePrefsStanzaExample = "<iq id='sarasa' type='set'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
||||
private static final String updatePrefsStanzaExample = "<iq id='sarasa' type='set'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
||||
+ "' default='roster'>" + "<always>" + "<jid>romeo@montague.lit</jid>" + "<jid>other@montague.lit</jid>"
|
||||
+ "</always>" + "<never>" + "<jid>montague@montague.lit</jid>" + "</never>" + "</prefs>" + "</iq>";
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
|
||||
public class QueryArchiveTest extends MamTest {
|
||||
|
||||
String mamSimpleQueryIQ = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
||||
private static final String mamSimpleQueryIQ = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
||||
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field var='FORM_TYPE' type='hidden'>" + "<value>"
|
||||
+ MamElements.NAMESPACE + "</value>" + "</field>" + "</x>" + "</query>" + "</iq>";
|
||||
|
||||
String mamQueryResultExample = "<message to='hag66@shakespeare.lit/pda' from='coven@chat.shakespeare.lit' id='iasd207'>"
|
||||
private static final String mamQueryResultExample = "<message to='hag66@shakespeare.lit/pda' from='coven@chat.shakespeare.lit' id='iasd207'>"
|
||||
+ "<result xmlns='urn:xmpp:mam:1' queryid='g27' id='34482-21985-73620'>"
|
||||
+ "<forwarded xmlns='urn:xmpp:forward:0'>"
|
||||
+ "<delay xmlns='urn:xmpp:delay' stamp='2002-10-13T23:58:37.000+00:00'></delay>" + "<message "
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import org.junit.Test;
|
|||
|
||||
public class ResultsLimitTest extends MamTest {
|
||||
|
||||
String resultsLimitStanza = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
||||
private static final String resultsLimitStanza = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
||||
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field var='FORM_TYPE' type='hidden'>" + "<value>"
|
||||
+ MamElements.NAMESPACE + "</value>" + "</field>" + "</x>" + "<set xmlns='http://jabber.org/protocol/rsm'>"
|
||||
+ "<max>10</max>" + "</set>" + "</query>" + "</iq>";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue