You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/08 03:12:06 UTC

[james-project] 19/36: PROTOCOLS-37 [Refactoring] Remove AbstractProtocolTransportTest tests for FutureResponse support

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit eea2836c82ebb70a3962ab8a6a05b30c16fa6f69
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Nov 7 09:01:02 2019 +0700

    PROTOCOLS-37 [Refactoring] Remove AbstractProtocolTransportTest tests for FutureResponse support
---
 .../api/AbstractProtocolTransportTest.java         | 74 ----------------------
 1 file changed, 74 deletions(-)

diff --git a/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java b/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java
index 41d6763..904175d 100644
--- a/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java
+++ b/protocols/api/src/test/java/org/apache/james/protocols/api/AbstractProtocolTransportTest.java
@@ -26,13 +26,11 @@ import java.io.UnsupportedEncodingException;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.stream.IntStream;
 
-import org.apache.james.protocols.api.future.FutureResponseImpl;
 import org.apache.james.protocols.api.handler.LineHandler;
 import org.junit.Test;
 
@@ -55,78 +53,6 @@ public class AbstractProtocolTransportTest {
         checkWrittenResponses(messages);
     }
     
-    @Test
-    public void testWriteOrderFutureResponseAllReady() throws InterruptedException, UnsupportedEncodingException {
-        final List<Response> messages = new ArrayList<>();
-        for (int i = 0; i < 2000; i++) {
-                FutureResponseImpl r = new FutureResponseImpl();
-                r.setResponse(new TestResponse());
-                messages.add(r);
-        }
-        checkWrittenResponses(messages);
-    }
-        
-       
-    @Test
-    public void testWriteOrderFutureResponse() throws InterruptedException, UnsupportedEncodingException {
-        final List<Response> messages = IntStream.range(0, 2000)
-            .mapToObj(i -> new FutureResponseImpl())
-            .collect(Guavate.toImmutableList());
-
-        notifyFutureResponses(messages, false);
-        
-        checkWrittenResponses(messages);
-    }
-
-    @Test
-    public void testWriteOrderFutureResponseReverseNotify() throws InterruptedException, UnsupportedEncodingException {
-        final List<Response> messages = IntStream.range(0, 2000)
-            .mapToObj(i -> new FutureResponseImpl())
-            .collect(Guavate.toImmutableList());
-
-        notifyFutureResponses(messages, true);
-
-        checkWrittenResponses(messages);
-    }
-    
-    @Test
-    public void testWriteOrderMixedResponse() throws InterruptedException, UnsupportedEncodingException {
-        final List<Response> messages = new ArrayList<>();
-        for (int i = 0; i < 2000; i++) {
-            if (i % 2 == 0) {
-                messages.add(new TestResponse());
-            } else {
-                messages.add(new FutureResponseImpl());
-            }
-
-        }
-        notifyFutureResponses(messages, false);
-        
-        checkWrittenResponses(messages);
-    }
-    
-    private void notifyFutureResponses(final List<Response> messages, final boolean reverse) {
-        new Thread(() -> {
-            try {
-                Thread.sleep(200);
-                List<Response> responses = new ArrayList<>(messages);
-                if (reverse) {
-                    Collections.reverse(responses);
-                }
-
-                for (Response r : responses) {
-                    if (r instanceof FutureResponseImpl) {
-                        ((FutureResponseImpl) r).setResponse(new TestResponse());
-                    }
-                }
-
-            } catch (InterruptedException e) {
-                throw new RuntimeException();
-            }
-
-        }).start();
-    }
-    
     private void checkWrittenResponses(List<Response> messages) throws InterruptedException, UnsupportedEncodingException {
         final List<byte[]> writtenMessages = new ArrayList<>();
 


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