use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreBootstrapper in project hetu-core by openlookeng.
the class TestStateStoreLauncherAndProvider method setupSecondInstance.
// A second instance is setup using bootstrapper directly to manually configure port
// Using launcher to launch will cause it to read from config file (same port as first member)
private StateStore setupSecondInstance() {
Map<String, String> config = new HashMap<>();
config.put("hazelcast.discovery.mode", "tcp-ip");
config.put("state-store.cluster", "test-cluster");
config.put(DISCOVERY_PORT_CONFIG_NAME, PORT2);
StateStoreBootstrapper bootstrapper = new HazelcastStateStoreBootstrapper();
return bootstrapper.bootstrap(ImmutableSet.of(LOCALHOST + ":" + PORT1, LOCALHOST + ":" + PORT2), config);
}
use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreBootstrapper in project hetu-core by openlookeng.
the class TestStateStoreLauncherAndProvider method createStateStoreCluster.
private StateStore createStateStoreCluster(String port) {
Map<String, String> config = new HashMap<>();
config.put("hazelcast.discovery.mode", "tcp-ip");
config.put("state-store.cluster", "test-cluster");
config.put(DISCOVERY_PORT_CONFIG_NAME, port);
StateStoreBootstrapper bootstrapper = new HazelcastStateStoreBootstrapper();
return bootstrapper.bootstrap(ImmutableSet.of(LOCALHOST + ":" + port), config);
}
use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreBootstrapper in project hetu-core by openlookeng.
the class TestDynamicFilterSourceOperator method createStateStoreCluster.
private StateStore createStateStoreCluster(String port) {
Map<String, String> config = new HashMap<>();
config.put("hazelcast.discovery.mode", "tcp-ip");
config.put("state-store.cluster", "test-cluster");
config.put(DISCOVERY_PORT_CONFIG_NAME, port);
StateStoreBootstrapper bootstrapper = new HazelcastStateStoreBootstrapper();
return bootstrapper.bootstrap(ImmutableSet.of("127.0.0.1:" + port), config);
}
use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreBootstrapper in project hetu-core by openlookeng.
the class TestHetuMetastoreGlobalCache method createStateStoreCluster.
private StateStore createStateStoreCluster(String port) {
Map<String, String> config = new HashMap<>();
config.put("hazelcast.discovery.mode", "tcp-ip");
config.put("state-store.cluster", "test-cluster");
config.put(DISCOVERY_PORT_CONFIG_NAME, port);
StateStoreBootstrapper bootstrapper = new HazelcastStateStoreBootstrapper();
return bootstrapper.bootstrap(ImmutableSet.of(LOCALHOST + ":" + port), config);
}
use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreBootstrapper in project hetu-core by openlookeng.
the class TestStateStoreLauncherAndProvider method testLaunchAndFailure.
// Test Launcher
@Test
public void testLaunchAndFailure() throws Exception {
Set<Seed> seeds = new HashSet<>();
SeedStore mockSeedStore = mock(SeedStore.class);
Seed mockSeed1 = mock(Seed.class);
Seed mockSeed2 = mock(Seed.class);
seeds.add(mockSeed1);
seeds.add(mockSeed2);
when(mockSeed1.getLocation()).thenReturn(LOCALHOST + ":" + PORT1);
when(mockSeed2.getLocation()).thenReturn(LOCALHOST + ":" + PORT2);
when(mockSeedStore.get()).thenReturn(seeds);
SeedStoreManager mockSeedStoreManager = mock(SeedStoreManager.class);
when(mockSeedStoreManager.getSeedStore(SeedStoreSubType.HAZELCAST)).thenReturn(mockSeedStore);
when(mockSeedStoreManager.addSeed(SeedStoreSubType.HAZELCAST, LOCALHOST, true)).thenReturn(seeds);
when(mockSeedStoreManager.getFileSystemClient()).thenReturn(new HetuLocalFileSystemClient(new LocalConfig(new Properties()), Paths.get("/")));
InternalCommunicationConfig mockInternalCommunicationConfig = mock(InternalCommunicationConfig.class);
HttpServerInfo mockHttpServerInfo = mock(HttpServerInfo.class);
when(mockHttpServerInfo.getHttpsUri()).thenReturn(new URI("https://" + LOCALHOST + ":" + PORT1));
when(mockInternalCommunicationConfig.isHttpsRequired()).thenReturn(true);
EmbeddedStateStoreLauncher launcher = new EmbeddedStateStoreLauncher(mockSeedStoreManager, mockInternalCommunicationConfig, mockHttpServerInfo, new HetuConfig());
StateStoreBootstrapper bootstrapper = new HazelcastStateStoreBootstrapper();
launcher.addStateStoreBootstrapper(bootstrapper);
launcher.launchStateStore();
StateStore second = setupSecondInstance();
// mock "remove" second instance from cluster (delete from seed store)
seeds.remove(mockSeed2);
when(mockSeed1.getLocation()).thenReturn(LOCALHOST + ":" + PORT1);
when(mockSeedStoreManager.addSeed(SeedStoreSubType.HAZELCAST, LOCALHOST, true)).thenReturn(seeds);
((HazelcastStateStore) second).shutdown();
// Allow the first node to handle failure
Thread.sleep(3000L);
}
Aggregations