1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Merge branch '4.2' into master-paul-merged

This commit is contained in:
Florian Schmaus 2017-12-17 11:16:02 +01:00
commit 431e5b3c67
434 changed files with 1770 additions and 1517 deletions

View file

@ -105,7 +105,7 @@ public class StanzaCollectorTest
@Override
public void run()
{
Stanza p = null;
Stanza p;
do
{
@ -134,7 +134,7 @@ public class StanzaCollectorTest
@Override
public void run()
{
Stanza p = null;
Stanza p;
do
{

View file

@ -37,8 +37,8 @@ import org.jivesoftware.smack.packet.Stanza;
public class ThreadedDummyConnection extends DummyConnection {
private static final Logger LOGGER = Logger.getLogger(ThreadedDummyConnection.class.getName());
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
private BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<Stanza>(5);
private final BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<>(1);
private final BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<>(5);
private volatile boolean timeout = false;
@Override

View file

@ -142,7 +142,7 @@ public class MessageTest {
XmlUnitUtils.assertSimilar(control, message.toXML());
Collection<String> languages = message.getBodyLanguages();
List<String> controlLanguages = new ArrayList<String>();
List<String> controlLanguages = new ArrayList<>();
controlLanguages.add(lang2);
controlLanguages.add(lang3);
controlLanguages.removeAll(languages);

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smack.parsing;
import static org.jivesoftware.smack.test.util.CharsequenceEquals.equalsCharSequence;
import static org.jivesoftware.smack.test.util.CharSequenceEquals.equalsCharSequence;
import static org.junit.Assert.assertThat;
import org.jivesoftware.smack.SmackException;

View file

@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.Map;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.util.StringUtils;
import org.jxmpp.jid.EntityBareJid;
@ -40,7 +39,7 @@ public class DigestMd5SaslTest extends AbstractSaslTest {
super(saslMechanism);
}
protected void runTest(boolean useAuthzid) throws NotConnectedException, SmackException, InterruptedException, XmppStringprepException, UnsupportedEncodingException {
protected void runTest(boolean useAuthzid) throws SmackException, InterruptedException, XmppStringprepException, UnsupportedEncodingException {
EntityBareJid authzid = null;
if (useAuthzid) {
authzid = JidCreate.entityBareFrom("shazbat@xmpp.org");

View file

@ -0,0 +1,47 @@
/**
*
* Copyright © 2014 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.test.util;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class CharSequenceEquals extends TypeSafeMatcher<CharSequence> {
private final String charSequenceString;
public CharSequenceEquals(CharSequence charSequence) {
charSequenceString = charSequence.toString();
}
@Override
public void describeTo(Description description) {
description.appendText("Does not match CharSequence ").appendValue(charSequenceString);
}
@Override
protected boolean matchesSafely(CharSequence item) {
String itemString = item.toString();
return charSequenceString.equals(itemString);
}
@Factory
public static Matcher<CharSequence> equalsCharSequence(CharSequence charSequence) {
return new CharSequenceEquals(charSequence);
}
}

View file

@ -0,0 +1,46 @@
/**
*
* Copyright 2017 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class IpAddressUtilTest {
@Test
public void isIpV4AddressTest() {
String ipv4 = "122.20.221.11";
boolean isIpV4 = IpAddressUtil.isIPv4LiteralAddress(ipv4);
assertTrue(isIpV4);
}
@Test
public void isInvalidIpV4AddressTest() {
String ipv4 = "122.20.221.11.1";
boolean isIpV4 = IpAddressUtil.isIPv4LiteralAddress(ipv4);
assertFalse(isIpV4);
}
@Test
public void isInvalidIpV4AddressTest2() {
String ipv4 = "122.20.256.11";
boolean isIpV4 = IpAddressUtil.isIPv4LiteralAddress(ipv4);
assertFalse(isIpV4);
}
}

View file

@ -809,7 +809,7 @@ public class PacketParserUtilsTest {
IOException, TransformerException, SAXException {
// @formatter:off
final String stanza = XMLBuilder.create("outer", "outerNamespace").a("outerAttribute", "outerValue")
.element("inner", "innerNamespace").a("innverAttribute", "innerValue")
.element("inner", "innerNamespace").a("innerAttribute", "innerValue")
.element("innermost")
.t("some text")
.asString();