Search in sources :

Example 1 with EXACTLY_ONCE

use of com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE in project hazelcast by hazelcast.

the class AsyncTransformUsingServiceBatchP_IntegrationTest method before.

@Before
public void before() {
    journaledMap = instance().getMap(randomMapName("journaledMap"));
    journaledMap.putAll(IntStream.range(0, NUM_ITEMS).boxed().collect(toMap(i -> i, i -> i)));
    sinkList = instance().getList(randomMapName("sinkList"));
    jobConfig = new JobConfig().setProcessingGuarantee(EXACTLY_ONCE).setSnapshotIntervalMillis(0);
    serviceFactory = sharedService(pctx -> Executors.newFixedThreadPool(8), ExecutorService::shutdown);
}
Also used : ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) Traverser(com.hazelcast.jet.Traverser) ServiceFactories.sharedService(com.hazelcast.jet.pipeline.ServiceFactories.sharedService) QuickTest(com.hazelcast.test.annotation.QuickTest) BiFunctionEx(com.hazelcast.function.BiFunctionEx) Traversers.traverseIterable(com.hazelcast.jet.Traversers.traverseIterable) Collectors.toMap(java.util.stream.Collectors.toMap) DAG(com.hazelcast.jet.core.DAG) JobStatus(com.hazelcast.jet.core.JobStatus) SimpleTestInClusterSupport(com.hazelcast.jet.SimpleTestInClusterSupport) FunctionEx(com.hazelcast.function.FunctionEx) WatermarkPolicy(com.hazelcast.jet.core.WatermarkPolicy) Pipeline(com.hazelcast.jet.pipeline.Pipeline) JobConfig(com.hazelcast.jet.config.JobConfig) START_FROM_OLDEST(com.hazelcast.jet.pipeline.JournalInitialPosition.START_FROM_OLDEST) Category(org.junit.experimental.categories.Category) Executors(java.util.concurrent.Executors) Collectors.joining(java.util.stream.Collectors.joining) Sources(com.hazelcast.jet.pipeline.Sources) List(java.util.List) Stream(java.util.stream.Stream) EventJournalMapEvent(com.hazelcast.map.EventJournalMapEvent) SinkProcessors(com.hazelcast.jet.core.processor.SinkProcessors) COMPLETED(com.hazelcast.jet.core.JobStatus.COMPLETED) IntStream(java.util.stream.IntStream) PredicateEx.alwaysTrue(com.hazelcast.function.PredicateEx.alwaysTrue) EdgeConfig(com.hazelcast.jet.config.EdgeConfig) BeforeClass(org.junit.BeforeClass) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) DEFAULT_MAX_CONCURRENT_OPS(com.hazelcast.jet.pipeline.GeneralStage.DEFAULT_MAX_CONCURRENT_OPS) TestUtil.throttle(com.hazelcast.jet.core.TestUtil.throttle) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) ServiceFactory(com.hazelcast.jet.pipeline.ServiceFactory) ProcessorSupplier(com.hazelcast.jet.core.ProcessorSupplier) ExecutorService(java.util.concurrent.ExecutorService) Job(com.hazelcast.jet.Job) Before(org.junit.Before) IList(com.hazelcast.collection.IList) Config(com.hazelcast.config.Config) SourceProcessors.streamMapP(com.hazelcast.jet.core.processor.SourceProcessors.streamMapP) Util.toList(com.hazelcast.jet.impl.util.Util.toList) Assert.assertNotNull(org.junit.Assert.assertNotNull) EXACTLY_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE) Sinks(com.hazelcast.jet.pipeline.Sinks) Traversers.traverseItems(com.hazelcast.jet.Traversers.traverseItems) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Vertex(com.hazelcast.jet.core.Vertex) EventTimePolicy.eventTimePolicy(com.hazelcast.jet.core.EventTimePolicy.eventTimePolicy) RUNNING(com.hazelcast.jet.core.JobStatus.RUNNING) Assert.assertEquals(org.junit.Assert.assertEquals) IMap(com.hazelcast.map.IMap) Edge.between(com.hazelcast.jet.core.Edge.between) JobConfig(com.hazelcast.jet.config.JobConfig) Before(org.junit.Before)

Example 2 with EXACTLY_ONCE

use of com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE in project hazelcast by hazelcast.

