Search in sources :

Example 1 with HazelcastStateStoreFactory

use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory in project hetu-core by openlookeng.

the class TestStateStoreLauncherAndProvider method setUp.

// setup for test provider
@BeforeTest
private void setUp() throws IOException {
    Set<Seed> seeds = new HashSet<>();
    SeedStore mockSeedStore = mock(SeedStore.class);
    Seed mockSeed = mock(Seed.class);
    seeds.add(mockSeed);
    SeedStoreManager mockSeedStoreManager = mock(SeedStoreManager.class);
    when(mockSeedStoreManager.getSeedStore(SeedStoreSubType.HAZELCAST)).thenReturn(mockSeedStore);
    when(mockSeed.getLocation()).thenReturn(LOCALHOST + ":" + PORT3);
    when(mockSeedStore.get()).thenReturn(seeds);
    factory = new HazelcastStateStoreFactory();
    stateStoreProvider = new LocalStateStoreProvider(mockSeedStoreManager);
    stateStoreProvider.addStateStoreFactory(factory);
}
Also used : SeedStoreManager(io.prestosql.seedstore.SeedStoreManager) Seed(io.prestosql.spi.seedstore.Seed) SeedStore(io.prestosql.spi.seedstore.SeedStore) HazelcastStateStoreFactory(io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory) HashSet(java.util.HashSet) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with HazelcastStateStoreFactory

use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory in project hetu-core by openlookeng.

the class TestDynamicFilterSourceOperator method prepareConfigFiles.

@BeforeTest
private void prepareConfigFiles() throws Exception {
    File launcherConfigFile = new File(STATE_STORE_CONFIGURATION_PATH);
    if (launcherConfigFile.exists()) {
        launcherConfigFile.delete();
    }
    launcherConfigFile.createNewFile();
    FileWriter configWriter = new FileWriter(STATE_STORE_CONFIGURATION_PATH);
    configWriter.write("state-store.type=hazelcast\n" + "state-store.name=test\n" + "state-store.cluster=test-cluster\n" + "hazelcast.discovery.mode=tcp-ip\n" + "hazelcast.discovery.port=7980\n");
    configWriter.close();
    Set<Seed> seeds = new HashSet<>();
    SeedStore mockSeedStore = mock(SeedStore.class);
    Seed mockSeed = mock(Seed.class);
    seeds.add(mockSeed);
    SeedStoreManager mockSeedStoreManager = mock(SeedStoreManager.class);
    when(mockSeedStoreManager.getSeedStore(SeedStoreSubType.HAZELCAST)).thenReturn(mockSeedStore);
    when(mockSeed.getLocation()).thenReturn("127.0.0.1:6991");
    when(mockSeedStore.get()).thenReturn(seeds);
    StateStoreFactory factory = new HazelcastStateStoreFactory();
    stateStoreProvider = new LocalStateStoreProvider(mockSeedStoreManager);
    stateStoreProvider.addStateStoreFactory(factory);
    createStateStoreCluster("6991");
    stateStoreProvider.loadStateStore();
}
Also used : LocalStateStoreProvider(io.prestosql.statestore.LocalStateStoreProvider) SeedStoreManager(io.prestosql.seedstore.SeedStoreManager) Seed(io.prestosql.spi.seedstore.Seed) FileWriter(java.io.FileWriter) SeedStore(io.prestosql.spi.seedstore.SeedStore) HazelcastStateStoreFactory(io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory) File(java.io.File) HashSet(java.util.HashSet) HazelcastStateStoreFactory(io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory) StateStoreFactory(io.prestosql.spi.statestore.StateStoreFactory) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with HazelcastStateStoreFactory

use of io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory in project hetu-core by openlookeng.

the class TestHetuMetastoreGlobalCache method setUpHazelcast.

@BeforeTest
private void setUpHazelcast() throws IOException {
    Set<Seed> seeds = new HashSet<>();
    SeedStore mockSeedStore = mock(SeedStore.class);
    Seed mockSeed = mock(Seed.class);
    seeds.add(mockSeed);
    SeedStoreManager mockSeedStoreManager = mock(SeedStoreManager.class);
    when(mockSeedStoreManager.getSeedStore(any(SeedStoreSubType.class))).thenReturn(mockSeedStore);
    when(mockSeed.getLocation()).thenReturn(LOCALHOST + ":" + PORT3);
    when(mockSeedStore.get()).thenReturn(seeds);
    factory = new HazelcastStateStoreFactory();
    stateStoreProvider = new LocalStateStoreProvider(mockSeedStoreManager);
    stateStoreProvider.addStateStoreFactory(factory);
}
Also used : LocalStateStoreProvider(io.prestosql.statestore.LocalStateStoreProvider) SeedStoreManager(io.prestosql.seedstore.SeedStoreManager) Seed(io.prestosql.spi.seedstore.Seed) SeedStore(io.prestosql.spi.seedstore.SeedStore) HazelcastStateStoreFactory(io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory) HashSet(java.util.HashSet) SeedStoreSubType(io.prestosql.spi.seedstore.SeedStoreSubType) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

HazelcastStateStoreFactory (io.hetu.core.statestore.hazelcast.HazelcastStateStoreFactory)3 SeedStoreManager (io.prestosql.seedstore.SeedStoreManager)3 Seed (io.prestosql.spi.seedstore.Seed)3 SeedStore (io.prestosql.spi.seedstore.SeedStore)3 HashSet (java.util.HashSet)3 BeforeTest (org.testng.annotations.BeforeTest)3 LocalStateStoreProvider (io.prestosql.statestore.LocalStateStoreProvider)2 SeedStoreSubType (io.prestosql.spi.seedstore.SeedStoreSubType)1 StateStoreFactory (io.prestosql.spi.statestore.StateStoreFactory)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1