Search in sources :

Example 1 with ContainerInfinispanServerDriver

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

the class GracefulShutdownRestartIT method testGracefulShutdownRestart.

@Test
public void testGracefulShutdownRestart() {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.clustering().cacheMode(CacheMode.DIST_SYNC).persistence().addSingleFileStore().segmented(false);
    RemoteCache<Object, Object> hotRod = SERVER_TEST.hotrod().withServerConfiguration(builder).create();
    for (int i = 0; i < 100; i++) {
        hotRod.put(String.format("k%03d", i), String.format("v%03d", i));
    }
    RestClientConfigurationBuilder restClientBuilder = new RestClientConfigurationBuilder().socketTimeout(RestClientConfigurationProperties.DEFAULT_SO_TIMEOUT * 60).connectionTimeout(RestClientConfigurationProperties.DEFAULT_CONNECT_TIMEOUT * 60);
    RestClient rest = SERVER_TEST.rest().withClientConfiguration(restClientBuilder).get();
    sync(rest.cluster().stop(), 5, TimeUnit.MINUTES);
    ContainerInfinispanServerDriver serverDriver = (ContainerInfinispanServerDriver) SERVER.getServerDriver();
    Eventually.eventually("Cluster did not shutdown within timeout", () -> (!serverDriver.isRunning(0) && !serverDriver.isRunning(1)), serverDriver.getTimeout(), 1, TimeUnit.SECONDS);
    serverDriver.restartCluster();
    for (int i = 0; i < 100; i++) {
        assertEquals(String.format("v%03d", i), hotRod.get(String.format("k%03d", i)));
    }
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) RestClient(org.infinispan.client.rest.RestClient) ContainerInfinispanServerDriver(org.infinispan.server.test.core.ContainerInfinispanServerDriver) Test(org.junit.Test)

Example 2 with ContainerInfinispanServerDriver

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

the class StatefulSetRollingUpgradeIT method testStatefulSetRollingUpgrade.

@Test
public void testStatefulSetRollingUpgrade() {
    IntStream.range(0, numServers).forEach(this::assertLiveness);
    ContainerInfinispanServerDriver serverDriver = (ContainerInfinispanServerDriver) serverRule.getServerDriver();
    for (int i = 0; i < NUM_ROLLING_UPGRADES; i++) {
        for (int j = numServers - 1; j > -1; j--) {
            serverDriver.stop(j);
            serverDriver.restart(j);
            assertLiveness(j);
        }
    }
}
Also used : ContainerInfinispanServerDriver(org.infinispan.server.test.core.ContainerInfinispanServerDriver) Test(org.junit.Test)

Example 3 with ContainerInfinispanServerDriver

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

the class RestServerResource method testConfig.

@Test
public void testConfig() {
    RestClient client = SERVER_TEST.rest().create();
    RestResponse restResponse = sync(client.server().configuration());
    assertEquals(200, restResponse.getStatus());
    Json configNode = Json.read(restResponse.getBody());
    Json server = configNode.at("server");
    Json interfaces = server.at("interfaces");
    Json security = server.at("security");
    Json endpoints = server.at("endpoints");
    Json endpoint = endpoints.at("endpoint");
    String inetAddress = SERVERS.getServerDriver() instanceof ContainerInfinispanServerDriver ? "SITE_LOCAL" : "127.0.0.1";
    assertEquals(inetAddress, interfaces.at(0).at("inet-address").at("value").asString());
    assertEquals("default", security.at("security-realms").at(0).at("name").asString());
    assertEquals("hotrod", endpoint.at("hotrod-connector").at("name").asString());
    assertEquals("rest", endpoint.at("rest-connector").at("name").asString());
    assertEquals("memcachedCache", endpoint.at("memcached-connector").at("cache").asString());
}
Also used : RestResponse(org.infinispan.client.rest.RestResponse) RestClient(org.infinispan.client.rest.RestClient) Json(org.infinispan.commons.dataconversion.internal.Json) ContainerInfinispanServerDriver(org.infinispan.server.test.core.ContainerInfinispanServerDriver) Test(org.junit.Test)

Aggregations

ContainerInfinispanServerDriver (org.infinispan.server.test.core.ContainerInfinispanServerDriver)3 Test (org.junit.Test)3 RestClient (org.infinispan.client.rest.RestClient)2 RestResponse (org.infinispan.client.rest.RestResponse)1 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)1 Json (org.infinispan.commons.dataconversion.internal.Json)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1