本文整理汇总了Java中org.apache.nifi.util.TestRunner.setValidateExpressionUsage方法的典型用法代码示例。如果您正苦于以下问题:Java TestRunner.setValidateExpressionUsage方法的具体用法?Java TestRunner.setValidateExpressionUsage怎么用?Java TestRunner.setValidateExpressionUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.nifi.util.TestRunner
的用法示例。
在下文中一共展示了TestRunner.setValidateExpressionUsage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSuccess
import org.apache.nifi.util.TestRunner; //导入方法依赖的package包/类
@Test
public void testSuccess() throws InterruptedException {
TestRunner runner = TestRunners.newTestRunner(DelayProcessor.class);
runner.setValidateExpressionUsage(false);
runner.setProperty(DelayProcessor.TIME_PERIOD, "1 sec");
runner.enqueue(new byte[0], ImmutableMap.of(CoreAttributes.FILENAME.key(), "file1"));
runner.run();
// nothing transferred, 1 file still on queue and cached
runner.assertTransferCount(DelayProcessor.REL_SUCCESS, 0);
assertEquals(1, runner.getQueueSize().getObjectCount());
assertEquals(1, ((DelayProcessor) runner.getProcessor()).delayMap.size());
// wait until delay has passed
Thread.sleep(1010);
runner.run();
// file transferred, nothing on queue, cache empty
runner.assertAllFlowFilesTransferred(DelayProcessor.REL_SUCCESS, 1);
assertEquals(0, ((DelayProcessor) runner.getProcessor()).delayMap.size());
}
示例2: testValid
import org.apache.nifi.util.TestRunner; //导入方法依赖的package包/类
@Test
public void testValid() {
TestRunner runner = TestRunners.newTestRunner(DelayProcessor.class);
runner.setValidateExpressionUsage(false);
runner.setProperty(DelayProcessor.TIME_PERIOD, "10 sec");
runner.assertValid();
}
示例3: testInvalid
import org.apache.nifi.util.TestRunner; //导入方法依赖的package包/类
@Test
public void testInvalid() {
TestRunner runner = TestRunners.newTestRunner(DelayProcessor.class);
runner.setValidateExpressionUsage(false);
runner.setProperty(DelayProcessor.TIME_PERIOD, "10 kb");
runner.assertNotValid();
}
示例4: testExpireMultipleFilesSimultaneously
import org.apache.nifi.util.TestRunner; //导入方法依赖的package包/类
@Test
public void testExpireMultipleFilesSimultaneously() throws InterruptedException {
TestRunner runner = TestRunners.newTestRunner(DelayProcessor.class);
runner.setValidateExpressionUsage(false);
runner.setProperty(DelayProcessor.TIME_PERIOD, "1 sec");
runner.enqueue(new byte[0], ImmutableMap.of(CoreAttributes.FILENAME.key(), "file1"));
runner.enqueue(new byte[0], ImmutableMap.of(CoreAttributes.FILENAME.key(), "file2"));
runner.run();
// nothing transferred, 2 files still on queue and cached
runner.assertTransferCount(DelayProcessor.REL_SUCCESS, 0);
assertEquals(2, runner.getQueueSize().getObjectCount());
assertEquals(2, ((DelayProcessor) runner.getProcessor()).delayMap.size());
runner.enqueue(new byte[0], ImmutableMap.of(CoreAttributes.FILENAME.key(), "file3"));
// wait until delay has passed
Thread.sleep(1010);
runner.run();
// 1st 2 files transferred, 3rd still on queue and cached
runner.assertAllFlowFilesTransferred(DelayProcessor.REL_SUCCESS, 2);
assertEquals(1, ((DelayProcessor) runner.getProcessor()).delayMap.size());
runner.clearTransferState();
// wait until delay has passed
Thread.sleep(1010);
runner.run();
// 3rd file now transferred, cache empty
runner.assertAllFlowFilesTransferred(DelayProcessor.REL_SUCCESS, 1);
assertEquals(0, ((DelayProcessor) runner.getProcessor()).delayMap.size());
}