the class JmsSourceIntegrationTestBase method stressTest.

private void stressTest(boolean graceful, ProcessingGuarantee maxGuarantee, boolean useTopic) throws Exception {
    lastListInStressTest = null;
    final int MESSAGE_COUNT = 4_000;
    Pipeline p = Pipeline.create();
    String destName = "queue-" + counter++;
    JmsSourceBuilder sourceBuilder;
    if (useTopic) {
        sourceBuilder = Sources.jmsTopicBuilder(getConnectionFactory()).sharedConsumer(true).consumerFn(s -> s.createSharedDurableConsumer(s.createTopic(destName), "foo-consumer"));
        // create the durable subscriber now so that it doesn't lose the initial messages
        try (Connection conn = getConnectionFactory().get().createConnection()) {
            conn.setClientID("foo-client-id");
            try (Session sess = conn.createSession(false, DUPS_OK_ACKNOWLEDGE)) {
                sess.createDurableSubscriber(sess.createTopic(destName), "foo-consumer");
            }
        }
    } else {
        sourceBuilder = Sources.jmsQueueBuilder(getConnectionFactory()).destinationName(destName);
    }
    p.readFrom(sourceBuilder.maxGuarantee(maxGuarantee).build(msg -> Long.parseLong(((TextMessage) msg).getText()))).withoutTimestamps().peek().mapStateful(CopyOnWriteArrayList<Long>::new, (list, item) -> {
        lastListInStressTest = list;
        list.add(item);
        return null;
    }).writeTo(Sinks.logger());
    Job job = instance().getJet().newJob(p, new JobConfig().setProcessingGuarantee(ProcessingGuarantee.EXACTLY_ONCE).setSnapshotIntervalMillis(50));
    assertJobStatusEventually(job, RUNNING);
    // start a producer that will produce MESSAGE_COUNT messages on the background to the queue, 1000 msgs/s
    @SuppressWarnings("rawtypes") Future producerFuture = spawn(() -> {
        try (Connection connection = getConnectionFactory().get().createConnection();
            Session session = connection.createSession(false, AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(useTopic ? session.createTopic(destName) : session.createQueue(destName))) {
            long startTime = System.nanoTime();
            for (int i = 0; i < MESSAGE_COUNT; i++) {
                producer.send(session.createTextMessage(String.valueOf(i)));
                Thread.sleep(Math.max(0, i - NANOSECONDS.toMillis(System.nanoTime() - startTime)));
            }
        } catch (Exception e) {
            throw sneakyThrow(e);
        }
    });
    int iteration = 0;
    JobRepository jr = new JobRepository(instance());
    waitForFirstSnapshot(jr, job.getId(), 20, true);
    while (!producerFuture.isDone()) {
        Thread.sleep(ThreadLocalRandom.current().nextInt(200));
        // We also do it before the first restart to workaround https://issues.apache.org/jira/browse/ARTEMIS-2546
        if (iteration++ % 3 == 0) {
            waitForNextSnapshot(jr, job.getId(), 20, true);
        }
        ((JobProxy) job).restart(graceful);
        assertJobStatusEventually(job, RUNNING);
    }
    // call for the side-effect of throwing if the producer failed
    producerFuture.get();
    assertTrueEventually(() -> {
        Map<Long, Long> counts = lastListInStressTest.stream().collect(Collectors.groupingBy(Function.identity(), TreeMap::new, Collectors.counting()));
        for (long i = 0; i < MESSAGE_COUNT; i++) {
            counts.putIfAbsent(i, 0L);
        }
        String countsStr = "counts: " + counts;
        if (maxGuarantee == NONE) {
            // we don't assert anything and only wait little more and check that the job didn't fail
            sleepSeconds(1);
        } else {
            // in EXACTLY_ONCE the list must have each item exactly once
            // in AT_LEAST_ONCE the list must have each item at least once
            assertTrue(countsStr, counts.values().stream().allMatch(cnt -> maxGuarantee == EXACTLY_ONCE ? cnt == 1 : cnt > 0));
        }
        logger.info(countsStr);
    }, 30);
    assertEquals(job.getStatus(), RUNNING);
}
Also used : AggregateOperations.counting(com.hazelcast.jet.aggregate.AggregateOperations.counting) Mockito.doThrow(org.mockito.Mockito.doThrow) Session(javax.jms.Session) Future(java.util.concurrent.Future) WindowDefinition.tumbling(com.hazelcast.jet.pipeline.WindowDefinition.tumbling) Map(java.util.Map) Assert.fail(org.junit.Assert.fail) MessageProducer(javax.jms.MessageProducer) JobStatus(com.hazelcast.jet.core.JobStatus) SimpleTestInClusterSupport(com.hazelcast.jet.SimpleTestInClusterSupport) FunctionEx(com.hazelcast.function.FunctionEx) Pipeline(com.hazelcast.jet.pipeline.Pipeline) JobConfig(com.hazelcast.jet.config.JobConfig) PredicateEx.alwaysFalse(com.hazelcast.function.PredicateEx.alwaysFalse) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Instant(java.time.Instant) DUPS_OK_ACKNOWLEDGE(javax.jms.Session.DUPS_OK_ACKNOWLEDGE) JMSException(javax.jms.JMSException) Collectors(java.util.stream.Collectors) SupplierEx(com.hazelcast.function.SupplierEx) ZoneId(java.time.ZoneId) Sources(com.hazelcast.jet.pipeline.Sources) List(java.util.List) MessageConsumer(javax.jms.MessageConsumer) Assert.assertFalse(org.junit.Assert.assertFalse) WindowResult(com.hazelcast.jet.datamodel.WindowResult) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeClass(org.junit.BeforeClass) NANOSECONDS(java.util.concurrent.TimeUnit.NANOSECONDS) AUTO_ACKNOWLEDGE(javax.jms.Session.AUTO_ACKNOWLEDGE) MINUTES(java.util.concurrent.TimeUnit.MINUTES) JobProxy(com.hazelcast.jet.impl.JobProxy) StreamSource(com.hazelcast.jet.pipeline.StreamSource) ExceptionUtil.sneakyThrow(com.hazelcast.jet.impl.util.ExceptionUtil.sneakyThrow) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) Function(java.util.function.Function) ArrayList(java.util.ArrayList) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) MapWatermarksToString.mapWatermarksToString(com.hazelcast.jet.core.TestProcessors.MapWatermarksToString.mapWatermarksToString) JmsSourceBuilder(com.hazelcast.jet.pipeline.JmsSourceBuilder) Message(javax.jms.Message) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) Job(com.hazelcast.jet.Job) Before(org.junit.Before) IList(com.hazelcast.collection.IList) JobRepository(com.hazelcast.jet.impl.JobRepository) Connection(javax.jms.Connection) TextMessage(javax.jms.TextMessage) EXACTLY_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE) Sinks(com.hazelcast.jet.pipeline.Sinks) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) NONE(com.hazelcast.jet.config.ProcessingGuarantee.NONE) TreeMap(java.util.TreeMap) JmsTestUtil.consumeMessages(com.hazelcast.jet.impl.connector.JmsTestUtil.consumeMessages) RUNNING(com.hazelcast.jet.core.JobStatus.RUNNING) ProcessingGuarantee(com.hazelcast.jet.config.ProcessingGuarantee) AT_LEAST_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.AT_LEAST_ONCE) ConnectionFactory(javax.jms.ConnectionFactory) Assert.assertEquals(org.junit.Assert.assertEquals) Connection(javax.jms.Connection) MapWatermarksToString.mapWatermarksToString(com.hazelcast.jet.core.TestProcessors.MapWatermarksToString.mapWatermarksToString) JobRepository(com.hazelcast.jet.impl.JobRepository) JmsSourceBuilder(com.hazelcast.jet.pipeline.JmsSourceBuilder) JobConfig(com.hazelcast.jet.config.JobConfig) JMSException(javax.jms.JMSException) Pipeline(com.hazelcast.jet.pipeline.Pipeline) JobProxy(com.hazelcast.jet.impl.JobProxy) Future(java.util.concurrent.Future) MessageProducer(javax.jms.MessageProducer) Job(com.hazelcast.jet.Job) Session(javax.jms.Session)

