Search in sources :

Example 1 with DummyServerManagement

use of org.infinispan.server.core.DummyServerManagement in project infinispan by infinispan.

the class RestTestingUtil method createRest.

public static RestServer createRest(String ctx, RestServerConfigurationBuilder configuration, GlobalConfigurationBuilder globalConfigurationBuilder, ConfigurationBuilder cacheConfigurationBuilder, String... definedCaches) {
    configuration.contextPath(ctx);
    RestServer nettyRestServer = new RestServer();
    Configuration cacheConfiguration = cacheConfigurationBuilder.build();
    DefaultCacheManager cacheManager = new DefaultCacheManager(globalConfigurationBuilder.build(), false);
    for (String cache : definedCaches) {
        cacheManager.defineConfiguration(cache, cacheConfiguration);
    }
    cacheManager.start();
    nettyRestServer.setServerManagement(new DummyServerManagement(), true);
    nettyRestServer.start(configuration.build(), cacheManager);
    return nettyRestServer;
}
Also used : RestServer(org.infinispan.rest.RestServer) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) Configuration(org.infinispan.configuration.cache.Configuration) DummyServerManagement(org.infinispan.server.core.DummyServerManagement)

Example 2 with DummyServerManagement

use of org.infinispan.server.core.DummyServerManagement in project infinispan by infinispan.

the class EndpointInteroperabilityTest method setup.

@BeforeClass
protected void setup() throws Exception {
    cacheManager = TestCacheManagerFactory.createServerModeCacheManager();
    cacheManager.defineConfiguration(DEFAULT_CACHE_NAME, getDefaultCacheConfiguration().build());
    cacheManager.defineConfiguration(MARSHALLED_CACHE_NAME, getMarshalledCacheConfiguration().build());
    cacheManager.defineConfiguration(STRING_CACHE_NAME, getStringsCacheConfiguration().build());
    RestServerConfigurationBuilder builder = new RestServerConfigurationBuilder();
    builder.port(findFreePort());
    restServer = new RestServer();
    restServer.setServerManagement(new DummyServerManagement(), true);
    restServer.start(builder.build(), cacheManager);
    RestClientConfigurationBuilder clientBuilder = new RestClientConfigurationBuilder();
    RestClientConfiguration configuration = clientBuilder.addServer().host(restServer.getHost()).port(restServer.getPort()).build();
    restClient = RestClient.forConfiguration(configuration);
    HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
    serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
    hotRodServer = startHotRodServer(cacheManager, serverBuilder);
    defaultRemoteCache = createRemoteCacheManager(IdentityMarshaller.INSTANCE).getCache(DEFAULT_CACHE_NAME);
    defaultMarshalledRemoteCache = createRemoteCacheManager(null).getCache(MARSHALLED_CACHE_NAME);
    stringRemoteCache = createRemoteCacheManager(new UTF8StringMarshaller()).getCache(STRING_CACHE_NAME);
}
Also used : RestServer(org.infinispan.rest.RestServer) RestServerConfigurationBuilder(org.infinispan.rest.configuration.RestServerConfigurationBuilder) RestClientConfiguration(org.infinispan.client.rest.configuration.RestClientConfiguration) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) EmbeddedServerAdminOperationHandler(org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler) UTF8StringMarshaller(org.infinispan.commons.marshall.UTF8StringMarshaller) DummyServerManagement(org.infinispan.server.core.DummyServerManagement) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with DummyServerManagement

use of org.infinispan.server.core.DummyServerManagement in project infinispan by infinispan.

the class EndpointsCacheFactory method createRestCache.

