Search in sources :

Example 1 with ServerTestingUtil

use of org.infinispan.server.core.test.ServerTestingUtil in project infinispan by infinispan.

the class HotRodConcurrentStartTest method testConcurrentStartup.

public void testConcurrentStartup(Method m) throws Exception {
    int initialPort = serverPort();
    List<HotRodServer> servers = new ArrayList<>();
    try {
        List<Future<HotRodServer>> futures = new ArrayList<>();
        for (int i = 0; i < NUMBER_OF_SERVERS; i++) {
            int finalI = i;
            futures.add(fork(() -> {
                HotRodServer server = startHotRodServer(getCacheManagers().get(finalI), initialPort + (finalI * 10));
                servers.add(server);
                return server;
            }));
        }
        for (Future<HotRodServer> hotRodServerFuture : futures) {
            hotRodServerFuture.get(30, TimeUnit.SECONDS);
        }
        try (HotRodClient client = new HotRodClient(servers.get(0).getHost(), servers.get(0).getPort(), CACHE_NAME, HotRodConstants.VERSION_30)) {
            client.assertPut(m);
        }
    } finally {
        servers.forEach(ServerTestingUtil::killServer);
    }
}
Also used : ServerTestingUtil(org.infinispan.server.core.test.ServerTestingUtil) HotRodTestingUtil.startHotRodServer(org.infinispan.server.hotrod.test.HotRodTestingUtil.startHotRodServer) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) HotRodClient(org.infinispan.server.hotrod.test.HotRodClient)

Aggregations

ArrayList (java.util.ArrayList)1 Future (java.util.concurrent.Future)1 ServerTestingUtil (org.infinispan.server.core.test.ServerTestingUtil)1 HotRodClient (org.infinispan.server.hotrod.test.HotRodClient)1 HotRodTestingUtil.startHotRodServer (org.infinispan.server.hotrod.test.HotRodTestingUtil.startHotRodServer)1