ACCUMULO-2061 Update FileTypeTest to assert that volumes don't need to have an 
'accumulo' directory


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2da21b6a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2da21b6a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2da21b6a

Branch: refs/heads/ACCUMULO-2061
Commit: 2da21b6a450c474115ad8d9c94747116dccf4017
Parents: 9060185
Author: Josh Elser <els...@apache.org>
Authored: Tue Mar 11 14:09:28 2014 -0400
Committer: Josh Elser <els...@apache.org>
Committed: Tue Mar 11 14:09:28 2014 -0400

----------------------------------------------------------------------
 .../apache/accumulo/server/fs/FileTypeTest.java | 48 ++++++++++++++------
 1 file changed, 35 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/2da21b6a/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypeTest.java
----------------------------------------------------------------------
diff --git 
a/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypeTest.java 
b/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypeTest.java
index 205a793..ad29c19 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypeTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/fs/FileTypeTest.java
@@ -27,28 +27,50 @@ import org.junit.Test;
 public class FileTypeTest {
   @Test
   public void testVolumeExtraction() {
-    Assert.assertEquals(new Path("file:/a"), FileType.TABLE.getVolume(new 
Path("file:/a/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("file:///a"), FileType.TABLE.getVolume(new 
Path("file:/a/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("file:///a"), FileType.TABLE.getVolume(new 
Path("file:///a/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("file:/a"), FileType.TABLE.getVolume(new 
Path("file:///a/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:/a/accumulo"), 
FileType.TABLE.getVolume(new Path("file:/a/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:///a/accumulo"), 
FileType.TABLE.getVolume(new Path("file:/a/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:///a/accumulo"), 
FileType.TABLE.getVolume(new 
Path("file:///a/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:/a/accumulo"), 
FileType.TABLE.getVolume(new 
Path("file:///a/accumulo/tables/2b/t-001/C00.rf")));
 
-    Assert.assertEquals(new Path("accumulo/tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("file:/a/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("accumulo/tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("file:///a/accumulo/tables/2b/t-001/C00.rf")));
+    // Having an 'accumulo' directory is not a requirement
+    Assert.assertEquals(new Path("file:/a"), FileType.TABLE.getVolume(new 
Path("file:/a/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:///a"), FileType.TABLE.getVolume(new 
Path("file:/a/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:///a"), FileType.TABLE.getVolume(new 
Path("file:///a/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:/a"), FileType.TABLE.getVolume(new 
Path("file:///a/tables/2b/t-001/C00.rf")));
 
-    Assert.assertEquals(new Path("file:/"), FileType.TABLE.getVolume(new 
Path("file:/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("file:/"), FileType.TABLE.getVolume(new 
Path("file:///accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("file:/a/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("file:///a/accumulo/tables/2b/t-001/C00.rf")));
 
-    Assert.assertEquals(new Path("file:/a"), FileType.WAL.getVolume(new 
Path("file:/a/accumulo/wal/1.2.3.4/aaa-bbb-ccc-ddd")));
+    // Having an 'accumulo' directory is not a requirement
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new Path("file:/a/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new Path("file:///a/tables/2b/t-001/C00.rf")));
+
+    Assert.assertEquals(new Path("file:/accumulo"), 
FileType.TABLE.getVolume(new Path("file:/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:/accumulo"), 
FileType.TABLE.getVolume(new Path("file:///accumulo/tables/2b/t-001/C00.rf")));
+
+    // Having an 'accumulo' directory is not a requirement
+    Assert.assertEquals(new Path("file:/"), FileType.TABLE.getVolume(new 
Path("file:/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("file:/"), FileType.TABLE.getVolume(new 
Path("file:///tables/2b/t-001/C00.rf")));
+
+    Assert.assertEquals(new Path("file:/a"), FileType.WAL.getVolume(new 
Path("file:/a/wal/1.2.3.4/aaa-bbb-ccc-ddd")));
 
     Assert.assertNull(FileType.WAL.getVolume(new 
Path("1.2.3.4/aaa-bbb-ccc-ddd")));
     Assert.assertNull(FileType.TABLE.getVolume(new 
Path("../2b/t-001/C00.rf")));
     Assert.assertNull(FileType.TABLE.getVolume(new Path("/t-001/C00.rf")));
 
-    Assert.assertEquals(new Path("hdfs://nn1/"), FileType.TABLE.getVolume(new 
Path("hdfs://nn1/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("hdfs://nn1/a/"), 
FileType.TABLE.getVolume(new 
Path("hdfs://nn1/a/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("hdfs://nn1/accumulo"), 
FileType.TABLE.getVolume(new 
Path("hdfs://nn1/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("hdfs://nn1/a/accumulo"), 
FileType.TABLE.getVolume(new 
Path("hdfs://nn1/a/accumulo/tables/2b/t-001/C00.rf")));
+
+    // Having an 'accumulo' directory is not a requirement
+    Assert.assertEquals(new Path("hdfs://nn1/"), FileType.TABLE.getVolume(new 
Path("hdfs://nn1/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("hdfs://nn1/a"), FileType.TABLE.getVolume(new 
Path("hdfs://nn1/a/tables/2b/t-001/C00.rf")));
+
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("hdfs://nn1/accumulo/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("hdfs://nn1/a/accumulo/tables/2b/t-001/C00.rf")));
 
-    Assert.assertEquals(new Path("accumulo/tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("hdfs://nn1/accumulo/tables/2b/t-001/C00.rf")));
-    Assert.assertEquals(new Path("accumulo/tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new 
Path("hdfs://nn1/a/accumulo/tables/2b/t-001/C00.rf")));
+    // Having an 'accumulo' directory is not a requirement
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new Path("hdfs://nn1/tables/2b/t-001/C00.rf")));
+    Assert.assertEquals(new Path("tables/2b/t-001/C00.rf"), 
FileType.TABLE.removeVolume(new Path("hdfs://nn1/a/tables/2b/t-001/C00.rf")));
 
   }
 }

Reply via email to