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

    https://github.com/apache/nifi/pull/2723#discussion_r192610748
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/test/groovy/org/apache/nifi/lookup/RestLookupServiceIT.groovy
 ---
    @@ -106,6 +106,37 @@ class RestLookupServiceIT {
             }
         }
     
    +    @Test
    +    void testHeaders() {
    +        runner.disableControllerService(lookupService)
    +        runner.setProperty(lookupService, "header.X-USER", "jane.doe")
    +        runner.setProperty(lookupService, "header.X-PASS", "testing7890")
    +        runner.enableControllerService(lookupService)
    +
    +        TestServer server = new TestServer()
    +        ServletHandler handler = new ServletHandler()
    +        handler.addServletWithMapping(SimpleJson.class, "/simple")
    +        server.addHandler(handler)
    +        try {
    +            server.startServer()
    +
    +            def coordinates = [
    +                "schema.name": "simple",
    +                "endpoint": server.url + "/simple",
    --- End diff --
    
    @MikeThomsen I've replied to your question on the dev ML. I think 
`endpoint` property can be used both cases where user want to use EL or just a 
literal endpoint. Because Query.prepare method can return the configured 
literal String if it does not contain any EL.
    
    ```
            final Map<String, String> map = Collections.singletonMap("name", 
"John Smith");
            PreparedQuery query = Query.prepare("${name}-${name:length()}");
            String result = query.evaluateExpressions(map, null);
            System.out.println(result);
    
            query = Query.prepare("name-name:length()");
            result = query.evaluateExpressions(map, null);
            System.out.println(result);
            final Map<String, String> map = Collections.singletonMap("name", 
"John Smith");
            PreparedQuery query = Query.prepare("${name}-${name:length()}");
            String result = query.evaluateExpressions(map, null);
            System.out.println(result);
    
            query = Query.prepare("name-name:length()");
            result = query.evaluateExpressions(map, null);
            System.out.println(result);
    ```
    
    The code prints:
    ```
    John Smith-10
    name-name:length()
    ```


---

Reply via email to