Search in sources :

Example 11 with JetConfig

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];
}
Also used : JetConfig(com.hazelcast.jet.config.JetConfig) Before(org.junit.Before)

Example 12 with JetConfig

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);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) JetInstance(com.hazelcast.jet.JetInstance) JetCacheManager(com.hazelcast.jet.JetCacheManager) JetConfig(com.hazelcast.jet.config.JetConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) Before(org.junit.Before)

Example 13 with JetConfig

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();
}
Also used : MockPS(com.hazelcast.jet.core.TestProcessors.MockPS) JetInstance(com.hazelcast.jet.JetInstance) CountDownLatch(java.util.concurrent.CountDownLatch) JobRepository(com.hazelcast.jet.impl.JobRepository) JetConfig(com.hazelcast.jet.config.JetConfig) JobConfig(com.hazelcast.jet.config.JobConfig) JobRecord(com.hazelcast.jet.impl.JobRecord) StuckProcessor(com.hazelcast.jet.core.TestProcessors.StuckProcessor) Job(com.hazelcast.jet.Job) Test(org.junit.Test)

Example 14 with JetConfig

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);
}
Also used : MockPS(com.hazelcast.jet.core.TestProcessors.MockPS) JetInstance(com.hazelcast.jet.JetInstance) StuckProcessor(com.hazelcast.jet.core.TestProcessors.StuckProcessor) CountDownLatch(java.util.concurrent.CountDownLatch) Job(com.hazelcast.jet.Job) JetConfig(com.hazelcast.jet.config.JetConfig) JobConfig(com.hazelcast.jet.config.JobConfig) Test(org.junit.Test)

Example 15 with JetConfig

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);
    }
}
Also used : CountDownLatch(java.util.concurrent.CountDownLatch) JetConfig(com.hazelcast.jet.config.JetConfig) Before(org.junit.Before)

Aggregations

JetConfig (com.hazelcast.jet.config.JetConfig)56 Before (org.junit.Before)21 Test (org.junit.Test)15 JetInstance (com.hazelcast.jet.JetInstance)14 Config (com.hazelcast.config.Config)10 Properties (java.util.Properties)9 EventJournalConfig (com.hazelcast.config.EventJournalConfig)8 CountDownLatch (java.util.concurrent.CountDownLatch)7 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)4 EdgeConfig (com.hazelcast.jet.config.EdgeConfig)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 MapConfig (com.hazelcast.config.MapConfig)3 JobConfig (com.hazelcast.jet.config.JobConfig)3 MockPS (com.hazelcast.jet.core.TestProcessors.MockPS)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 InputStream (java.io.InputStream)3 JoinConfig (com.hazelcast.config.JoinConfig)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 JetTestInstanceFactory (com.hazelcast.jet.JetTestInstanceFactory)2 Job (com.hazelcast.jet.Job)2