Search in sources :

Example 1 with EmbeddedServerAdminOperationHandler

use of org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler in project quarkus by quarkusio.

the class InfinispanServerTestResource method start.

@Override
public Map<String, String> start() {
    TestResourceTracker.setThreadTestName("InfinispanServer");
    ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
    configurationBuilder.encoding().mediaType(MediaType.APPLICATION_PROTOSTREAM_TYPE);
    EmbeddedCacheManager ecm = TestCacheManagerFactory.createCacheManager(new GlobalConfigurationBuilder().nonClusteredDefault().defaultCacheName("default"), configurationBuilder);
    ecm.defineConfiguration("magazine", configurationBuilder.build());
    // Client connects to a non default port
    final HotRodServerConfigurationBuilder hotRodServerConfigurationBuilder = new HotRodServerConfigurationBuilder();
    hotRodServerConfigurationBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
    hotRodServerConfigurationBuilder.ssl().enabled(true).keyStoreFileName("src/main/resources/server.p12").keyStorePassword(PASSWORD).keyStoreType("PKCS12").requireClientAuth(false).protocol("TLSv1.2");
    hotRodServer = HotRodTestingUtil.startHotRodServer(ecm, 11232, hotRodServerConfigurationBuilder);
    return Collections.emptyMap();
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) EmbeddedServerAdminOperationHandler(org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 2 with EmbeddedServerAdminOperationHandler

use of org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler in project infinispan by infinispan.

the class RemoteCacheCreateOnAccessTest method addStatefulHotRodServer.

protected HotRodServer addStatefulHotRodServer(ConfigurationBuilder builder, char id) {
    GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder();
    gcb.addModule(PrivateGlobalConfigurationBuilder.class).serverMode(true);
    String stateDirectory = tmpDirectory(this.getClass().getSimpleName() + File.separator + id);
    if (clear)
        Util.recursiveFileRemove(stateDirectory);
    gcb.globalState().enable().persistentLocation(stateDirectory).configurationStorage(ConfigurationStorage.OVERLAY);
    if (isShared()) {
        String sharedDirectory = tmpDirectory(this.getClass().getSimpleName() + File.separator + "COMMON");
        gcb.globalState().sharedPersistentLocation(sharedDirectory);
    } else {
        gcb.globalState().sharedPersistentLocation(stateDirectory);
    }
    EmbeddedCacheManager cm = addClusterEnabledCacheManager(gcb, builder);
    cm.defineConfiguration("template", builder.build());
    HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
    serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
    HotRodServer server = HotRodClientTestingUtil.startHotRodServer(cm, serverBuilder);
    servers.add(server);
    return server;
}
Also used : PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) EmbeddedServerAdminOperationHandler(org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler) HotRodServer(org.infinispan.server.hotrod.HotRodServer) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 3 with EmbeddedServerAdminOperationHandler

use of org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler in project infinispan by infinispan.

the class SecureRemoteCacheAdminTest method addHotRodServer.

@Override
protected HotRodServer addHotRodServer(ConfigurationBuilder builder) {
    GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder();
    gcb.defaultCacheName("default");
    gcb.addModule(PrivateGlobalConfigurationBuilder.class).serverMode(true);
    gcb.security().authorization().enable().principalRoleMapper(new IdentityRoleMapper()).role("admin").permission(AuthorizationPermission.ALL);
    gcb.serialization().addContextInitializer(contextInitializer());
    ConfigurationBuilder template = new ConfigurationBuilder();
    template.read(builder.build());
    template.security().authorization().role("admin");
    try {
        EmbeddedCacheManager cm = Security.doPrivileged((PrivilegedExceptionAction<EmbeddedCacheManager>) () -> {
            EmbeddedCacheManager cacheManager = addClusterEnabledCacheManager(gcb, builder);
            cacheManager.defineConfiguration("template", builder.build());
            cacheManager.defineConfiguration(DefaultTemplate.DIST_ASYNC.getTemplateName(), builder.build());
            return cacheManager;
        });
        HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
        serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
        SimpleServerAuthenticationProvider sap = new SimpleServerAuthenticationProvider();
        sap.addUser("admin", "realm", "password".toCharArray(), "admin");
        serverBuilder.authentication().enable().serverAuthenticationProvider(sap).serverName("localhost").addAllowedMech("CRAM-MD5");
        HotRodServer server = Security.doPrivileged((PrivilegedExceptionAction<HotRodServer>) () -> HotRodClientTestingUtil.startHotRodServer(cm, serverBuilder));
        servers.add(server);
        return server;
    } catch (PrivilegedActionException e) {
        throw new RuntimeException(e);
    }
}
Also used : PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) IdentityRoleMapper(org.infinispan.security.mappers.IdentityRoleMapper) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) EmbeddedServerAdminOperationHandler(org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler) PrivilegedActionException(java.security.PrivilegedActionException) HotRodServer(org.infinispan.server.hotrod.HotRodServer) SimpleServerAuthenticationProvider(org.infinispan.server.core.security.simple.SimpleServerAuthenticationProvider) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 4 with EmbeddedServerAdminOperationHandler

