@Override public List<HotRodServer> initServers() { HotRodServerConfigurationBuilder configuration = new HotRodServerConfigurationBuilder().port(0); return Arrays.asList(HotRodTestingUtil.startHotRodServer(new DefaultCacheManager(), configuration)); }
protected HotRodServer createHotRodServer() { HotRodServerConfigurationBuilder serverBuilder = new HotRodServerConfigurationBuilder(); serverBuilder.adminOperationsHandler(new EmbeddedServerAdminOperationHandler()); return HotRodClientTestingUtil.startHotRodServer(cacheManager, serverBuilder); }
public static HotRodServer startHotRodServer(EmbeddedCacheManager manager, int port, int idleTimeout, String proxyHost, int proxyPort, long delay, String defaultCacheName) { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.proxyHost(proxyHost).proxyPort(proxyPort).idleTimeout(idleTimeout).defaultCacheName(defaultCacheName); return startHotRodServer(manager, port, delay, builder); }
public static HotRodServerConfigurationBuilder getDefaultHotRodConfiguration() { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); int port = serverPort(); builder.host(host()).port(port).proxyHost(host()).proxyPort(port); return builder; }
public void testServerStartWithSslAndCertPasswd() { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.host(host()).port(serverPort()).idleTimeout(0); builder.ssl().enable().keyStoreFileName(keyStoreFileName).keyStorePassword("secret".toCharArray()) .keyStoreType("pkcs12") .keyStoreCertificatePassword("secret2".toCharArray()).trustStoreFileName(trustStoreFileName) .trustStorePassword("secret".toCharArray()).trustStoreType("pkcs12"); Stoppable.useCacheManager(createCacheManager(hotRodCacheConfiguration()), cm -> Stoppable.useServer(new HotRodServer(), server -> { server.start(builder.build(), cm); assertNotNull(server.getConfiguration().ssl().keyStoreCertificatePassword()); } )); }
// Start a cache manager as usual EmbeddedCacheManager cacheManager; try (InputStream in = ClassLoader.getSystemResourceAsStream("infinispan.xml")) { cacheManager = new DefaultCacheManager(in); } // Start a server to allow remote access to the cache manager HotRodServerConfiguration serverConfig = new HotRodServerConfigurationBuilder() .host("127.0.0.1").port(9999).build(); HotRodServer server = new HotRodServer(); server.start(serverConfig, cacheManager); // Start the example cache Cache<String, String> cache = cacheManager.getCache("dumpster", true); cache.put("K", "V"); System.out.println(cache.get("K")); // V
@Override protected HotRodServer createStartHotRodServer(EmbeddedCacheManager cacheManager) { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.proxyHost(host()).proxyPort(serverPort()).idleTimeout(0); builder.ssl().enable() .keyStoreFileName(keyStoreFileName) .keyStorePassword("secret".toCharArray()) .keyStoreType("pkcs12") .trustStoreFileName(trustStoreFileName) .trustStorePassword("secret".toCharArray()) .trustStoreType("pkcs12"); return startHotRodServer(cacheManager, serverPort(), -1, builder); }
@Override public List<HotRodServer> initServers() { HotRodServerConfigurationBuilder configuration = new HotRodServerConfigurationBuilder().port(0); configuration.ssl() .enable() .keyStoreFileName(KEYSTORE_LOCATION) .keyStorePassword(PASSWORD) .trustStoreFileName(TRUSTSTORE_LOCATION) .trustStorePassword(PASSWORD); return Arrays.asList(HotRodTestingUtil.startHotRodServer(new DefaultCacheManager(), configuration)); }
public void testLazyLoadTopology() { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.topologyStateTransfer(false).topologyReplTimeout(43000); withClusteredServer(builder, (cfg, distSyncTimeout) -> { assertEquals(cfg.clustering().remoteTimeout(), 43000); assertTrue(cfg.clustering().stateTransfer().fetchInMemoryState()); ClusterLoaderConfiguration clcfg = ((ClusterLoaderConfiguration) cfg.persistence().stores().get(0)); assertNotNull(clcfg); assertEquals(clcfg.remoteCallTimeout(), 43000); }); }
public void testUserDefinedTimeouts() { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.topologyLockTimeout(26000).topologyReplTimeout(31000); withClusteredServer(builder, (cfg, distSyncTimeout) -> { assertEquals(cfg.locking().lockAcquisitionTimeout(), 26000); assertEquals(cfg.clustering().remoteTimeout(), 31000); assertTrue(cfg.clustering().stateTransfer().fetchInMemoryState()); assertEquals(cfg.clustering().stateTransfer().timeout(), 31000 + distSyncTimeout); assertTrue(cfg.persistence().stores().isEmpty()); }); }
@Override public HotRodServer createStartHotRodServer(EmbeddedCacheManager cacheManager) { SimpleServerAuthenticationProvider ssap = new SimpleServerAuthenticationProvider(); ssap.addUser("user", "realm", "password".toCharArray()); HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); builder.authentication().enable().addAllowedMech("CRAM-MD5").serverAuthenticationProvider(ssap) .serverName("localhost").addMechProperty(Sasl.POLICY_NOANONYMOUS, "true"); return startHotRodServer(cacheManager, HotRodTestingUtil.serverPort(), 0, builder); }
@BeforeMethod public void setup() throws Exception { ClassLoader cl = HotRodUpgradeWithSSLTest.class.getClassLoader(); HotRodServerConfigurationBuilder sourceHotRodBuilder = new HotRodServerConfigurationBuilder(); sourceHotRodBuilder .ssl() .enable() .requireClientAuth(true) .build(); HotRodServerConfigurationBuilder targetHotRodBuilder = new HotRodServerConfigurationBuilder(); targetHotRodBuilder .ssl() .enable() .requireClientAuth(true)
public void testSharedContainer(Method m) { int basePort = serverPort(); hotRodServer1 = startHotRodServer(cacheManagers.get(0), basePort, new HotRodServerConfigurationBuilder().name("1")); hotRodServer2 = startHotRodServer(cacheManagers.get(0), basePort + 50, new HotRodServerConfigurationBuilder().name("2")); hotRodClient1 = new HotRodClient("127.0.0.1", hotRodServer1.getPort(), cacheName, 60, (byte) 20); hotRodClient2 = new HotRodClient("127.0.0.1", hotRodServer2.getPort(), cacheName, 60, (byte) 20); hotRodClient1.put(k(m), 0, 0, v(m)); assertSuccess(hotRodClient2.get(k(m), 0), v(m)); }
HotRodServerConfigurationBuilder serverBuilder = HotRodTestingUtil.getDefaultHotRodConfiguration(); serverBuilder .ssl() .enable() .requireClientAuth(true) .trustStorePassword("secret".toCharArray()); serverBuilder .authentication() .enable() .serverName("localhost") .serverAuthenticationProvider(sap); hrServer = new HotRodServer(); hrServer.start(serverBuilder.build(), localCacheManager);
private void processAuthentication(OperationContext context, HotRodServerConfigurationBuilder configurationBuilder, ProtocolServerService service, ServiceBuilder<?> builder, ModelNode config) throws OperationFailedException { if (config.hasDefined(ModelKeys.AUTHENTICATION) && config.get(ModelKeys.AUTHENTICATION, ModelKeys.AUTHENTICATION_NAME).isDefined()) { configurationBuilder.authentication().enable(); ModelNode authentication = config.get(ModelKeys.AUTHENTICATION, ModelKeys.AUTHENTICATION_NAME); AuthenticationConfigurationBuilder authenticationBuilder = configurationBuilder.authentication(); ModelNode sasl = authentication.get(ModelKeys.SASL, ModelKeys.SASL_NAME); if (sasl.hasDefined(ModelKeys.SERVER_CONTEXT_NAME)) {
@Override public HotRodServerConfiguration build() { return build(true); }
public HotrodServerBuilder addSniDomain(String domain, String keystoreFileName, String keystorePassword, String truststoreFileName, String truststorePassword) { builder.ssl().enable() .sniHostName(domain) .keyStoreFileName(keystoreFileName) .keyStorePassword(keystorePassword.toCharArray()) .keyStoreType("pkcs12") .trustStoreFileName(truststoreFileName) .trustStorePassword(truststorePassword.toCharArray()) .trustStoreType("pkcs12"); return this; }
public static HotRodServer startHotRodServerWithoutTransport(String... definedCaches) { return startHotRodServerWithoutTransport(new HotRodServerConfigurationBuilder(), definedCaches); }