private void createRestCache() {
    RestServer restServer = startProtocolServer(findFreePort(), p -> {
        RestServerConfigurationBuilder builder = new RestServerConfigurationBuilder();
        builder.port(p);
        rest = new RestServer();
        rest.setServerManagement(new DummyServerManagement(), true);
        rest.start(builder.build(), cacheManager);
        return rest;
    });
    RestClientConfigurationBuilder builder = new RestClientConfigurationBuilder();
    builder.addServer().host(restServer.getHost()).port(restServer.getPort());
    restClient = RestClient.forConfiguration(builder.build());
    restCacheClient = restClient.cache(cacheName);
}
Also used : RestServer(org.infinispan.rest.RestServer) RestServerConfigurationBuilder(org.infinispan.rest.configuration.RestServerConfigurationBuilder) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) DummyServerManagement(org.infinispan.server.core.DummyServerManagement)

Example 4 with DummyServerManagement

use of org.infinispan.server.core.DummyServerManagement in project infinispan by infinispan.

the class BaseJsonTest method setup.

@BeforeClass
protected void setup() throws Exception {
    cacheManager = TestCacheManagerFactory.createServerModeCacheManager(EndpointITSCI.INSTANCE, new ConfigurationBuilder());
    cacheManager.getClassWhiteList().addRegexps(".*");
    cacheManager.defineConfiguration(CACHE_NAME, getIndexCacheConfiguration().build());
    RestServerConfigurationBuilder builder = new RestServerConfigurationBuilder();
    int restPort = findFreePort();
    builder.port(restPort);
    restServer = new RestServer();
    restServer.setServerManagement(new DummyServerManagement(), true);
    restServer.start(builder.build(), cacheManager);
    restClient = RestClient.forConfiguration(new RestClientConfigurationBuilder().addServer().host(restServer.getHost()).port(restServer.getPort()).build());
    restCacheClient = restClient.cache(CACHE_NAME);
    hotRodServer = startHotRodServer(cacheManager);
    remoteCacheManager = createRemoteCacheManager();
    remoteCache = remoteCacheManager.getCache(CACHE_NAME);
}
Also used : RestServer(org.infinispan.rest.RestServer) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) RestServerConfigurationBuilder(org.infinispan.rest.configuration.RestServerConfigurationBuilder) RestServerConfigurationBuilder(org.infinispan.rest.configuration.RestServerConfigurationBuilder) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) DummyServerManagement(org.infinispan.server.core.DummyServerManagement) BeforeClass(org.testng.annotations.BeforeClass)

Example 5 with DummyServerManagement

use of org.infinispan.server.core.DummyServerManagement in project infinispan by infinispan.

the class RestServerHelper method start.

public RestServerHelper start(String name) {
    restServerConfigurationBuilder.name(name);
    restServer.setServerManagement(new DummyServerManagement(), true);
    restServer.start(restServerConfigurationBuilder.build(), cacheManager);
    return this;
}
Also used : DummyServerManagement(org.infinispan.server.core.DummyServerManagement)

Aggregations

DummyServerManagement (org.infinispan.server.core.DummyServerManagement)6 RestServer (org.infinispan.rest.RestServer)5 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)4 RestServerConfigurationBuilder (org.infinispan.rest.configuration.RestServerConfigurationBuilder)4 UTF8StringMarshaller (org.infinispan.commons.marshall.UTF8StringMarshaller)2 HotRodServerConfigurationBuilder (org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)2 BeforeClass (org.testng.annotations.BeforeClass)2 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)1 ConfigurationBuilder (org.infinispan.client.hotrod.configuration.ConfigurationBuilder)1 RestResponse (org.infinispan.client.rest.RestResponse)1 RestClientConfiguration (org.infinispan.client.rest.configuration.RestClientConfiguration)1 Configuration (org.infinispan.configuration.cache.Configuration)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 EmbeddedServerAdminOperationHandler (org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler)1 Router (org.infinispan.server.router.Router)1 RouterConfigurationBuilder (org.infinispan.server.router.configuration.builder.RouterConfigurationBuilder)1 EndpointRouter (org.infinispan.server.router.router.EndpointRouter)1 Route (org.infinispan.server.router.routes.Route)1