brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] git commit: Fix XsltTransformerTest on Windows
Date Mon, 06 Oct 2014 15:31:57 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master dc7830878 -> d1a7f2eef


Fix XsltTransformerTest on Windows

Hardcoded use of "\n" fails on Windows. Switch to use line.separator
property.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/400d95f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/400d95f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/400d95f8

Branch: refs/heads/master
Commit: 400d95f803a2e867f6be98dfb84c1efa96a97a55
Parents: dc78308
Author: Richard Downer <richard.downer@cloudsoftcorp.com>
Authored: Mon Oct 6 14:28:39 2014 +0000
Committer: Richard Downer <richard.downer@cloudsoftcorp.com>
Committed: Mon Oct 6 14:28:39 2014 +0000

----------------------------------------------------------------------
 .../transformer/impl/XsltTransformerTest.java   | 122 ++++++++++---------
 1 file changed, 62 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/400d95f8/core/src/test/java/brooklyn/entity/rebind/transformer/impl/XsltTransformerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/transformer/impl/XsltTransformerTest.java
b/core/src/test/java/brooklyn/entity/rebind/transformer/impl/XsltTransformerTest.java
index 82f0287..32baff6 100644
--- a/core/src/test/java/brooklyn/entity/rebind/transformer/impl/XsltTransformerTest.java
+++ b/core/src/test/java/brooklyn/entity/rebind/transformer/impl/XsltTransformerTest.java
@@ -31,29 +31,31 @@ import com.google.common.collect.ImmutableMap;
 
 public class XsltTransformerTest {
 
+    private static String NEWLINE = System.getProperty("line.separator");
+    
     @Test
     public void testRenameType() throws Exception {
         String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameType.xslt");
         String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("old_val",
"mytype.Before", "new_val", "mytype.After"));
         String input = 
-                "<entity myattrib=\"myval\">"+"\n"+
-                "  <type myattrib2=\"myval2\">mytype.Before</type>"+"\n"+
-                "  <nested>"+"\n"+
-                "    <type myattrib3=\"myval3\">doesNotMatch</type>"+"\n"+
-                "    <type myattrib4=\"myval4\">partial.mytype.Before</type>"+"\n"+
-                "    <type myattrib5=\"myval5\">mytype.Before</type>"+"\n"+
-                "  </nested>"+"\n"+
-                "  <id>myid</id>"+"\n"+
+                "<entity myattrib=\"myval\">"+NEWLINE+
+                "  <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+
+                "  <nested>"+NEWLINE+
+                "    <type myattrib3=\"myval3\">doesNotMatch</type>"+NEWLINE+
+                "    <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NEWLINE+
+                "    <type myattrib5=\"myval5\">mytype.Before</type>"+NEWLINE+
+                "  </nested>"+NEWLINE+
+                "  <id>myid</id>"+NEWLINE+
                 "</entity>";
         String expected = 
-                "<entity myattrib=\"myval\">"+"\n"+
-                "  <type myattrib2=\"myval2\">mytype.After</type>"+"\n"+
-                "  <nested>"+"\n"+
-                "    <type myattrib3=\"myval3\">doesNotMatch</type>"+"\n"+
-                "    <type myattrib4=\"myval4\">partial.mytype.Before</type>"+"\n"+
-                "    <type myattrib5=\"myval5\">mytype.After</type>"+"\n"+
-                "  </nested>"+"\n"+
-                "  <id>myid</id>"+"\n"+
+                "<entity myattrib=\"myval\">"+NEWLINE+
+                "  <type myattrib2=\"myval2\">mytype.After</type>"+NEWLINE+
+                "  <nested>"+NEWLINE+
+                "    <type myattrib3=\"myval3\">doesNotMatch</type>"+NEWLINE+
+                "    <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NEWLINE+
+                "    <type myattrib5=\"myval5\">mytype.After</type>"+NEWLINE+
+                "  </nested>"+NEWLINE+
+                "  <id>myid</id>"+NEWLINE+
                 "</entity>";
         
         XsltTransformer transformer = new XsltTransformer(xslt);
@@ -66,36 +68,36 @@ public class XsltTransformerTest {
         String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameField.xslt");
         String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("class_name",
"MyClass", "old_val", "myFieldBefore", "new_val", "myFieldAfter"));
         String input = 
-                "<entity myattrib=\"myval\">"+"\n"+
-                "  <type myattrib2=\"myval2\">mytype.Before</type>"+"\n"+
-                "  <config>"+"\n"+
-                "    <test.conf1>"+"\n"+
-                "      <MyClass>"+"\n"+
-                "        <myFieldBefore class=\"string\">myfieldval</myFieldBefore>"+"\n"+
-                "      </MyClass>"+"\n"+
-                "    </test.conf1>"+"\n"+
-                "    <test.conf2>"+"\n"+
-                "      <MyOtherClass>"+"\n"+
-                "        <myFieldBefore class=\"string\">myfieldval</myFieldBefore>"+"\n"+
-                "      </MyOtherClass>"+"\n"+
-                "    </test.conf2>"+"\n"+
-                "  </config>"+"\n"+
+                "<entity myattrib=\"myval\">"+NEWLINE+
+                "  <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+
+                "  <config>"+NEWLINE+
+                "    <test.conf1>"+NEWLINE+
+                "      <MyClass>"+NEWLINE+
+                "        <myFieldBefore class=\"string\">myfieldval</myFieldBefore>"+NEWLINE+
+                "      </MyClass>"+NEWLINE+
+                "    </test.conf1>"+NEWLINE+
+                "    <test.conf2>"+NEWLINE+
+                "      <MyOtherClass>"+NEWLINE+
+                "        <myFieldBefore class=\"string\">myfieldval</myFieldBefore>"+NEWLINE+
+                "      </MyOtherClass>"+NEWLINE+
+                "    </test.conf2>"+NEWLINE+
+                "  </config>"+NEWLINE+
                 "</entity>";
         String expected = 
-                "<entity myattrib=\"myval\">"+"\n"+
-                "  <type myattrib2=\"myval2\">mytype.Before</type>"+"\n"+
-                "  <config>"+"\n"+
-                "    <test.conf1>"+"\n"+
-                "      <MyClass>"+"\n"+
-                "        <myFieldAfter class=\"string\">myfieldval</myFieldAfter>"+"\n"+
-                "      </MyClass>"+"\n"+
-                "    </test.conf1>"+"\n"+
-                "    <test.conf2>"+"\n"+
-                "      <MyOtherClass>"+"\n"+
-                "        <myFieldBefore class=\"string\">myfieldval</myFieldBefore>"+"\n"+
-                "      </MyOtherClass>"+"\n"+
-                "    </test.conf2>"+"\n"+
-                "  </config>"+"\n"+
+                "<entity myattrib=\"myval\">"+NEWLINE+
+                "  <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+
+                "  <config>"+NEWLINE+
+                "    <test.conf1>"+NEWLINE+
+                "      <MyClass>"+NEWLINE+
+                "        <myFieldAfter class=\"string\">myfieldval</myFieldAfter>"+NEWLINE+
+                "      </MyClass>"+NEWLINE+
+                "    </test.conf1>"+NEWLINE+
+                "    <test.conf2>"+NEWLINE+
+                "      <MyOtherClass>"+NEWLINE+
+                "        <myFieldBefore class=\"string\">myfieldval</myFieldBefore>"+NEWLINE+
+                "      </MyOtherClass>"+NEWLINE+
+                "    </test.conf2>"+NEWLINE+
+                "  </config>"+NEWLINE+
                 "</entity>";
         
         XsltTransformer transformer = new XsltTransformer(xslt);
@@ -108,24 +110,24 @@ public class XsltTransformerTest {
         String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameClass.xslt");
         String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("old_val",
"MyClassBefore", "new_val", "MyClassAfter"));
         String input = 
-                "<entity myattrib=\"myval\">"+"\n"+
-                "  <type myattrib2=\"myval2\">mytype.Before</type>"+"\n"+
-                "  <config>"+"\n"+
-                "    <test.conf1>"+"\n"+
-                "      <MyClassBefore>"+"\n"+
-                "      </MyClassBefore>"+"\n"+
-                "    </test.conf1>"+"\n"+
-                "  </config>"+"\n"+
+                "<entity myattrib=\"myval\">"+NEWLINE+
+                "  <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+
+                "  <config>"+NEWLINE+
+                "    <test.conf1>"+NEWLINE+
+                "      <MyClassBefore>"+NEWLINE+
+                "      </MyClassBefore>"+NEWLINE+
+                "    </test.conf1>"+NEWLINE+
+                "  </config>"+NEWLINE+
                 "</entity>";
         String expected = 
-                "<entity myattrib=\"myval\">"+"\n"+
-                "  <type myattrib2=\"myval2\">mytype.Before</type>"+"\n"+
-                "  <config>"+"\n"+
-                "    <test.conf1>"+"\n"+
-                "      <MyClassAfter>"+"\n"+
-                "      </MyClassAfter>"+"\n"+
-                "    </test.conf1>"+"\n"+
-                "  </config>"+"\n"+
+                "<entity myattrib=\"myval\">"+NEWLINE+
+                "  <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+
+                "  <config>"+NEWLINE+
+                "    <test.conf1>"+NEWLINE+
+                "      <MyClassAfter>"+NEWLINE+
+                "      </MyClassAfter>"+NEWLINE+
+                "    </test.conf1>"+NEWLINE+
+                "  </config>"+NEWLINE+
                 "</entity>";
         
         XsltTransformer transformer = new XsltTransformer(xslt);


Mime
View raw message