use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class DecoratorTest method listDecorator.
@Test
public void listDecorator() throws Exception {
JetInstance instance = Mockito.mock(JetInstance.class);
assertDecorator(IList.class, IListJet.class, l -> new IListDecorator<>(l, instance));
}
use of com.hazelcast.jet.JetInstance 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());
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet by hazelcast.
the class ExceptionUtilTest method test_serializationOnNode.
@Test
public void test_serializationOnNode() {
// create one member and one client
JetInstance client = createJetMember();
RuntimeException exc = new RuntimeException("myException");
try {
DAG dag = new DAG();
dag.newVertex("source", () -> new MockP().setCompleteError(exc)).localParallelism(1);
client.newJob(dag).join();
} catch (Exception caught) {
assertThat(caught.toString(), containsString(exc.toString()));
TestUtil.assertExceptionInCauses(exc, caught);
}
}
use of com.hazelcast.jet.JetInstance 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);
}
use of com.hazelcast.jet.JetInstance 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;
}
}
Aggregations