Example 3 with EXACTLY_ONCE

use of com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE in project hazelcast by hazelcast.

the class SourceBuilderTest method test_nonFaultTolerantSource_processingGuaranteeOn.

@Test
public void test_nonFaultTolerantSource_processingGuaranteeOn() {
    StreamSource<Integer> source = SourceBuilder.stream("src", procCtx -> "foo").<Integer>fillBufferFn((ctx, buffer) -> {
        buffer.add(0);
        Thread.sleep(100);
    }).build();
    Pipeline p = Pipeline.create();
    IList<Integer> result = hz().getList("result-" + UuidUtil.newUnsecureUuidString());
    p.readFrom(source).withoutTimestamps().writeTo(Sinks.list(result));
    Job job = hz().getJet().newJob(p, new JobConfig().setProcessingGuarantee(EXACTLY_ONCE).setSnapshotIntervalMillis(100));
    JobRepository jr = new JobRepository(hz());
    waitForFirstSnapshot(jr, job.getId(), 10, true);
    job.restart();
    assertJobStatusEventually(job, JobStatus.RUNNING);
    int currentSize = result.size();
    assertTrueEventually(() -> assertTrue(result.size() > currentSize), 5);
}
Also used : IntStream(java.util.stream.IntStream) Socket(java.net.Socket) NANOSECONDS(java.util.concurrent.TimeUnit.NANOSECONDS) ArrayList(java.util.ArrayList) ServerSocket(java.net.ServerSocket) WindowDefinition.tumbling(com.hazelcast.jet.pipeline.WindowDefinition.tumbling) Map(java.util.Map) UuidUtil(com.hazelcast.internal.util.UuidUtil) OutputStreamWriter(java.io.OutputStreamWriter) JobStatus(com.hazelcast.jet.core.JobStatus) Job(com.hazelcast.jet.Job) IList(com.hazelcast.collection.IList) JobRepository(com.hazelcast.jet.impl.JobRepository) PrintWriter(java.io.PrintWriter) FunctionEx(com.hazelcast.function.FunctionEx) LongStream(java.util.stream.LongStream) Iterator(java.util.Iterator) EXACTLY_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE) JobConfig(com.hazelcast.jet.config.JobConfig) FileWriter(java.io.FileWriter) AggregateOperations(com.hazelcast.jet.aggregate.AggregateOperations) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) InputStreamReader(java.io.InputStreamReader) Collectors(java.util.stream.Collectors) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) Serializable(java.io.Serializable) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ToLongFunctionEx(com.hazelcast.function.ToLongFunctionEx) Assert.assertFalse(org.junit.Assert.assertFalse) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) Assert.assertEquals(org.junit.Assert.assertEquals) WindowResult(com.hazelcast.jet.datamodel.WindowResult) Job(com.hazelcast.jet.Job) JobRepository(com.hazelcast.jet.impl.JobRepository) JobConfig(com.hazelcast.jet.config.JobConfig) Test(org.junit.Test)

