This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a commit to branch feature/GEODE-2113e
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-2113e by this
push:
new 68aa702 fixed problems with a couple of the NIO/SSL unit tests
68aa702 is described below
commit 68aa702bb675b35c6e8af92e94c9407961a453d7
Author: Bruce Schuchardt <[email protected]>
AuthorDate: Tue Jan 29 08:48:56 2019 -0800
fixed problems with a couple of the NIO/SSL unit tests
---
.../src/test/java/org/apache/geode/internal/net/BuffersTest.java | 3 +++
.../test/java/org/apache/geode/internal/net/NioSslEngineTest.java | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/net/BuffersTest.java
b/geode-core/src/test/java/org/apache/geode/internal/net/BuffersTest.java
index 3e736a0..96a4ac6 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/net/BuffersTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/net/BuffersTest.java
@@ -48,6 +48,7 @@ public class BuffersTest {
}
private void createAndVerifyNewWriteBuffer(ByteBuffer buffer, boolean
useDirectBuffer) {
+ buffer.position(buffer.capacity());
ByteBuffer newBuffer =
Buffers.expandWriteBufferIfNeeded(Buffers.BufferType.UNTRACKED,
buffer, 500,
mock(DMStats.class));
@@ -62,6 +63,8 @@ public class BuffersTest {
}
private void createAndVerifyNewReadBuffer(ByteBuffer buffer, boolean
useDirectBuffer) {
+ buffer.position(0);
+ buffer.limit(256);
ByteBuffer newBuffer =
Buffers.expandReadBufferIfNeeded(Buffers.BufferType.UNTRACKED, buffer,
500,
mock(DMStats.class));
diff --git
a/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
b/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
index f10c45d..68d7936 100644
---
a/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
+++
b/geode-core/src/test/java/org/apache/geode/internal/net/NioSslEngineTest.java
@@ -414,6 +414,12 @@ public class NioSslEngineTest {
}
+ /**
+ * This tests the case where a message header has been read and part of a
message has been
+ * read, but the decoded buffer is too small to hold all of the message. In
this case
+ * the readAtLeast method will have to expand the capacity of the decoded
buffer and return
+ * the new, expanded, buffer as the method result.
+ */
@Test
public void readAtLeastUsingSmallAppBuffer() throws Exception {
final int amountToRead = 150;
@@ -424,7 +430,7 @@ public class NioSslEngineTest {
// force buffer expansion by making a small decoded buffer appear near to
being full
ByteBuffer unwrappedBuffer = ByteBuffer.allocate(100);
- unwrappedBuffer.position(preexistingBytes);
+ unwrappedBuffer.position(7).limit(preexistingBytes + 7); // 7 bytes of
message header - ignored
nioSslEngine.peerAppData = unwrappedBuffer;
// simulate some socket reads