Class EventLoopGroupRule

java.lang.Object
org.junit.rules.ExternalResource
com.linecorp.armeria.testing.junit4.common.EventLoopGroupRule
All Implemented Interfaces:
TestRule

public final class EventLoopGroupRule
extends ExternalResource
A TestRule that provides an EventLoopGroup. For example:

 > public class MyTest {
 >     @ClassRule
 >     public static final EventLoopGroupRule eventLoopGroup = new EventLoopGroupRule(4);
 >
 >     @Test
 >     public void test() {
 >         ClientFactory f = ClientFactory.builder()
 >                                        .workerGroup(eventLoopGroup.get())
 >                                        .build();
 >         ...
 >     }
 > }
 
See Also:
EventLoopRule
  • Constructor Details

    • EventLoopGroupRule

      public EventLoopGroupRule​(int numThreads)
      Creates a new TestRule that provides an EventLoopGroup.
      Parameters:
      numThreads - the number of event loop threads
    • EventLoopGroupRule

      public EventLoopGroupRule​(int numThreads, boolean useDaemonThreads)
      Creates a new TestRule that provides an EventLoopGroup.
      Parameters:
      numThreads - the number of event loop threads
      useDaemonThreads - whether to create daemon threads or not
    • EventLoopGroupRule

      public EventLoopGroupRule​(int numThreads, String threadNamePrefix)
      Creates a new TestRule that provides an EventLoopGroup.
      Parameters:
      numThreads - the number of event loop threads
      threadNamePrefix - the prefix of thread names
    • EventLoopGroupRule

      public EventLoopGroupRule​(int numThreads, String threadNamePrefix, boolean useDaemonThreads)
      Creates a new TestRule that provides an EventLoopGroup.
      Parameters:
      numThreads - the number of event loop threads
      threadNamePrefix - the prefix of thread names
      useDaemonThreads - whether to create daemon threads or not
  • Method Details