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

    https://github.com/apache/brooklyn-server/pull/392#discussion_r85093511
  
    --- Diff: 
camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
 ---
    @@ -52,7 +53,29 @@ public Object next() {
             if (index >= expression.length())
                 throw new IllegalStateException("Unexpected end of expression 
to parse, looking for content since position "+start);
             
    -        if (expression.charAt(index)=='"') {
    +        String multilineTemplatePrefix = "$brooklyn:template";
    +        if (expression.regionMatches(index, multilineTemplatePrefix, 0, 
multilineTemplatePrefix.length())) {
    +            // skip to next line
    +            char c;
    +            do {
    +                c = expression.charAt(index);
    +                index++;
    +            } while(c != '\n' && index<expression.length());
    +            if (index < expression.length()) {
    +                int stringStart = index;
    +                index = expression.length();
    +                return new QuotedString('"' + 
JavaStringEscapes.escapeJavaString(expression.substring(stringStart, index)) + 
'"');
    --- End diff --
    
    Need to skip trailing newline/whitespace on the expression: I tried 
updating the test to add further text:
    
    ```java
        protected Entity entityWithMultilineTemplatedString() throws Exception {
            return setupAndCheckTestEntityInBasicYamlWith(
                    "  id: x",
                    "  brooklyn.config:",
                    "    test.sourceName: hello world",
                    "    test.confName: |",
                    "      $brooklyn:template",
                    "      ${config['test.sourceName']}",
                    "    test.other: something else");
        }
    ```
    
    and it breaks with 
    ```
    java.lang.AssertionError: expected [hello world] but found [hello world
    ]
    ```


---
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