[exo-jcr-commits] exo-jcr SVN: r1125 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/impl/core and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Dec 17 11:38:45 EST 2009


Author: tolusha
Date: 2009-12-17 11:38:45 -0500 (Thu, 17 Dec 2009)
New Revision: 1125

Added:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetValue.java
Modified:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
Log:
EXOJCR-300: fix consumed stream gone to save

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2009-12-17 16:04:11 UTC (rev 1124)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2009-12-17 16:38:45 UTC (rev 1125)
@@ -1678,6 +1678,8 @@
    /**
     * Read Property Values.
     * 
+    * @param identifier
+    *          property identifier
     * @param cid
     *          Property id
     * @param pdata
@@ -1945,6 +1947,7 @@
 
                // set persistent file to ValueData, will be available for saving Property.
                streamData.setPersistedFile(swapFile);
+               stream = streamData.getAsStream();
             }
             storageId = null;
          }

Added: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetValue.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetValue.java	                        (rev 0)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetValue.java	2009-12-17 16:38:45 UTC (rev 1125)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.core;
+
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+
+import java.io.ByteArrayInputStream;
+import java.util.Calendar;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:anatoliy.bazko at exoplatform.com.ua">Anatoliy Bazko</a> 
+ * @version $Id$
+ */
+public class TestGetValue extends JcrImplBaseTest
+{
+
+   // Reproduces the issue described in http://jira.exoplatform.org/browse/JCR-1094
+   public void testGetValue() throws Exception
+   {
+      String data = "Test JCR";
+
+      Node testRoot = root.addNode("NodeRepresentationTest", "nt:unstructured");
+
+      Node file = testRoot.addNode("file", "nt:file");
+      Node d = file.addNode("jcr:content", "nt:resource");
+      d.setProperty("jcr:mimeType", "text/plain");
+      d.setProperty("jcr:lastModified", Calendar.getInstance());
+      d.setProperty("jcr:data", new ByteArrayInputStream(data.getBytes()));
+
+      session.save();
+
+      d.getProperties();
+
+      compareStream(d.getProperty("jcr:data").getValue().getStream(), new ByteArrayInputStream(data.getBytes()));
+   }
+}


Property changes on: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetValue.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the exo-jcr-commits mailing list