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

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

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

    https://github.com/apache/nifi/pull/563#discussion_r69931690
  
    --- Diff: 
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/test/java/org/apache/nifi/processors/kafka/TestGetKafka.java
 ---
    @@ -166,4 +170,44 @@ public MessageAndMetadata answer(InvocationOnMock 
invocation) throws Throwable {
             }
         }
     
    +    @Test
    +    public void testGetState() throws Exception {
    +        final GetKafka processor = new GetKafka();
    +        final TestRunner runner = TestRunners.newTestRunner(processor);
    +
    +        assertNull("State should be null when required properties are not 
specified.", processor.getState());
    +
    +        runner.setProperty(GetKafka.ZOOKEEPER_CONNECTION_STRING, 
"0.0.0.0:invalid-port");
    +        runner.setProperty(GetKafka.TOPIC, "testX");
    +
    +        assertNull("State should be null when required properties are not 
specified.", processor.getState());
    +
    +        runner.setProperty(GetKafka.GROUP_ID, "consumer-group-id");
    +
    +        try {
    +            processor.getState();
    +            fail("The processor should try to access Zookeeper and should 
fail since it can not connect.");
    +        } catch (IOException e) {
    +        }
    +    }
    +
    +    @Test
    +    public void testClearState() throws Exception {
    +        final GetKafka processor = new GetKafka();
    +        final TestRunner runner = TestRunners.newTestRunner(processor);
    +
    +        // Clear doesn't do anything until required properties are set.
    +        processor.clear();
    +
    +        runner.setProperty(GetKafka.ZOOKEEPER_CONNECTION_STRING, 
"0.0.0.0:invalid-port");
    +        runner.setProperty(GetKafka.TOPIC, "testX");
    +        runner.setProperty(GetKafka.GROUP_ID, "consumer-group-id");
    +
    +        try {
    +            processor.getState();
    --- End diff --
    
    Totally a mistake, thanks! Addressed.


> State management for processors whose states are managed externally
> -------------------------------------------------------------------
>
>                 Key: NIFI-2078
>                 URL: https://issues.apache.org/jira/browse/NIFI-2078
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Koji Kawamura
>            Assignee: Koji Kawamura
>             Fix For: 1.0.0
>
>
> Inherently by the nature of a given processor it may involve state managed by 
> itself (using nifi state management), or can be managed by some external 
> service it interacts with (kafka's offset), and theoretically some might have 
> both going on. With the new state management, we're giving users a way to 
> reset state managed by nifi for a given processor. But it doesnt apply to 
> those processors who have external state.
> we should consider offering a way to reset state that allows a processor to 
> call out to whatever external store it impacts



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to