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();
}
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;
}
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);
}
}
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;
}
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);
}
Aggregations