[exo-jcr-commits] exo-jcr SVN: r997 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/xml/exporting and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Dec 11 03:36:28 EST 2009


Author: tolusha
Date: 2009-12-11 03:36:28 -0500 (Fri, 11 Dec 2009)
New Revision: 997

Modified:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/BaseXmlExporter.java
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java
Log:
EXOJCR-300: test fix

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java	2009-12-10 20:05:35 UTC (rev 996)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java	2009-12-11 08:36:28 UTC (rev 997)
@@ -179,6 +179,11 @@
       else
       {
          InputStream in = ((StreamPersistedValueData)value).getStream();
+         if (in == null)
+         {
+            in = ((StreamPersistedValueData)value).getAsStream();
+         }
+
          try
          {
             copy(in, out);

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/BaseXmlExporter.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/BaseXmlExporter.java	2009-12-10 20:05:35 UTC (rev 996)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/BaseXmlExporter.java	2009-12-11 08:36:28 UTC (rev 997)
@@ -269,7 +269,7 @@
             // TODO namespace mapping for values
             try
             {
-               charValue = systemValueFactory.loadValue((TransientValueData)data, type).getString();
+               charValue = systemValueFactory.loadValue(data, type).getString();
             }
             catch (ValueFormatException e)
             {

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java	2009-12-10 20:05:35 UTC (rev 996)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableFileIOChannelTestBase.java	2009-12-11 08:36:28 UTC (rev 997)
@@ -20,8 +20,9 @@
 
 import org.exoplatform.services.jcr.JcrImplBaseTest;
 import org.exoplatform.services.jcr.datamodel.ValueData;
-import org.exoplatform.services.jcr.impl.dataflow.TesterTransientValueData;
 import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.FileStreamPersistedValueData;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
 import org.exoplatform.services.jcr.impl.storage.value.cas.RecordAlreadyExistsException;
 import org.exoplatform.services.jcr.impl.storage.value.cas.RecordNotFoundException;
 import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
@@ -57,15 +58,11 @@
 
    protected File testFile;
 
-   protected TesterTransientValueData testerTransientValueData;
-
    @Override
    public void setUp() throws Exception
    {
       super.setUp();
 
-      testerTransientValueData = new TesterTransientValueData();
-
       if (fileCleaner == null)
          fileCleaner = new FileCleaner();
 
@@ -115,7 +112,7 @@
       FileIOChannel fch = openCASChannel(digestType);
 
       String propertyId = IdGenerator.generate();
-      ValueData value = testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0);
+      ValueData value = new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0);
 
       fch.write(propertyId, value);
       fch.commit();
@@ -146,7 +143,7 @@
 
       // prepare
       String propertyId = IdGenerator.generate();
-      ValueData value = testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0);
+      ValueData value = new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0);
       fch.write(propertyId, value);
       fch.commit();
 
@@ -155,8 +152,7 @@
       try
       {
          fch = openCASChannel(digestType);
-         fch.write(new String(propertyId), testerTransientValueData.getTransientValueData(
-            new FileInputStream(testFile), 0));
+         fch.write(new String(propertyId), new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0));
          fch.commit();
 
          fail("RecordAlreadyExistsException should be thrown, record exists");
@@ -186,10 +182,10 @@
       String propertyId = IdGenerator.generate();
       try
       {
-         ValueData value = testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0);
+         ValueData value = new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0);
          fch.write(propertyId, value);
          fch.delete(propertyId);
-         fch.write(propertyId, testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0));
+         fch.write(propertyId, new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0));
          fch.commit();
 
          // long initialSize = calcDirSize(rootDir);
@@ -213,7 +209,7 @@
       FileIOChannel fch = openCASChannel(digestType);
 
       String propertyId = IdGenerator.generate();
-      ValueData value = testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0);
+      ValueData value = new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0);
       fch.write(propertyId, value);
       fch.commit();
 
@@ -236,7 +232,7 @@
       FileIOChannel fch = openCASChannel(digestType);
 
       String propertyId = IdGenerator.generate();
-      ValueData value = testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0);
+      ValueData value = new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0);
       fch.write(propertyId, value);
       fch.commit();
 
