Author: kturner
Date: Fri Jan 11 15:56:03 2013
New Revision: 1432111

URL: http://svn.apache.org/viewvc?rev=1432111&view=rev
Log:
ACCUMULO-14 fixed issue with starting more than one mini accumulo cluster from 
the same jvm

Modified:
    
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
    
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java

Modified: 
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java?rev=1432111&r1=1432110&r2=1432111&view=diff
==============================================================================
--- 
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
 (original)
+++ 
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
 Fri Jan 11 15:56:03 2013
@@ -35,13 +35,10 @@ import java.util.TimerTask;
 
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.master.Master;
 import org.apache.accumulo.server.tabletserver.TabletServer;
 import org.apache.accumulo.server.util.Initialize;
 import org.apache.accumulo.server.util.time.SimpleTimer;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
 import org.apache.zookeeper.server.ZooKeeperServerMain;
 
 /**
@@ -185,21 +182,6 @@ public class MiniAccumuloCluster {
     return process;
   }
 
-  private void init() {
-
-    Level prevLevel = Logger.getLogger("org.apache").getLevel();
-    Logger.getLogger("org.apache").setLevel(Level.ERROR);
-
-    ServerConfiguration.getSiteConfiguration().set(Property.INSTANCE_DFS_URI, 
"file:///");
-    ServerConfiguration.getSiteConfiguration().set(Property.INSTANCE_DFS_DIR, 
accumuloDir.getAbsolutePath());
-    ServerConfiguration.getSiteConfiguration().set(Property.INSTANCE_ZK_HOST, 
"localhost:" + zooKeeperPort);
-    ServerConfiguration.getSiteConfiguration().set(Property.INSTANCE_SECRET, 
INSTANCE_SECRET);
-    
-    Initialize.main(new String[] {"--instance-name", INSTANCE_NAME, 
"--password", rootPassword});
-    
-    Logger.getLogger("org.apache").setLevel(prevLevel);
-  }
-
   private void appendProp(FileWriter fileWriter, Property key, String value, 
Map<String,String> siteConfig) throws IOException {
     appendProp(fileWriter, key.getKey(), value, siteConfig);
   }
@@ -323,7 +305,11 @@ public class MiniAccumuloCluster {
     // sleep a little bit to let zookeeper come up before calling init, seems 
to work better
     UtilWaitThread.sleep(250);
 
-    init();
+    Process initProcess = exec(Initialize.class, "--instance-name", 
INSTANCE_NAME, "--password", rootPassword);
+    int ret = initProcess.waitFor();
+    if (ret != 0) {
+      throw new RuntimeException("Initialize process returned " + ret);
+    }
    
     tabletServerProcess = exec(TabletServer.class);
     masterProcess = exec(Master.class);

Modified: 
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java?rev=1432111&r1=1432110&r2=1432111&view=diff
==============================================================================
--- 
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
 (original)
+++ 
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
 Fri Jan 11 15:56:03 2013
@@ -38,6 +38,8 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.commons.io.FileUtils;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -56,6 +58,8 @@ public class MiniAccumuloClusterTest {
 
     folder.create();
     
+    Logger.getLogger("org.apache.zookeeper").setLevel(Level.WARN);
+
     accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret", new 
HashMap<String,String>());
     
     accumulo.start();


Reply via email to