Example 4 with EXACTLY_ONCE

use of com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE in project hazelcast by hazelcast.

the class JmsSourceIntegration_NonSharedClusterTest method when_memberTerminated_then_transactionsRolledBack.

@Test
public void when_memberTerminated_then_transactionsRolledBack() throws Exception {
    HazelcastInstance instance1 = createHazelcastInstance();
    HazelcastInstance instance2 = createHazelcastInstance();
    // use higher number of messages so that each of the parallel processors gets some
    JmsTestUtil.sendMessages(getConnectionFactory(), "queue", true, MESSAGE_COUNT);
    Pipeline p = Pipeline.create();
    IList<String> sinkList = instance1.getList("sinkList");
    p.readFrom(Sources.jmsQueueBuilder(JmsSourceIntegration_NonSharedClusterTest::getConnectionFactory).destinationName("queue").build(msg -> ((TextMessage) msg).getText())).withoutTimestamps().writeTo(Sinks.list(sinkList));
    instance1.getJet().newJob(p, new JobConfig().setProcessingGuarantee(EXACTLY_ONCE).setSnapshotIntervalMillis(DAYS.toMillis(1)));
    assertTrueEventually(() -> assertEquals("expected items not in sink", MESSAGE_COUNT, sinkList.size()), 20);
    // Now forcefully shut down the second member. The terminated member
    // will NOT roll back its transaction. We'll assert that the
    // transactions with processorIndex beyond the current total
    // parallelism are rolled back. We assert that each item is emitted
    // twice, if this was wrong, the items in the non-rolled-back
    // transaction will be stalled and only emitted once, they will be
    // emitted after the default Artemis timeout of 5 minutes.
    instance2.getLifecycleService().terminate();
    assertTrueEventually(() -> assertEquals("items should be emitted twice", MESSAGE_COUNT * 2, sinkList.size()), 30);
}
Also used : ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) NOT_RUNNING(com.hazelcast.jet.core.JobStatus.NOT_RUNNING) RunWith(org.junit.runner.RunWith) ActiveMQConnectionFactory(org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory) HazelcastSerialClassRunner(com.hazelcast.test.HazelcastSerialClassRunner) MapConfig(com.hazelcast.config.MapConfig) Assert.assertThat(org.junit.Assert.assertThat) Arrays.asList(java.util.Arrays.asList) STARTING(com.hazelcast.jet.core.JobStatus.STARTING) DAYS(java.util.concurrent.TimeUnit.DAYS) ClassRule(org.junit.ClassRule) Matchers.isIn(org.hamcrest.Matchers.isIn) Job(com.hazelcast.jet.Job) IList(com.hazelcast.collection.IList) JobRepository(com.hazelcast.jet.impl.JobRepository) Config(com.hazelcast.config.Config) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Pipeline(com.hazelcast.jet.pipeline.Pipeline) JetTestSupport(com.hazelcast.jet.core.JetTestSupport) TextMessage(javax.jms.TextMessage) EXACTLY_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE) JobConfig(com.hazelcast.jet.config.JobConfig) Sinks(com.hazelcast.jet.pipeline.Sinks) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest) Category(org.junit.experimental.categories.Category) AMapStore(com.hazelcast.client.map.helpers.AMapStore) EmbeddedActiveMQResource(org.apache.activemq.artemis.junit.EmbeddedActiveMQResource) NONE(com.hazelcast.jet.config.ProcessingGuarantee.NONE) Serializable(java.io.Serializable) Sources(com.hazelcast.jet.pipeline.Sources) MapStoreConfig(com.hazelcast.config.MapStoreConfig) RUNNING(com.hazelcast.jet.core.JobStatus.RUNNING) ProcessingGuarantee(com.hazelcast.jet.config.ProcessingGuarantee) AT_LEAST_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.AT_LEAST_ONCE) ConnectionFactory(javax.jms.ConnectionFactory) Assert.assertEquals(org.junit.Assert.assertEquals) HazelcastInstance(com.hazelcast.core.HazelcastInstance) TextMessage(javax.jms.TextMessage) JobConfig(com.hazelcast.jet.config.JobConfig) Pipeline(com.hazelcast.jet.pipeline.Pipeline) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 5 with EXACTLY_ONCE

