use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobRepositoryTest method test_getJobRecordFromClient.
@Test
public void test_getJobRecordFromClient() {
HazelcastInstance client = createHazelcastClient();
Pipeline p = Pipeline.create();
p.readFrom(Sources.streamFromProcessor("source", ProcessorMetaSupplier.of(() -> new NoOutputSourceP()))).withoutTimestamps().writeTo(Sinks.logger());
Job job = instance.getJet().newJob(p, new JobConfig().setProcessingGuarantee(ProcessingGuarantee.EXACTLY_ONCE).setSnapshotIntervalMillis(100));
JobRepository jobRepository = new JobRepository(client);
assertTrueEventually(() -> assertNotNull(jobRepository.getJobRecord(job.getId())));
client.shutdown();
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class TopologyChangeTest method when_nonCoordinatorLeavesDuringExecution_then_clientStillGetsJobResult.
@Test
public void when_nonCoordinatorLeavesDuringExecution_then_clientStillGetsJobResult() throws Throwable {
// Given
HazelcastInstance client = createHazelcastClient();
DAG dag = new DAG().vertex(new Vertex("test", new MockPS(NoOutputSourceP::new, nodeCount)));
// When
Job job = client.getJet().newJob(dag);
NoOutputSourceP.executionStarted.await();
instances[2].getLifecycleService().terminate();
NoOutputSourceP.proceedLatch.countDown();
job.join();
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class WriteBufferedPTest method when_writeBufferedJobFailed_then_bufferDisposed.
@Test
public void when_writeBufferedJobFailed_then_bufferDisposed() throws Exception {
HazelcastInstance instance = createHazelcastInstance();
DAG dag = new DAG();
Vertex source = dag.newVertex("source", () -> new NoOutputSourceP());
Vertex sink = dag.newVertex("sink", getLoggingBufferedWriter()).localParallelism(1);
dag.edge(Edge.between(source, sink));
Job job = instance.getJet().newJob(dag);
// wait for the job to initialize
Thread.sleep(5000);
job.cancel();
assertTrueEventually(() -> assertTrue("No \"dispose\", only: " + events, events.contains("dispose")), 60);
System.out.println(events);
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class JobMetrics_NonSharedClusterTest method when_metricsCollectionOff_then_emptyMetrics.
@Test
public void when_metricsCollectionOff_then_emptyMetrics() {
Config config = smallInstanceConfig();
config.getMetricsConfig().setEnabled(false);
HazelcastInstance inst = createHazelcastInstance(config);
DAG dag = new DAG();
dag.newVertex("v1", (SupplierEx<Processor>) NoOutputSourceP::new).localParallelism(1);
Job job = inst.getJet().newJob(dag, JOB_CONFIG_WITH_METRICS);
assertTrue(job.getMetrics().metrics().isEmpty());
}
use of com.hazelcast.jet.core.TestProcessors.NoOutputSourceP in project hazelcast by hazelcast.
the class TerminalSnapshotSynchronizationTest method setup.
private Job setup(boolean snapshotting) {
HazelcastInstance[] instances = createHazelcastInstances(NODE_COUNT);
DAG dag = new DAG();
dag.newVertex("generator", () -> new NoOutputSourceP()).localParallelism(1);
JobConfig config = new JobConfig().setProcessingGuarantee(snapshotting ? EXACTLY_ONCE : NONE).setSnapshotIntervalMillis(DAYS.toMillis(1));
Job job = instances[0].getJet().newJob(dag, config);
assertJobStatusEventually(job, RUNNING);
return job;
}
Aggregations