Search in sources :

Example 36 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class WindowGroupTransform_IntegrationTest method before.

@Before
public void before() {
    JetConfig config = new JetConfig();
    config.getHazelcastConfig().addEventJournalConfig(new EventJournalConfig().setMapName("source*").setEnabled(true));
    config.getHazelcastConfig().setProperty(GroupProperty.PARTITION_COUNT.getName(), "1");
    instance = createJetMember(config);
}
Also used : JetConfig(com.hazelcast.jet.config.JetConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) Before(org.junit.Before)

Example 37 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class AsyncMapWriterTest method setup.

@Before
public void setup() {
    JetConfig jetConfig = new JetConfig();
    Config config = jetConfig.getHazelcastConfig();
    // use two partitions per member
    config.setProperty(GroupProperty.PARTITION_COUNT.getName(), String.valueOf(NODE_COUNT * 2));
    config.setProperty(GroupProperty.OPERATION_CALL_TIMEOUT_MILLIS.getName(), "3000");
    config.getMapConfig("default").setBackupCount(1).setAsyncBackupCount(0);
    config.getMapConfig(ALWAYS_FAILING_MAP).getMapStoreConfig().setEnabled(true).setImplementation(new AlwaysFailingMapStore());
    config.getMapConfig(RETRYABLE_MAP).getMapStoreConfig().setEnabled(true).setImplementation(new RetryableMapStore());
    JetInstance[] instances = createJetMembers(jetConfig, NODE_COUNT);
    instance1 = instances[0];
    instance2 = instances[1];
    nodeEngine = getNodeEngineImpl(instance1.getHazelcastInstance());
    writer = new AsyncMapWriter(nodeEngine);
    map = instance1.getMap("testMap");
    writer.setMapName(map.getName());
}
Also used : Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) JetInstance(com.hazelcast.jet.JetInstance) JetConfig(com.hazelcast.jet.config.JetConfig) Before(org.junit.Before)

Example 38 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class HazelcastRemoteConnectorTest method setUp.

@BeforeClass
public static void setUp() {
    JetConfig jetConfig = new JetConfig();
    Config hazelcastConfig = jetConfig.getHazelcastConfig();
    hazelcastConfig.addCacheConfig(new CacheSimpleConfig().setName("*"));
    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"));
    config.getGroupConfig().setName(randomName());
    hz = Hazelcast.newHazelcastInstance(config);
    HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(config);
    clientConfig = new ClientConfig();
    clientConfig.getGroupConfig().setName(config.getGroupConfig().getName());
    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
    hz2.getCacheManager().getCache(SOURCE_NAME);
    hz2.getCacheManager().getCache(SINK_NAME);
    jet2.getCacheManager().getCache(SOURCE_NAME);
    jet2.getCacheManager().getCache(SINK_NAME);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) JetConfig(com.hazelcast.jet.config.JetConfig) JetInstance(com.hazelcast.jet.JetInstance) ClientConfig(com.hazelcast.client.config.ClientConfig) JetConfig(com.hazelcast.jet.config.JetConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) BeforeClass(org.junit.BeforeClass)

Example 39 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class StreamEventJournalPTest method setUp.

@Before
public void setUp() {
    JetConfig config = new JetConfig();
    EventJournalConfig journalConfig = new EventJournalConfig().setMapName("*").setCapacity(JOURNAL_CAPACITY).setEnabled(true);
    config.getHazelcastConfig().setProperty(PARTITION_COUNT.getName(), String.valueOf(NUM_PARTITIONS));
    config.getHazelcastConfig().addEventJournalConfig(journalConfig);
    instance = this.createJetMember(config);
    map = (MapProxyImpl<String, Integer>) instance.getHazelcastInstance().<String, Integer>getMap("test");
    List<Integer> allPartitions = IntStream.range(0, NUM_PARTITIONS).boxed().collect(toList());
    supplier = () -> new StreamEventJournalP<>(map, allPartitions, e -> true, EventJournalMapEvent::getNewValue, START_FROM_OLDEST, false, wmGenParams(Integer::intValue, limitingLag(0), suppressAll(), -1));
    key0 = generateKeyForPartition(instance.getHazelcastInstance(), 0);
    key1 = generateKeyForPartition(instance.getHazelcastInstance(), 1);
}
Also used : IntStream(java.util.stream.IntStream) PARTITION_COUNT(com.hazelcast.spi.properties.GroupProperty.PARTITION_COUNT) Arrays(java.util.Arrays) WatermarkPolicies.limitingLag(com.hazelcast.jet.core.WatermarkPolicies.limitingLag) JetInstance(com.hazelcast.jet.JetInstance) RunWith(org.junit.runner.RunWith) EventJournalConfig(com.hazelcast.config.EventJournalConfig) Processor(com.hazelcast.jet.core.Processor) TestOutbox(com.hazelcast.jet.core.test.TestOutbox) TestProcessorContext(com.hazelcast.jet.core.test.TestProcessorContext) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) WatermarkGenerationParams.wmGenParams(com.hazelcast.jet.core.WatermarkGenerationParams.wmGenParams) EventJournalMapEvent(com.hazelcast.map.journal.EventJournalMapEvent) Before(org.junit.Before) TestInbox(com.hazelcast.jet.core.test.TestInbox) DistributedSupplier(com.hazelcast.jet.function.DistributedSupplier) JetConfig(com.hazelcast.jet.config.JetConfig) JetTestSupport(com.hazelcast.jet.core.JetTestSupport) WatermarkEmissionPolicy(com.hazelcast.jet.core.WatermarkEmissionPolicy) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) START_FROM_OLDEST(com.hazelcast.jet.pipeline.JournalInitialPosition.START_FROM_OLDEST) Collectors(java.util.stream.Collectors) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) SAME_ITEMS_ANY_ORDER(com.hazelcast.jet.core.test.TestSupport.SAME_ITEMS_ANY_ORDER) TestSupport(com.hazelcast.jet.core.test.TestSupport) Assert.assertFalse(org.junit.Assert.assertFalse) HazelcastParallelClassRunner(com.hazelcast.test.HazelcastParallelClassRunner) Entry(java.util.Map.Entry) Assert.assertEquals(org.junit.Assert.assertEquals) JetConfig(com.hazelcast.jet.config.JetConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) Before(org.junit.Before)

Example 40 with JetConfig

use of com.hazelcast.jet.config.JetConfig in project hazelcast-jet by hazelcast.

the class StreamEventJournalP_WmCoalescingTest method setUp.

@Before
public void setUp() {
    JetConfig config = new JetConfig();
    EventJournalConfig journalConfig = new EventJournalConfig().setMapName("*").setCapacity(JOURNAL_CAPACITY).setEnabled(true);
    config.getHazelcastConfig().setProperty(PARTITION_COUNT.getName(), "2");
    config.getHazelcastConfig().addEventJournalConfig(journalConfig);
    JetInstance instance = this.createJetMember(config);
    assert map == null;
    map = (MapProxyImpl<Integer, Integer>) instance.getHazelcastInstance().<Integer, Integer>getMap("test");
    partitionKeys = new int[2];
    for (int i = 1; IntStream.of(partitionKeys).anyMatch(val -> val == 0); i++) {
        int partitionId = instance.getHazelcastInstance().getPartitionService().getPartition(i).getPartitionId();
        partitionKeys[partitionId] = i;
    }
}
Also used : JetInstance(com.hazelcast.jet.JetInstance) JetConfig(com.hazelcast.jet.config.JetConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) 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