sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1724831 - in /sling/trunk/contrib/extensions/sling-pipes/src: main/java/org/apache/sling/pipes/WritePipe.java test/java/org/apache/sling/pipes/WritePipeTest.java test/resources/fruits.json test/resources/write.json
Date Fri, 15 Jan 2016 15:05:50 GMT
Author: rombert
Date: Fri Jan 15 15:05:49 2016
New Revision: 1724831

URL: http://svn.apache.org/viewvc?rev=1724831&view=rev
Log:
SLING-5433 - WritePipe should remove a property when value is evaluated as null

Submitted-By: Nicolas Peltier

Modified:
    sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/WritePipe.java
    sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/WritePipeTest.java
    sling/trunk/contrib/extensions/sling-pipes/src/test/resources/fruits.json
    sling/trunk/contrib/extensions/sling-pipes/src/test/resources/write.json

Modified: sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/WritePipe.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/WritePipe.java?rev=1724831&r1=1724830&r2=1724831&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/WritePipe.java
(original)
+++ sling/trunk/contrib/extensions/sling-pipes/src/main/java/org/apache/sling/pipes/WritePipe.java
Fri Jan 15 15:05:49 2016
@@ -112,7 +112,7 @@ public class WritePipe extends BasePipe
                     if (value == null) {
                         //null value are not handled by modifiable value maps,
                         //removing the property if it exists
-                        Resource propertyResource = resource.getChild(key);
+                        Resource propertyResource = target.getChild(key);
                         if (propertyResource != null) {
                             logger.info("removing {}", propertyResource.getPath());
                             if (!isDryRun()){

Modified: sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/WritePipeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/WritePipeTest.java?rev=1724831&r1=1724830&r2=1724831&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/WritePipeTest.java
(original)
+++ sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/WritePipeTest.java
Fri Jan 15 15:05:49 2016
@@ -53,6 +53,7 @@ public class WritePipeTest extends Abstr
         ValueMap properties =  context.resourceResolver().getResource("/content/fruits/apple").adaptTo(ValueMap.class);
         assertTrue("There should be hasSeed set to true", properties.get("hasSeed", false));
         assertArrayEquals("Colors should be correctly set", new String[]{"green", "red"},
properties.get("colors", String[].class));
+        assertFalse("worm property should be gone (${null} conf)", properties.get("worm",
false));
     }
 
     /**

Modified: sling/trunk/contrib/extensions/sling-pipes/src/test/resources/fruits.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/test/resources/fruits.json?rev=1724831&r1=1724830&r2=1724831&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/src/test/resources/fruits.json (original)
+++ sling/trunk/contrib/extensions/sling-pipes/src/test/resources/fruits.json Fri Jan 15 15:05:49
2016
@@ -3,6 +3,7 @@
   "index":["apple","banana"],
   "apple":{
     "jcr:primaryType":"nt:unstructured",
+    "worm":"true",
     "isnota":{
       "jcr:primaryType":"nt:unstructured",
       "pea":{

Modified: sling/trunk/contrib/extensions/sling-pipes/src/test/resources/write.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/test/resources/write.json?rev=1724831&r1=1724830&r2=1724831&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/src/test/resources/write.json (original)
+++ sling/trunk/contrib/extensions/sling-pipes/src/test/resources/write.json Fri Jan 15 15:05:49
2016
@@ -7,6 +7,7 @@
     "conf": {
       "jcr:primaryType":"nt:unstructured",
       "hasSeed":true,
+      "worm":"${null}",
       "colors":["green","red"]
     }
   },



Mime
View raw message