use of org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler in project infinispan by infinispan.

the class RemoteCacheAdminPermanentTest method addStatefulHotRodServer.

protected HotRodServer addStatefulHotRodServer(ConfigurationBuilder builder, char id) {
    GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder();
    gcb.addModule(PrivateGlobalConfigurationBuilder.class).serverMode(true);
    String stateDirectory = tmpDirectory(this.getClass().getSimpleName(), Character.toString(id));
    if (clear)
        Util.recursiveFileRemove(stateDirectory);
    gcb.globalState().enable().persistentLocation(stateDirectory).configurationStorage(ConfigurationStorage.OVERLAY);
    if (isShared()) {
        String sharedDirectory = tmpDirectory(this.getClass().getSimpleName(), "COMMON");
        gcb.globalState().sharedPersistentLocation(sharedDirectory);
    } else {
        gcb.globalState().sharedPersistentLocation(stateDirectory);
    }
    EmbeddedCacheManager cm = addClusterEnabledCacheManager(gcb, builder);
    cm.defineConfiguration("template", builder.build());
    HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
    serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
    HotRodServer server = HotRodClientTestingUtil.startHotRodServer(cm, serverBuilder);
    servers.add(server);
    return server;
}
Also used : PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) PrivateGlobalConfigurationBuilder(org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder) EmbeddedServerAdminOperationHandler(org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler) HotRodServer(org.infinispan.server.hotrod.HotRodServer) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Example 5 with EmbeddedServerAdminOperationHandler

use of org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler in project infinispan by infinispan.

the class RemoteCacheAdminStandaloneTest method createHotRodServer.

@Override
protected HotRodServer createHotRodServer() {
    HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder();
    serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler());
    return HotRodClientTestingUtil.startHotRodServer(cacheManager, serverBuilder);
}
Also used : EmbeddedServerAdminOperationHandler(org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)

Aggregations

EmbeddedServerAdminOperationHandler (org.infinispan.server.core.admin.embeddedserver.EmbeddedServerAdminOperationHandler)13 HotRodServerConfigurationBuilder (org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)13 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)5 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)5 PrivateGlobalConfigurationBuilder (org.infinispan.configuration.internal.PrivateGlobalConfigurationBuilder)4 HotRodServer (org.infinispan.server.hotrod.HotRodServer)4 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)3 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)3 BeforeClass (org.testng.annotations.BeforeClass)3 ConfigurationBuilder (org.infinispan.client.hotrod.configuration.ConfigurationBuilder)2 PrivilegedActionException (java.security.PrivilegedActionException)1 Properties (java.util.Properties)1 CachingProvider (javax.cache.spi.CachingProvider)1 HotRodClientTestingUtil.killRemoteCacheManager (org.infinispan.client.hotrod.test.HotRodClientTestingUtil.killRemoteCacheManager)1 HotRodClientTestingUtil.newRemoteConfigurationBuilder (org.infinispan.client.hotrod.test.HotRodClientTestingUtil.newRemoteConfigurationBuilder)1 RestClientConfiguration (org.infinispan.client.rest.configuration.RestClientConfiguration)1 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)1 UTF8StringMarshaller (org.infinispan.commons.marshall.UTF8StringMarshaller)1 TimeService (org.infinispan.commons.time.TimeService)1 JCacheTestingUtil (org.infinispan.jcache.util.JCacheTestingUtil)1