james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [10/12] james-project git commit: MPT-44 Solve potential build instability in DiscardProtocolTest
Date Tue, 27 Nov 2018 02:06:37 GMT
MPT-44 Solve potential build instability in DiscardProtocolTest

A buffer might not be flushed on time before the connection is closed...


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4f58df68
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4f58df68
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4f58df68

Branch: refs/heads/master
Commit: 4f58df68f570c55e0a19cf1ccf8cc7df8fb78983
Parents: 16e5de1
Author: Benoit Tellier <btellier@linagora.com>
Authored: Mon Nov 26 13:24:35 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Nov 27 09:02:26 2018 +0700

----------------------------------------------------------------------
 .../test/java/org/apache/james/mpt/DiscardProtocolTest.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/4f58df68/mpt/core/src/test/java/org/apache/james/mpt/DiscardProtocolTest.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/test/java/org/apache/james/mpt/DiscardProtocolTest.java b/mpt/core/src/test/java/org/apache/james/mpt/DiscardProtocolTest.java
index 02463cd..1c4a91a 100644
--- a/mpt/core/src/test/java/org/apache/james/mpt/DiscardProtocolTest.java
+++ b/mpt/core/src/test/java/org/apache/james/mpt/DiscardProtocolTest.java
@@ -68,6 +68,8 @@ class DiscardProtocolTest {
         protocol.start();
         socket = SocketFactory.getDefault().createSocket("127.0.0.1", protocol.getPort().getValue());
         record = protocol.recordNext();
+
+        assertThat(socket.isConnected()).isTrue();
     }
 
     @AfterEach
@@ -77,15 +79,17 @@ class DiscardProtocolTest {
 
     @Test
     void testRecord() throws Exception {
-        assertThat(socket.isConnected()).isTrue();
         input();
+
         String output = record.complete();
+
         assertThat(output).isEqualTo(INPUT);
     }
 
     private void input() throws IOException {
         Writer out = new OutputStreamWriter(socket.getOutputStream());
         out.append(INPUT);
+        out.flush();
         out.close();
         socket.close();
     }
@@ -95,7 +99,9 @@ class DiscardProtocolTest {
         InputLater inputLater = new InputLater();
         Thread thread = new Thread(inputLater);
         thread.start();
+
         String output = record.complete();
+
         assertThat(output).isEqualTo(INPUT);
         inputLater.assertExecutedSuccessfully();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message