incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/4] git commit: Test fix provided in Blur-40.
Date Tue, 30 Oct 2012 02:38:21 GMT
Test fix provided in Blur-40.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/8ecd3338
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/8ecd3338
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/8ecd3338

Branch: refs/heads/lucene-4.0.0
Commit: 8ecd3338850fc6119e626f90d1d61c3dc7524a30
Parents: f1e0b3d
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Oct 29 22:36:13 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Oct 29 22:36:13 2012 -0400

----------------------------------------------------------------------
 .../org/apache/blur/thrift/BlurClusterTest.java    |   36 ++++++++++++---
 1 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/8ecd3338/src/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java b/src/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
index bc5ca2f..c6a31bc 100644
--- a/src/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
@@ -19,6 +19,7 @@ package org.apache.blur.thrift;
 
 import static org.junit.Assert.assertEquals;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -26,8 +27,8 @@ import java.util.List;
 import java.util.UUID;
 
 import org.apache.blur.MiniCluster;
-import org.apache.blur.thrift.BlurClient;
 import org.apache.blur.thrift.generated.Blur;
+import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.thrift.generated.BlurQuery;
 import org.apache.blur.thrift.generated.BlurResults;
@@ -35,21 +36,42 @@ import org.apache.blur.thrift.generated.RecordMutation;
 import org.apache.blur.thrift.generated.RowMutation;
 import org.apache.blur.thrift.generated.SimpleQuery;
 import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.utils.BlurUtil;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocalFileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.thrift.TException;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-
 public class BlurClusterTest {
 
+  private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "/tmp"));
+
   @BeforeClass
-  public static void startCluster() {
-    // Considering default umask in 002 and deirectories are created with 775 permissions.
-    // This can be altered in case umask value is different.
-    System.setProperty("dfs.datanode.data.dir.perm", "775");
+  public static void startCluster() throws IOException {
+    LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
+    File testDirectory = new File(TMPDIR, "blur-cluster-test");
+    testDirectory.mkdirs();
+
+    Path directory = new Path(testDirectory.getPath());
+    FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission();
+    FsAction userAction = dirPermissions.getUserAction();
+    FsAction groupAction = dirPermissions.getGroupAction();
+    FsAction otherAction = dirPermissions.getOtherAction();
+
+    StringBuilder builder = new StringBuilder();
+    builder.append(userAction.ordinal());
+    builder.append(groupAction.ordinal());
+    builder.append(otherAction.ordinal());
+    String dirPermissionNum = builder.toString();
+    System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
+    testDirectory.delete();
+
     MiniCluster.startBlurCluster("cluster", 2, 3);
   }
 


Mime
View raw message