use of com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE in project hazelcast by hazelcast.

the class SinkStressTestUtil method test_withRestarts.

public static void test_withRestarts(@Nonnull HazelcastInstance instance, @Nonnull ILogger logger, @Nonnull Sink<Integer> sink, boolean graceful, boolean exactlyOnce, @Nonnull SupplierEx<List<Integer>> actualItemsSupplier) {
    int numItems = 1000;
    Pipeline p = Pipeline.create();
    p.readFrom(SourceBuilder.stream("src", procCtx -> new int[] { procCtx.globalProcessorIndex() == 0 ? 0 : Integer.MAX_VALUE }).<Integer>fillBufferFn((ctx, buf) -> {
        if (ctx[0] < numItems) {
            buf.add(ctx[0]++);
            sleepMillis(5);
        }
    }).distributed(1).createSnapshotFn(ctx -> ctx[0] < Integer.MAX_VALUE ? ctx[0] : null).restoreSnapshotFn((ctx, state) -> ctx[0] = ctx[0] != Integer.MAX_VALUE ? state.get(0) : Integer.MAX_VALUE).build()).withoutTimestamps().peek().writeTo(sink);
    JobConfig config = new JobConfig().setProcessingGuarantee(exactlyOnce ? EXACTLY_ONCE : AT_LEAST_ONCE).setSnapshotIntervalMillis(50);
    JobProxy job = (JobProxy) instance.getJet().newJob(p, config);
    long endTime = System.nanoTime() + SECONDS.toNanos(TEST_TIMEOUT_SECONDS);
    int lastCount = 0;
    String expectedRows = IntStream.range(0, numItems).mapToObj(i -> i + (exactlyOnce ? "=1" : "")).collect(joining("\n"));
    // We'll restart once, then restart again after a short sleep (possibly during initialization),
    // and then assert some output so that the test isn't constantly restarting without any progress
    Long lastExecutionId = null;
    for (; ; ) {
        lastExecutionId = assertJobRunningEventually(instance, job, lastExecutionId);
        job.restart(graceful);
        lastExecutionId = assertJobRunningEventually(instance, job, lastExecutionId);
        sleepMillis(ThreadLocalRandom.current().nextInt(400));
        job.restart(graceful);
        try {
            List<Integer> actualItems;
            Set<Integer> distinctActualItems;
            do {
                actualItems = actualItemsSupplier.get();
                distinctActualItems = new HashSet<>(actualItems);
            } while (distinctActualItems.size() < Math.min(numItems, 100 + lastCount) && System.nanoTime() < endTime);
            lastCount = distinctActualItems.size();
            logger.info("number of committed items in the sink so far: " + lastCount);
            if (exactlyOnce) {
                String actualItemsStr = actualItems.stream().collect(groupingBy(identity(), TreeMap::new, counting())).entrySet().stream().map(Object::toString).collect(joining("\n"));
                assertEquals(expectedRows, actualItemsStr);
            } else {
                assertEquals(expectedRows, distinctActualItems.stream().map(Objects::toString).collect(joining("\n")));
            }
            // if content matches, break the loop. Otherwise restart and try again
            break;
        } catch (AssertionError e) {
            if (System.nanoTime() >= endTime) {
                throw e;
            }
        }
    }
}
Also used : IntStream(java.util.stream.IntStream) Collectors.counting(java.util.stream.Collectors.counting) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) JobProxy(com.hazelcast.jet.impl.JobProxy) HashSet(java.util.HashSet) ILogger(com.hazelcast.logging.ILogger) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) Nonnull(javax.annotation.Nonnull) HazelcastInstance(com.hazelcast.core.HazelcastInstance) HazelcastTestSupport.sleepMillis(com.hazelcast.test.HazelcastTestSupport.sleepMillis) Pipeline(com.hazelcast.jet.pipeline.Pipeline) EXACTLY_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE) JobConfig(com.hazelcast.jet.config.JobConfig) Set(java.util.Set) SupplierEx(com.hazelcast.function.SupplierEx) Collectors.joining(java.util.stream.Collectors.joining) Objects(java.util.Objects) List(java.util.List) TreeMap(java.util.TreeMap) JetTestSupport.assertJobRunningEventually(com.hazelcast.jet.core.JetTestSupport.assertJobRunningEventually) Function.identity(java.util.function.Function.identity) SourceBuilder(com.hazelcast.jet.pipeline.SourceBuilder) AT_LEAST_ONCE(com.hazelcast.jet.config.ProcessingGuarantee.AT_LEAST_ONCE) Sink(com.hazelcast.jet.pipeline.Sink) SECONDS(java.util.concurrent.TimeUnit.SECONDS) Assert.assertEquals(org.junit.Assert.assertEquals) JobConfig(com.hazelcast.jet.config.JobConfig) Pipeline(com.hazelcast.jet.pipeline.Pipeline) JobProxy(com.hazelcast.jet.impl.JobProxy) Objects(java.util.Objects)

Aggregations

EXACTLY_ONCE (com.hazelcast.jet.config.ProcessingGuarantee.EXACTLY_ONCE)17 JobConfig (com.hazelcast.jet.config.JobConfig)16 Assert.assertEquals (org.junit.Assert.assertEquals)16 Test (org.junit.Test)15 Job (com.hazelcast.jet.Job)14 Assert.assertTrue (org.junit.Assert.assertTrue)13 JobRepository (com.hazelcast.jet.impl.JobRepository)12 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)12 Map (java.util.Map)12 Category (org.junit.experimental.categories.Category)12 Before (org.junit.Before)11 List (java.util.List)10 Config (com.hazelcast.config.Config)9 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 FunctionEx (com.hazelcast.function.FunctionEx)9 Edge.between (com.hazelcast.jet.core.Edge.between)9 RUNNING (com.hazelcast.jet.core.JobStatus.RUNNING)9 Collectors (java.util.stream.Collectors)9 IntStream (java.util.stream.IntStream)9 IList (com.hazelcast.collection.IList)8