oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1142303 - in /oodt/trunk: CHANGES.txt filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestBasicVersioner.java
Date Sat, 02 Jul 2011 21:08:50 GMT
Author: mattmann
Date: Sat Jul  2 21:08:50 2011
New Revision: 1142303

URL: http://svn.apache.org/viewvc?rev=1142303&view=rev
Log:
- fix for OODT-295 BasicVersioner doesn't work with Hierarchical Products

Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
    oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestBasicVersioner.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1142303&r1=1142302&r2=1142303&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Jul  2 21:08:50 2011
@@ -1,6 +1,12 @@
 Apache OODT Change Log
 ======================
 
+Release 0.4: Current Development
+
+* OODT-295 BasicVersioner doesn't work with Hierarchical 
+  Products (mattmann, Tim Stough)
+
+
 Release 0.3
 --------------------------------------------
 Release Date: June 20th, 2011

Modified: oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java?rev=1142303&r1=1142302&r2=1142303&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
(original)
+++ oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
Sat Jul  2 21:08:50 2011
@@ -86,8 +86,12 @@ public class BasicVersioner implements V
 
             try {
                 dataStoreRef = new File(new URI(productRepoPath)).toURL()
-                        .toExternalForm()
-                        + URLEncoder.encode(productName, "UTF-8") + "/";
+                        .toExternalForm();
+                if(!dataStoreRef.endsWith("/")){
+                  dataStoreRef+="/";
+                }
+                
+                dataStoreRef+= URLEncoder.encode(productName, "UTF-8") + "/";
                 LOG.log(Level.INFO, "BasicVersioner: generated DataStore ref: "
                         + dataStoreRef + " from origRef: "
                         + r.getOrigReference());

Modified: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestBasicVersioner.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestBasicVersioner.java?rev=1142303&r1=1142302&r2=1142303&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestBasicVersioner.java
(original)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/versioning/TestBasicVersioner.java
Sat Jul  2 21:08:50 2011
@@ -29,6 +29,7 @@ import org.apache.oodt.cas.filemgr.struc
 import org.apache.oodt.cas.filemgr.structs.ProductType;
 import org.apache.oodt.cas.filemgr.structs.Reference;
 import org.apache.oodt.cas.filemgr.structs.exceptions.VersioningException;
+import org.apache.oodt.cas.metadata.Metadata;
 
 //Junit imports
 import junit.framework.TestCase;
@@ -87,4 +88,29 @@ public class TestBasicVersioner extends 
 
 	}
 
+  public void testVersionHierarchical() {
+    String expected = "file:/archive/testdir/";
+    Product p = Product
+        .getDefaultFlatProduct("testdir", "urn:oodt:GenericFile");
+    p.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
+    p.getProductType().setProductRepositoryPath("file:///archive");
+
+    p.getProductReferences().add(
+        new Reference("file:///tmp/somedir/", null, 4L));
+    p.getProductReferences().add(
+        new Reference("file:///tmp/somedir/file.txt", null, 4096L));
+
+    BasicVersioner versioner = new BasicVersioner();
+    try {
+      versioner.createDataStoreReferences(p, new Metadata());
+    } catch (Exception e) {
+      fail(e.getMessage());
+    }
+
+    assertNotNull(p.getProductReferences());
+    assertEquals(2, p.getProductReferences().size());
+    assertEquals(expected, p.getProductReferences().get(0)
+        .getDataStoreReference());
+  }
+
 }



Mime
View raw message