[ 
https://issues.apache.org/jira/browse/NIFI-4164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16346714#comment-16346714
 ] 

ASF GitHub Bot commented on NIFI-4164:
--------------------------------------

Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1997#discussion_r165033904
  
    --- Diff: 
nifi-nar-bundles/nifi-simulator-bundle/nifi-simulator-processors/src/test/java/com/apache/nifi/processors/simulator/GenerateTimeSeriesFlowfileTest.java
 ---
    @@ -0,0 +1,72 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package com.apache.nifi.processors.simulator;
    +
    +import org.apache.nifi.util.TestRunner;
    +import org.apache.nifi.util.TestRunners;
    +import org.junit.Before;
    +import org.junit.Test;
    +
    +
    +public class GenerateTimeSeriesFlowfileTest {
    +
    +    private TestRunner testRunner;
    +
    +    @Before
    +    public void init() {
    +        testRunner = 
TestRunners.newTestRunner(GenerateTimeSeriesFlowFile.class);
    +    }
    +
    +    @Test
    +    public void testGenerateTimeSeries() {
    +        TestRunner runner = TestRunners.newTestRunner(new 
GenerateTimeSeriesFlowFile());
    +        runner.setProperty(GenerateTimeSeriesFlowFile.SIMULATOR_CONFIG, 
getClass().getResource("/configs/basicConfig.json").getPath());
    +        runner.assertValid();
    +
    +        runner.run();
    +
    +        runner.assertTransferCount(GenerateTimeSeriesFlowFile.SUCCESS, 1);
    +    }
    +
    +    @Test
    +    public void testInvalidConfig() {
    +        TestRunner runner = TestRunners.newTestRunner(new 
GenerateTimeSeriesFlowFile());
    +        runner.setProperty(GenerateTimeSeriesFlowFile.SIMULATOR_CONFIG, 
"/my/invalid/path");
    +        runner.assertNotValid();
    +    }
    +
    +    @Test
    +    public void testFalseHeaderCreation() {
    +        TestRunner runner = TestRunners.newTestRunner(new 
GenerateTimeSeriesFlowFile());
    +        runner.setProperty(GenerateTimeSeriesFlowFile.PRINT_HEADER, 
"false");
    +        runner.setProperty(GenerateTimeSeriesFlowFile.SIMULATOR_CONFIG, 
getClass().getResource("/configs/unitTestConfig.json").getPath());
    +        runner.run();
    +        runner.assertTransferCount(GenerateTimeSeriesFlowFile.SUCCESS, 1);
    +        
runner.getFlowFilesForRelationship(GenerateTimeSeriesFlowFile.SUCCESS).get(0).assertContentEquals("test,2016-01-01T00:00:00.000,17.5");
    --- End diff --
    
    You should subclass the processor if you need to inject that timestamp in 
there somehow.


> Realistic Time Series Processor Simulator
> -----------------------------------------
>
>                 Key: NIFI-4164
>                 URL: https://issues.apache.org/jira/browse/NIFI-4164
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Extensions
>            Reporter: Chris Herrera
>            Assignee: Chris Herrera
>            Priority: Minor
>              Labels: features
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> In order to validate several flows that deal with sensor data, it would be 
> good to have a built in time series simulator processor that generates data 
> and can send it out via a flow file.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to