sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1652994 - /sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
Date Mon, 19 Jan 2015 13:24:05 GMT
Author: bdelacretaz
Date: Mon Jan 19 13:24:05 2015
New Revision: 1652994

URL: http://svn.apache.org/r1652994
Log:
SLING-4307 - this new test demonstrates a regression, test disabled for now. Contributed by
Radu Cotescu, thanks!

Modified:
    sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java

Modified: sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java?rev=1652994&r1=1652993&r2=1652994&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
Mon Jan 19 13:24:05 2015
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.jcr.resource.internal;
 
+import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -33,11 +34,13 @@ import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NodeType;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.util.Text;
 import org.apache.sling.api.resource.ModifiableValueMap;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.commons.testing.jcr.RepositoryTestBase;
 import org.apache.sling.jcr.resource.JcrResourceUtil;
+import org.apache.sling.jcr.resource.internal.helper.jcr.JcrItemResourceTestBase;
 
 public class JcrModifiableValueMapTest extends RepositoryTestBase {
 
@@ -45,6 +48,9 @@ public class JcrModifiableValueMapTest e
 
     private Node rootNode;
 
+    public static final byte[] TEST_BYTE_ARRAY = {'T', 'e', 's', 't'};
+    public static final String TEST_BYTE_ARRAY_TO_STRING = new String(TEST_BYTE_ARRAY);
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -76,6 +82,17 @@ public class JcrModifiableValueMapTest e
         return values;
     }
 
+    // SLING-4307 introduced a regresssion that makes this test fail
+    public void DISABLED_testStreams() throws Exception {
+        final ModifiableValueMap pvm = new JcrModifiableValueMap(this.rootNode, null);
+        InputStream stream = new ByteArrayInputStream(TEST_BYTE_ARRAY);
+        pvm.put("binary", stream);
+        getSession().save();
+        final ModifiableValueMap modifiableValueMap2 = new JcrModifiableValueMap(this.rootNode,
null);
+        assertTrue("The read stream is not what we wrote.", IOUtils.toString(modifiableValueMap2.get("binary",
InputStream.class)).equals
+                (TEST_BYTE_ARRAY_TO_STRING));
+    }
+
     public void testPut()
     throws Exception {
         getSession().refresh(false);



Mime
View raw message