当前位置: 首页>>代码示例>>Java>>正文


Java TestRunner.setValidateExpressionUsage方法代码示例

本文整理汇总了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());
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:23,代码来源:DelayProcessorTest.java

示例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();
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:9,代码来源:DelayProcessorTest.java

示例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();
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:9,代码来源:DelayProcessorTest.java

示例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());
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:36,代码来源:DelayProcessorTest.java


注:本文中的org.apache.nifi.util.TestRunner.setValidateExpressionUsage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。