@Before public void setup() { JetConfig jetConfig = new JetConfig(); Config hazelcastConfig = jetConfig.getHazelcastConfig(); hazelcastConfig.addCacheConfig(new CacheSimpleConfig().setName("*")); hazelcastConfig.addEventJournalConfig(new EventJournalConfig().setCacheName("stream*").setMapName("stream*")); jetInstance = createJetMember(jetConfig); JetInstance jetInstance2 = createJetMember(jetConfig); sourceName = randomString(); sinkName = randomString(); streamSourceName = "stream" + sourceName; streamSinkName = "stream" + sinkName; // workaround for `cache is not created` exception, create cache locally on all nodes JetCacheManager cacheManager = jetInstance2.getCacheManager(); cacheManager.getCache(sourceName); cacheManager.getCache(sinkName); cacheManager.getCache(streamSourceName); cacheManager.getCache(streamSinkName); }
@BeforeClass public static void setupCluster() throws Exception { int parallelism = Runtime.getRuntime().availableProcessors() / MEMBER_COUNT / 2; JetConfig config = new JetConfig(); config.getInstanceConfig().setCooperativeThreadCount(parallelism <= 2 ? 2 : parallelism); Config hzConfig = config.getHazelcastConfig(); hzConfig.addCacheConfig(new CacheSimpleConfig().setName("*")); hzConfig.getMapEventJournalConfig(JOURNALED_MAP_PREFIX + '*').setEnabled(true); member = createCluster(MEMBER_COUNT, config); client = factory.newClient(); }
@Before public void before() { JetConfig jetConfig = new JetConfig(); Config hazelcastConfig = jetConfig.getHazelcastConfig(); hazelcastConfig.addCacheConfig(new CacheSimpleConfig().setName("*")); factory = new JetTestInstanceFactory(); jet = factory.newMember(jetConfig); JetInstance jet2 = factory.newMember(jetConfig); Config config = new Config(); config.addCacheConfig(new CacheSimpleConfig().setName("*")); config.addEventJournalConfig(new EventJournalConfig().setCacheName("default").setMapName("default")); hz = Hazelcast.newHazelcastInstance(config); HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(config); clientConfig = new ClientConfig(); clientConfig.getGroupConfig().setName("dev"); clientConfig.getGroupConfig().setPassword("dev-pass"); Address address = hz.getCluster().getLocalMember().getAddress(); clientConfig.getNetworkConfig().addAddress(address.getHost() + ':' + address.getPort()); // workaround for `cache is not created` exception, create cache locally on all nodes jet2.getCacheManager().getCache(SOURCE_NAME); jet2.getCacheManager().getCache(SINK_NAME); hz2.getCacheManager().getCache(SOURCE_NAME); hz2.getCacheManager().getCache(SINK_NAME); }