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

    https://github.com/apache/nifi/pull/1774#discussion_r116323174
  
    --- Diff: 
nifi-nar-bundles/nifi-slack-bundle/nifi-slack-processors/src/test/java/org/apache/nifi/processors/slack/PutSlackTest.java
 ---
    @@ -102,6 +106,81 @@ public void testInvalidIconEmoji() {
         }
     
         @Test
    +    public void testInvalidDynamicProperties() {
    +        testRunner.setProperty(PutSlack.WEBHOOK_URL, server.getUrl());
    +        testRunner.setProperty(PutSlack.WEBHOOK_TEXT, WEBHOOK_TEST_TEXT);
    +        PropertyDescriptor dynamicProp = new PropertyDescriptor.Builder()
    +                .dynamic(true)
    +                .name("foo")
    +                .build();
    +        testRunner.setProperty(dynamicProp, "{\"a\": a}");
    +
    +        testRunner.enqueue("{}".getBytes());
    +        testRunner.run(1);
    +        testRunner.assertTransferCount(PutSlack.REL_FAILURE, 1);
    +    }
    +
    +    @Test
    +    public void testValidDynamicProperties() {
    +        testRunner.setProperty(PutSlack.WEBHOOK_URL, server.getUrl());
    +        testRunner.setProperty(PutSlack.WEBHOOK_TEXT, WEBHOOK_TEST_TEXT);
    +        PropertyDescriptor dynamicProp = new PropertyDescriptor.Builder()
    +                .dynamic(true)
    +                .name("foo")
    +                .build();
    +        testRunner.setProperty(dynamicProp, "{\"a\": \"a\"}");
    +
    +        testRunner.enqueue("{}".getBytes());
    +        testRunner.run(1);
    +        testRunner.assertTransferCount(PutSlack.REL_FAILURE, 0);
    +    }
    +
    +    @Test
    +    public void testValidDynamicPropertiesWithExpressionLanguage() {
    +        ProcessSession session = 
testRunner.getProcessSessionFactory().createSession();
    +        FlowFile ff = session.create();
    +        Map<String, String> props = new HashMap<>();
    +        props.put("foo", "\"bar\"");
    +        props.put("ping", "pong");
    +        ff = session.putAllAttributes(ff, props);
    +
    +        testRunner.setProperty(PutSlack.WEBHOOK_URL, server.getUrl());
    +        testRunner.setProperty(PutSlack.WEBHOOK_TEXT, WEBHOOK_TEST_TEXT);
    +        PropertyDescriptor dynamicProp = new PropertyDescriptor.Builder()
    +                .dynamic(true)
    +                .name("foo")
    +                .build();
    +        testRunner.setProperty(dynamicProp, "{\"foo\": ${foo}, 
\"ping\":\"${ping}\"}");
    --- End diff --
    
    Sounds good, thanks for the clarification and additional information!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to