public void executeTest() throws Throwable { runner.executeTest(); }
/** * Getter for the timeout interval * after the test execution gets stopped. * * @return timeout in milliseconds */ public Long getTimeoutInterval() { return runner.getTimeoutInterval(); }
/** * This method can be used to check if the environment has been * stopped prematurely by e.g. a timeout. * * @return true if has been stopped forcefully. */ public Boolean hasBeenStopped() { return runner.hasBeenStopped(); }
/** * Creates a TestSink to verify the output of your stream. The environment will register a port * * @param verifier which will be used to verify the received records * @param <IN> type of the input * @return the created sink. */ public <IN> TestSink<IN> createTestSink(OutputVerifier<IN> verifier, VerifyFinishedTrigger trigger) { int instance = runner.registerListener(verifier, trigger); TestSink<IN> sink = new TestSink<IN>(instance, runner.getRingBuffer()); return sink; }
disruptor.start(); stopTimer.schedule(stopExecution, timeout); runLocalCluster(); cleanUp(); cancelListener(); return; cleanUp();
/** * Setter for the timeout interval * after the test execution gets stopped. * * @param interval in milliseconds. */ public void setTimeoutInterval(long interval) { runner.setTimeoutInterval(interval); }
private synchronized void cleanUp() { if(!finished.get()) { disruptor.shutdown(); cancelListener(); finished.set(true); } shutdownLocalCluster(); stopTimer.cancel(); stopTimer.purge(); }
private synchronized void runLocalCluster() throws Throwable { try { running.set(true); cluster.start(); executeEnvironment(); finished.set(true); cleanUp(); } catch(JobTimeoutException | IllegalStateException e) { //cluster has been shutdown forcefully, most likely by a timeout. cleanUp(); failed.set(true); } }
/** * Stops the execution of the test. * <p> * Shutting the local cluster down will notify the sockets when the sinks are closed. Thus terminating the execution gracefully. * </p> */ public synchronized void stopExecution() { stopped = true; //execution has failed no cleanup necessary if(failed.get()) { return; } if(!finished.get()) { //run is not finished and has to be stopped forcefully cleanUp(); } }
VerifyFinishedTrigger<? super OUT> trigger) { int instance = getNextInstance();
/** * Creates a TestOutputFormat to verify the output. * The environment will register a port * * @param verifier which will be used to verify the received records * @param <IN> type of the input * @return the created sink. */ public <IN> TestOutputFormat<IN> createTestOutputFormat(OutputVerifier<IN> verifier, VerifyFinishedTrigger trigger) { int instance = runner.registerListener(verifier, trigger); TestOutputFormat<IN> format = new TestOutputFormat<IN>(instance, runner.getRingBuffer()); return format; }
/** * Setter for the timeout interval after the test execution gets stopped. * * @param interval in milliseconds. */ public void setTimeoutInterval(long interval) { runner.setTimeoutInterval(interval); }
/** * Creates a TestSink to verify your the output of your stream. Using a {@link OutputVerifier} * * @param verifier {@link OutputVerifier} which will be used to verify the received records. * @param <IN> type of the input * @return the created sink. */ public <IN> TestSink<IN> createTestSink(OutputVerifier<IN> verifier) { VerifyFinishedTrigger trigger = new DefaultTestTrigger(); int instance = runner.registerListener(verifier, trigger); TestSink<IN> sink = new TestSink<IN>(instance, runner.getRingBuffer()); return sink; }
/** * This method can be used to check if the environment has been stopped prematurely by e.g. a timeout. * * @return true if has been stopped forcefully. */ public Boolean hasBeenStopped() { return runner.hasBeenStopped(); }
/** * Getter for the timeout interval after the test execution gets stopped. * * @return timeout in milliseconds */ public Long getTimeoutInterval() { return runner.getTimeoutInterval(); }
public void executeTest() throws Throwable { runner.executeTest(); }
/** * Creates a TestOutputFormat to verify the output. * Using a {@link OutputVerifier} * * @param verifier {@link OutputVerifier} which will be * used to verify the received records. * @param <IN> type of the input * @return the created {@link TestOutputFormat}. */ public <IN> TestOutputFormat<IN> createTestOutputFormat(OutputVerifier<IN> verifier) { VerifyFinishedTrigger trigger = new DefaultTestTrigger(); int instance = runner.registerListener(verifier, trigger); TestOutputFormat<IN> format = new TestOutputFormat<IN>(instance, runner.getRingBuffer()); return format; }