use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.
the class PartitionAlignmentTest method before.
@Before
public void before() {
final JetConfig cfg = new JetConfig();
cfg.getHazelcastConfig().setProperty("hazelcast.partition.count", String.valueOf(PARTITION_COUNT));
instance = createJetMembers(cfg, 2)[0];
}
use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.
the class HazelcastConnectorTest method setup.
@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);
}
use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.
the class SplitBrainTest method when_newMemberJoinsToCluster_then_jobQuorumSizeIsUpdated.
@Test
public void when_newMemberJoinsToCluster_then_jobQuorumSizeIsUpdated() {
int clusterSize = 3;
JetConfig jetConfig = new JetConfig();
JetInstance[] instances = new JetInstance[clusterSize];
for (int i = 0; i < clusterSize; i++) {
instances[i] = createJetMember(jetConfig);
}
StuckProcessor.executionStarted = new CountDownLatch(clusterSize * PARALLELISM);
MockPS processorSupplier = new MockPS(StuckProcessor::new, clusterSize);
DAG dag = new DAG().vertex(new Vertex("test", processorSupplier));
Job job = instances[0].newJob(dag, new JobConfig().setSplitBrainProtection(true));
assertOpenEventually(StuckProcessor.executionStarted);
createJetMember(jetConfig);
assertTrueEventually(() -> {
JobRepository jobRepository = getJetService(instances[0]).getJobRepository();
JobRecord jobRecord = jobRepository.getJobRecord(job.getId());
assertEquals(3, jobRecord.getQuorumSize());
});
StuckProcessor.proceedLatch.countDown();
}
use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.
the class SplitBrainTest method when_newMemberIsAddedAfterClusterSizeFallsBelowQuorumSize_then_jobRestartDoesNotSucceed.
@Test
public void when_newMemberIsAddedAfterClusterSizeFallsBelowQuorumSize_then_jobRestartDoesNotSucceed() {
int clusterSize = 5;
JetConfig jetConfig = new JetConfig();
JetInstance[] instances = new JetInstance[clusterSize];
for (int i = 0; i < clusterSize; i++) {
instances[i] = createJetMember(jetConfig);
}
StuckProcessor.executionStarted = new CountDownLatch(clusterSize * PARALLELISM);
MockPS processorSupplier = new MockPS(StuckProcessor::new, clusterSize);
DAG dag = new DAG().vertex(new Vertex("test", processorSupplier));
Job job = instances[0].newJob(dag, new JobConfig().setSplitBrainProtection(true));
assertOpenEventually(StuckProcessor.executionStarted);
for (int i = 1; i < clusterSize; i++) {
instances[i].getHazelcastInstance().getLifecycleService().terminate();
}
StuckProcessor.proceedLatch.countDown();
assertTrueEventually(() -> assertEquals(RESTARTING, job.getStatus()));
createJetMember(jetConfig);
assertTrueAllTheTime(() -> assertEquals(RESTARTING, job.getStatus()), 5);
}
use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.
the class TopologyChangeTest method setup.
@Before
public void setup() {
nodeCount = 0;
for (boolean isLiteMember : liteMemberFlags) {
if (!isLiteMember) {
nodeCount++;
}
}
MockPS.closeCount.set(0);
MockPS.initCount.set(0);
MockPS.receivedCloseErrors.clear();
StuckProcessor.proceedLatch = new CountDownLatch(1);
StuckProcessor.executionStarted = new CountDownLatch(nodeCount * PARALLELISM);
config = new JetConfig();
config.getInstanceConfig().setCooperativeThreadCount(PARALLELISM);
instances = new JetInstance[NODE_COUNT];
for (int i = 0; i < NODE_COUNT; i++) {
JetConfig config = new JetConfig();
config.getHazelcastConfig().setLiteMember(liteMemberFlags[i]);
config.getInstanceConfig().setCooperativeThreadCount(PARALLELISM);
instances[i] = createJetMember(config);
}
}
Aggregations