Ejemplo n.º 1
0
 private static Object[] genParamsHostNPlay() {
   final MBassador<Event> eventBus = EventBusFactory.create();
   final int port = PORT_POOL.getAvailablePort();
   final TestServerApplication server =
       ServerFactory.createTestServer(
           eventBus,
           GameServerType.HOST_AND_PLAY,
           ClassicGameRules.DEFAULT_PLAYER_LIMIT,
           FAKE_EXTERNAL_SERVER_ADDRESS,
           port);
   final TestClient client = new TestClient(new KryonetClient());
   return new Object[] {
     eventBus, server, client, new DefaultServerConfiguration("localhost", port)
   };
 }
Ejemplo n.º 2
0
public class Providers {
  private static final String FAKE_EXTERNAL_SERVER_ADDRESS = "0.0.0.0";
  private static final InternalAddressResolver INTERNAL_ADDRESS_RESOLVER =
      new DefaultInternalAddressResolver();
  private static final NetworkPortPool PORT_POOL = NetworkPortPool.getInstance();

  @DataProvider(name = "environmentProvider", parallel = true)
  public static Object[][] environmentProvider() {
    // @formatter:off
    return new Object[][] {genParamsDedicated(), genParamsHostNPlay()};
    // @formatter:on
  }

  private static Object[] genParamsDedicated() {
    final MBassador<Event> eventBus = EventBusFactory.create();
    final int port = PORT_POOL.getAvailablePort();
    final TestServerApplication server =
        ServerFactory.createTestServer(
            eventBus,
            GameServerType.DEDICATED,
            ClassicGameRules.DEFAULT_PLAYER_LIMIT,
            FAKE_EXTERNAL_SERVER_ADDRESS,
            port);
    final TestClient client = new TestClient(new KryonetClient());
    return new Object[] {
      eventBus,
      server,
      client,
      new DefaultServerConfiguration(INTERNAL_ADDRESS_RESOLVER.resolveIp(), port)
    };
  }

  private static Object[] genParamsHostNPlay() {
    final MBassador<Event> eventBus = EventBusFactory.create();
    final int port = PORT_POOL.getAvailablePort();
    final TestServerApplication server =
        ServerFactory.createTestServer(
            eventBus,
            GameServerType.HOST_AND_PLAY,
            ClassicGameRules.DEFAULT_PLAYER_LIMIT,
            FAKE_EXTERNAL_SERVER_ADDRESS,
            port);
    final TestClient client = new TestClient(new KryonetClient());
    return new Object[] {
      eventBus, server, client, new DefaultServerConfiguration("localhost", port)
    };
  }
}
Ejemplo n.º 3
0
 private static Object[] genParamsDedicated() {
   final MBassador<Event> eventBus = EventBusFactory.create();
   final int port = PORT_POOL.getAvailablePort();
   final TestServerApplication server =
       ServerFactory.createTestServer(
           eventBus,
           GameServerType.DEDICATED,
           ClassicGameRules.DEFAULT_PLAYER_LIMIT,
           FAKE_EXTERNAL_SERVER_ADDRESS,
           port);
   final TestClient client = new TestClient(new KryonetClient());
   return new Object[] {
     eventBus,
     server,
     client,
     new DefaultServerConfiguration(INTERNAL_ADDRESS_RESOLVER.resolveIp(), port)
   };
 }