Search in sources :

Example 1 with TestServer

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

the class InfinispanXSiteServerExtensionBuilder method build.

public InfinispanXSiteServerExtension build() {
    Set<String> uniqueSiteName = new HashSet<>();
    List<TestServer> testServers = sites.stream().map(it -> new TestServer(it.createServerTestConfiguration())).peek(testServer -> {
        if (!uniqueSiteName.add(testServer.getSiteName())) {
            throw new IllegalStateException("Site name already set: " + testServer.getSiteName());
        }
    }).collect(Collectors.toList());
    return new InfinispanXSiteServerExtension(testServers);
}
Also used : HashSet(java.util.HashSet) List(java.util.List) Set(java.util.Set) Collectors(java.util.stream.Collectors) TestServer(org.infinispan.server.test.core.TestServer) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) TestServer(org.infinispan.server.test.core.TestServer)

Example 2 with TestServer

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

the class XSiteCliOperations method hostAndPort.

private String hostAndPort(String site) {
    for (TestServer server : SERVERS.getTestServers()) {
        if (site.equals(server.getSiteName())) {
            String host = server.getDriver().getServerAddress(0).getHostAddress();
            int port = server.getDriver().getServerSocket(0, 11222).getPort();
            return host + ":" + port;
        }
    }
    throw new IllegalStateException("Site " + site + " not found.");
}
Also used : TestServer(org.infinispan.server.test.core.TestServer)

Aggregations

TestServer (org.infinispan.server.test.core.TestServer)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1