camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ioca...@apache.org
Subject svn commit: r1343542 - /camel/trunk/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
Date Tue, 29 May 2012 05:19:27 GMT
Author: iocanel
Date: Tue May 29 05:19:27 2012
New Revision: 1343542

URL: http://svn.apache.org/viewvc?rev=1343542&view=rev
Log:
[CAMEL-4743] Removed umask checking before using the hbase testing utility. Now catching the
exception instead.

Modified:
    camel/trunk/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java

Modified: camel/trunk/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java?rev=1343542&r1=1343541&r2=1343542&view=diff
==============================================================================
--- camel/trunk/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
(original)
+++ camel/trunk/components/camel-hbase/src/test/java/org/apache/camel/component/hbase/CamelHBaseTestSupport.java
Tue May 29 05:19:27 2012
@@ -17,15 +17,10 @@
 
 package org.apache.camel.component.hbase;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.client.HTablePool;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
@@ -33,19 +28,20 @@ public abstract class CamelHBaseTestSupp
 
     protected static HBaseTestingUtility hbaseUtil = new HBaseTestingUtility();
     protected static int numServers = 1;
-    protected static final String REQUIREDUMASK = "0022";
     protected static final String DEFAULTTABLE = "DEFAULTTABLE";
     protected static final String DEFAULTFAMILY = "DEFAULTFAMILY";
 
-    protected static String actualMask = "0022";
+    //The hbase testing utility has special requirements on the umask.
+    //We hold this value to check if the the minicluster has properly started and tests can
be run.
     protected static Boolean systemReady = true;
 
 
     @BeforeClass
     public static void setUpClass() throws Exception {
-        systemReady = checkUmask();
-        if (systemReady) {
+        try {
             hbaseUtil.startMiniCluster(numServers);
+        } catch (Exception e) {
+           systemReady = false;
         }
     }
 
@@ -56,24 +52,6 @@ public abstract class CamelHBaseTestSupp
         }
     }
 
-
-    protected static boolean checkUmask() throws IOException {
-        String operatingSystem = System.getProperty("os.name");
-        if (!operatingSystem.startsWith("Win")) {
-            Process p = Runtime.getRuntime().exec("umask");
-            InputStream is = p.getInputStream();
-            BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-            StringBuilder sb = new StringBuilder();
-            String line;
-            while ((line = reader.readLine()) != null) {
-                sb.append(line);
-            }
-            actualMask = sb.toString().trim();
-            return REQUIREDUMASK.equals(actualMask);
-        }
-        return false;
-    }
-
     @Override
     public CamelContext createCamelContext() throws Exception {
         CamelContext context = new DefaultCamelContext(createRegistry());



Mime
View raw message