@@ -320,7 +316,7 @@
 
       for (int i = 0; i < 20; i++)
       {
-         fch.write(propertyId, testerTransientValueData.getTransientValueData(new FileInputStream(testFile), i));
+         fch.write(propertyId, new StreamPersistedValueData(null, null, new FileInputStream(testFile), i));
       }
       fch.commit();
 
@@ -350,7 +346,7 @@
       {
          File f = createBLOBTempFile(300);
          addedSize += f.length();
-         fch.write(propertyId, testerTransientValueData.getTransientValueData(new FileInputStream(f), i));
+         fch.write(propertyId, new StreamPersistedValueData(null, null, new FileInputStream(f), i));
       }
       fch.commit();
 
@@ -379,7 +375,7 @@
          propertyId = IdGenerator.generate();
 
          FileIOChannel fch = openCASChannel(digestType);
-         fch.write(propertyId, testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0));
+         fch.write(propertyId, new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0));
          fch.commit();
       }
 
@@ -408,7 +404,7 @@
          addedSize += f.length();
 
          FileIOChannel fch = openCASChannel(digestType);
-         fch.write(propertyId, testerTransientValueData.getTransientValueData(new FileInputStream(f), 0));
+         fch.write(propertyId, new StreamPersistedValueData(null, null, new FileInputStream(f), 0));
          fch.commit();
       }
 
@@ -438,7 +434,7 @@
             propertyId = pid;
 
          FileIOChannel fch = openCASChannel(digestType);
-         fch.write(pid, testerTransientValueData.getTransientValueData(new FileInputStream(testFile), 0));
+         fch.write(pid, new StreamPersistedValueData(null, null, new FileInputStream(testFile), 0));
          fch.commit();
       }
 
@@ -479,7 +475,7 @@
          addedSize += (fileSize = f.length());
 
          FileIOChannel fch = openCASChannel(digestType);
-         fch.write(pid, testerTransientValueData.getTransientValueData(new FileInputStream(f), 0));
+         fch.write(pid, new StreamPersistedValueData(null, null, new FileInputStream(f), 0));
          fch.commit();
       }
 
@@ -508,7 +504,7 @@
 
       final String property1MultivaluedId = IdGenerator.generate();
 
-      TransientValueData sharedValue = null;
+      StreamPersistedValueData sharedValue = null;
 
       // add multivaued property
       long m1fileSize = 0;
@@ -519,7 +515,7 @@
          File f = createBLOBTempFile(450);
          addedSize += (m1fileSize = f.length());
 
-         TransientValueData v = testerTransientValueData.getTransientValueData(new FileInputStream(f), i);
+         StreamPersistedValueData v = new StreamPersistedValueData(null, null, new FileInputStream(f), i);
 
          if (i == 1)
             sharedValue = v;
@@ -541,8 +537,8 @@
          if (i == 2)
          {
             // use shared
+            sharedValue = new StreamPersistedValueData(null, null, sharedValue.getAsStream(), i);
             v = sharedValue;
-            sharedValue.setOrderNumber(i);
          }
          else
          {
@@ -550,7 +546,7 @@
             m2filesCount++;
             File f = createBLOBTempFile(350);
             addedSize += (m2fileSize = f.length()); // add size
-            v = testerTransientValueData.getTransientValueData(new FileInputStream(f), i);
+            v = new StreamPersistedValueData(null, null, new FileInputStream(f), i);
          }
          fch.write(property2MultivaluedId, v);
       }
@@ -559,7 +555,7 @@
       // add some single valued properties, two new property will have shared value too
       String property1Id = null;
       String property2Id = null;
-      sharedValue.setOrderNumber(0);
+      sharedValue = new StreamPersistedValueData(null, null, sharedValue.getAsStream(), 0);
       for (int i = 0; i < 10; i++)
       {
          String pid = IdGenerator.generate();
@@ -578,7 +574,7 @@
          {
             File f = createBLOBTempFile(425);
             addedSize += f.length();
-            v = testerTransientValueData.getTransientValueData(new FileInputStream(f), 0);
+            v = new StreamPersistedValueData(null, null, new FileInputStream(f), 0);
          }
          FileIOChannel vfch = openCASChannel(digestType);
          vfch.write(pid, v);



More information about the exo-jcr-commits mailing list