mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
SMACK-349 Couple of fixes to test cases based on changes in base64 encoding buffer sizes.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_2_0@12957 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
62ce8e85dd
commit
a92d37a32b
6 changed files with 76 additions and 58 deletions
|
@ -27,7 +27,7 @@
|
|||
<!-- Smack Version -->
|
||||
<property name="version.major" value="3" />
|
||||
<property name="version.minor" value="2" />
|
||||
<property name="version.revision" value="1" />
|
||||
<property name="version.revision" value="2" />
|
||||
<property name="version.extra" value="" />
|
||||
|
||||
<if>
|
||||
|
|
|
@ -141,6 +141,29 @@ hr {
|
|||
|
||||
<div id="pageBody">
|
||||
|
||||
<h2>3.2.2 -- <span style="font-weight: normal;">Dec. 23, 2011</span></h2>
|
||||
|
||||
<h3>Bug</h3>
|
||||
<ul>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-263'>SMACK-263</a>] - Set file info in all send* methods</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-322'>SMACK-322</a>] - NPE in XMPPConnection</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-324'>SMACK-324</a>] - Investigate SASL issue with jabberd2 servers</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-338'>SMACK-338</a>] - IBB filetransfer doesn't work as expected</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-346'>SMACK-346</a>] - Bug in return code for rejection handling in FileTransferManager</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-348'>SMACK-348</a>] - Documentation error - broken link</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-349'>SMACK-349</a>] - Smack's IBB sends too much data in a packet</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-350'>SMACK-350</a>] - Bytestream is not working in Spark 2.6.3 from XP to W7</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-353'>SMACK-353</a>] - Thread leak in the FaultTolerantNegotiator</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-362'>SMACK-362</a>] - smack throw NoSuchElementException if the muc#roominfo_subject has no values</li>
|
||||
</ul>
|
||||
|
||||
<h3>Improvement</h3>
|
||||
<ul>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-343'>SMACK-343</a>] - Make Smack jar an OSGi bundle.</li>
|
||||
<li>[<a href='http://issues.igniterealtime.org/browse/SMACK-354'>SMACK-354</a>] - Provide milliseconds in timestamp colum debugwindow</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>3.2.1 -- <span style="font-weight: normal;">July 4, 2011</span></h2>
|
||||
<h3>Bug</h3>
|
||||
<ul>
|
||||
|
|
|
@ -44,14 +44,14 @@ import java.util.*;
|
|||
*/
|
||||
public final class SmackConfiguration {
|
||||
|
||||
private static final String SMACK_VERSION = "3.2.1";
|
||||
private static final String SMACK_VERSION = "3.2.2";
|
||||
|
||||
private static int packetReplyTimeout = 5000;
|
||||
private static int keepAliveInterval = 30000;
|
||||
private static Vector<String> defaultMechs = new Vector<String>();
|
||||
|
||||
private static boolean localSocks5ProxyEnabled = true;
|
||||
private static int localSocks5ProxyPort = 7778;
|
||||
private static int localSocks5ProxyPort = 7777;
|
||||
private static int packetCollectorSize = 5000;
|
||||
|
||||
private SmackConfiguration() {
|
||||
|
|
|
@ -40,6 +40,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
String sessionID = "session_id";
|
||||
|
||||
int blockSize = 10;
|
||||
int dataSize = blockSize/4 * 3;
|
||||
|
||||
// protocol verifier
|
||||
Protocol protocol;
|
||||
|
@ -102,7 +103,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
protocol.addResponse(null, incrementingSequence);
|
||||
protocol.addResponse(null, incrementingSequence);
|
||||
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
OutputStream outputStream = session.getOutputStream();
|
||||
outputStream.write(controlData);
|
||||
|
@ -127,7 +128,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
protocol.addResponse(null, incrementingSequence);
|
||||
protocol.addResponse(null, incrementingSequence);
|
||||
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
OutputStream outputStream = session.getOutputStream();
|
||||
for (byte b : controlData) {
|
||||
|
@ -154,11 +155,11 @@ public class InBandBytestreamSessionMessageTest {
|
|||
protocol.addResponse(null, incrementingSequence);
|
||||
protocol.addResponse(null, incrementingSequence);
|
||||
|
||||
byte[] controlData = new byte[(blockSize * 3) - 2];
|
||||
byte[] controlData = new byte[(dataSize * 3) - 2];
|
||||
|
||||
OutputStream outputStream = session.getOutputStream();
|
||||
int off = 0;
|
||||
for (int i = 1; i <= 7; i++) {
|
||||
for (int i = 1; off+i <= controlData.length; i++) {
|
||||
outputStream.write(controlData, off, i);
|
||||
off += i;
|
||||
}
|
||||
|
@ -175,7 +176,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
*/
|
||||
@Test
|
||||
public void shouldSendThirtyDataPackets() throws Exception {
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
|
@ -202,7 +203,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
*/
|
||||
@Test
|
||||
public void shouldSendNothingOnSuccessiveCallsToFlush() throws Exception {
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
|
@ -273,7 +274,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
public void shouldReadAllReceivedData1() throws Exception {
|
||||
// create random data
|
||||
Random rand = new Random();
|
||||
byte[] controlData = new byte[3 * blockSize];
|
||||
byte[] controlData = new byte[3 * dataSize];
|
||||
rand.nextBytes(controlData);
|
||||
|
||||
// get IBB sessions data packet listener
|
||||
|
@ -283,8 +284,8 @@ public class InBandBytestreamSessionMessageTest {
|
|||
PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);
|
||||
|
||||
// verify data packet and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * blockSize, blockSize,
|
||||
for (int i = 0; i < controlData.length / dataSize; i++) {
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * dataSize, dataSize,
|
||||
false);
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Message dataMessage = new Message();
|
||||
|
@ -292,14 +293,14 @@ public class InBandBytestreamSessionMessageTest {
|
|||
listener.processPacket(dataMessage);
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[3 * blockSize];
|
||||
byte[] bytes = new byte[3 * dataSize];
|
||||
int read = 0;
|
||||
read = inputStream.read(bytes, 0, blockSize);
|
||||
assertEquals(blockSize, read);
|
||||
read = inputStream.read(bytes, 10, blockSize);
|
||||
assertEquals(blockSize, read);
|
||||
read = inputStream.read(bytes, 20, blockSize);
|
||||
assertEquals(blockSize, read);
|
||||
read = inputStream.read(bytes, 0, dataSize);
|
||||
assertEquals(dataSize, read);
|
||||
read = inputStream.read(bytes, dataSize, dataSize);
|
||||
assertEquals(dataSize, read);
|
||||
read = inputStream.read(bytes, dataSize*2, dataSize);
|
||||
assertEquals(dataSize, read);
|
||||
|
||||
// verify data
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
|
@ -319,7 +320,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
public void shouldReadAllReceivedData2() throws Exception {
|
||||
// create random data
|
||||
Random rand = new Random();
|
||||
byte[] controlData = new byte[3 * blockSize];
|
||||
byte[] controlData = new byte[3 * dataSize];
|
||||
rand.nextBytes(controlData);
|
||||
|
||||
// get IBB sessions data packet listener
|
||||
|
@ -329,8 +330,8 @@ public class InBandBytestreamSessionMessageTest {
|
|||
PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);
|
||||
|
||||
// verify data packet and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * blockSize, blockSize,
|
||||
for (int i = 0; i < controlData.length / dataSize; i++) {
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * dataSize, dataSize,
|
||||
false);
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Message dataMessage = new Message();
|
||||
|
@ -339,7 +340,7 @@ public class InBandBytestreamSessionMessageTest {
|
|||
}
|
||||
|
||||
// read data
|
||||
byte[] bytes = new byte[3 * blockSize];
|
||||
byte[] bytes = new byte[3 * dataSize];
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
bytes[i] = (byte) inputStream.read();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ public class InBandBytestreamSessionTest {
|
|||
String xmppServer = "xmpp-server";
|
||||
String sessionID = "session_id";
|
||||
|
||||
int blockSize = 10;
|
||||
int blockSize = 20;
|
||||
int dataSize = blockSize/4 * 3;
|
||||
|
||||
// protocol verifier
|
||||
Protocol protocol;
|
||||
|
@ -102,7 +103,7 @@ public class InBandBytestreamSessionTest {
|
|||
protocol.addResponse(resultIQ, incrementingSequence);
|
||||
protocol.addResponse(resultIQ, incrementingSequence);
|
||||
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
OutputStream outputStream = session.getOutputStream();
|
||||
outputStream.write(controlData);
|
||||
|
@ -128,7 +129,7 @@ public class InBandBytestreamSessionTest {
|
|||
protocol.addResponse(resultIQ, incrementingSequence);
|
||||
protocol.addResponse(resultIQ, incrementingSequence);
|
||||
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
OutputStream outputStream = session.getOutputStream();
|
||||
for (byte b : controlData) {
|
||||
|
@ -156,11 +157,11 @@ public class InBandBytestreamSessionTest {
|
|||
protocol.addResponse(resultIQ, incrementingSequence);
|
||||
protocol.addResponse(resultIQ, incrementingSequence);
|
||||
|
||||
byte[] controlData = new byte[(blockSize * 3) - 2];
|
||||
byte[] controlData = new byte[(dataSize * 3) - 2];
|
||||
|
||||
OutputStream outputStream = session.getOutputStream();
|
||||
int off = 0;
|
||||
for (int i = 1; i <= 7; i++) {
|
||||
for (int i = 1; i+off <= controlData.length; i++) {
|
||||
outputStream.write(controlData, off, i);
|
||||
off += i;
|
||||
}
|
||||
|
@ -177,7 +178,7 @@ public class InBandBytestreamSessionTest {
|
|||
*/
|
||||
@Test
|
||||
public void shouldSendThirtyDataPackets() throws Exception {
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
|
@ -205,7 +206,7 @@ public class InBandBytestreamSessionTest {
|
|||
*/
|
||||
@Test
|
||||
public void shouldSendNothingOnSuccessiveCallsToFlush() throws Exception {
|
||||
byte[] controlData = new byte[blockSize * 3];
|
||||
byte[] controlData = new byte[dataSize * 3];
|
||||
|
||||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
|
@ -236,7 +237,7 @@ public class InBandBytestreamSessionTest {
|
|||
public void shouldSendDataCorrectly() throws Exception {
|
||||
// create random data
|
||||
Random rand = new Random();
|
||||
final byte[] controlData = new byte[256 * blockSize];
|
||||
final byte[] controlData = new byte[256 * dataSize];
|
||||
rand.nextBytes(controlData);
|
||||
|
||||
// compares the data of each packet with the control data
|
||||
|
@ -246,7 +247,7 @@ public class InBandBytestreamSessionTest {
|
|||
byte[] decodedData = request.getDataPacketExtension().getDecodedData();
|
||||
int seq = (int) request.getDataPacketExtension().getSeq();
|
||||
for (int i = 0; i < decodedData.length; i++) {
|
||||
assertEquals(controlData[(seq * blockSize) + i], decodedData[i]);
|
||||
assertEquals(controlData[(seq * dataSize) + i], decodedData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +255,7 @@ public class InBandBytestreamSessionTest {
|
|||
|
||||
// set acknowledgments for the data packets
|
||||
IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
for (int i = 0; i < controlData.length / dataSize; i++) {
|
||||
protocol.addResponse(resultIQ, incrementingSequence, dataVerification);
|
||||
}
|
||||
|
||||
|
@ -462,7 +463,7 @@ public class InBandBytestreamSessionTest {
|
|||
public void shouldReadAllReceivedData1() throws Exception {
|
||||
// create random data
|
||||
Random rand = new Random();
|
||||
byte[] controlData = new byte[3 * blockSize];
|
||||
byte[] controlData = new byte[3 * dataSize];
|
||||
rand.nextBytes(controlData);
|
||||
|
||||
IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);
|
||||
|
@ -473,24 +474,24 @@ public class InBandBytestreamSessionTest {
|
|||
InputStream inputStream = session.getInputStream();
|
||||
PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);
|
||||
|
||||
// set data packet acknowledgment and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
// set data packet acknowledgement and notify listener
|
||||
for (int i = 0; i < controlData.length / dataSize; i++) {
|
||||
protocol.addResponse(resultIQ);
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * blockSize, blockSize,
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * dataSize, dataSize,
|
||||
false);
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
listener.processPacket(data);
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[3 * blockSize];
|
||||
byte[] bytes = new byte[3 * dataSize];
|
||||
int read = 0;
|
||||
read = inputStream.read(bytes, 0, blockSize);
|
||||
assertEquals(blockSize, read);
|
||||
read = inputStream.read(bytes, 10, blockSize);
|
||||
assertEquals(blockSize, read);
|
||||
read = inputStream.read(bytes, 20, blockSize);
|
||||
assertEquals(blockSize, read);
|
||||
read = inputStream.read(bytes, 0, dataSize);
|
||||
assertEquals(dataSize, read);
|
||||
read = inputStream.read(bytes, dataSize, dataSize);
|
||||
assertEquals(dataSize, read);
|
||||
read = inputStream.read(bytes, dataSize*2, dataSize);
|
||||
assertEquals(dataSize, read);
|
||||
|
||||
// verify data
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
|
@ -510,7 +511,7 @@ public class InBandBytestreamSessionTest {
|
|||
public void shouldReadAllReceivedData2() throws Exception {
|
||||
// create random data
|
||||
Random rand = new Random();
|
||||
byte[] controlData = new byte[3 * blockSize];
|
||||
byte[] controlData = new byte[3 * dataSize];
|
||||
rand.nextBytes(controlData);
|
||||
|
||||
IQ resultIQ = IBBPacketUtils.createResultIQ(initiatorJID, targetJID);
|
||||
|
@ -522,9 +523,9 @@ public class InBandBytestreamSessionTest {
|
|||
PacketListener listener = Whitebox.getInternalState(inputStream, PacketListener.class);
|
||||
|
||||
// set data packet acknowledgment and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
for (int i = 0; i < controlData.length / dataSize; i++) {
|
||||
protocol.addResponse(resultIQ);
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * blockSize, blockSize,
|
||||
String base64Data = StringUtils.encodeBase64(controlData, i * dataSize, dataSize,
|
||||
false);
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, i, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
|
@ -532,7 +533,7 @@ public class InBandBytestreamSessionTest {
|
|||
}
|
||||
|
||||
// read data
|
||||
byte[] bytes = new byte[3 * blockSize];
|
||||
byte[] bytes = new byte[3 * dataSize];
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
bytes[i] = (byte) inputStream.read();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ConfigureFormTest
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test (expected=XMPPException.class)
|
||||
public void getConfigFormWithTimeout() throws XMPPException
|
||||
{
|
||||
ThreadedDummyConnection con = new ThreadedDummyConnection();
|
||||
|
@ -66,14 +66,7 @@ public class ConfigureFormTest
|
|||
|
||||
Node node = mgr.getNode("princely_musings");
|
||||
|
||||
// try
|
||||
// {
|
||||
SmackConfiguration.setPacketReplyTimeout(100);
|
||||
node.getNodeConfiguration();
|
||||
// }
|
||||
// catch (XMPPException e)
|
||||
// {
|
||||
// Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
|
||||
// }
|
||||
SmackConfiguration.setPacketReplyTimeout(100);
|
||||
node.getNodeConfiguration();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue