accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject [1/2] git commit: ACCUMULO-3078 made some more ITs rely on a Connector where possible instead of a MAC instance
Date Thu, 28 Aug 2014 15:40:22 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 91186bf27 -> 4a4f5463c


ACCUMULO-3078 made some more ITs rely on a Connector where possible instead of a MAC instance


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

Branch: refs/heads/master
Commit: 4135e4f87c0fa4a967517f54ce67b77344ef735f
Parents: 8147b19
Author: Billie Rinaldi <billie.rinaldi@gmail.com>
Authored: Thu Aug 28 07:59:09 2014 -0700
Committer: Billie Rinaldi <billie.rinaldi@gmail.com>
Committed: Thu Aug 28 07:59:09 2014 -0700

----------------------------------------------------------------------
 .../apache/accumulo/test/ConditionalWriterIT.java    |  9 +++++++--
 .../accumulo/test/MultiTableBatchWriterIT.java       |  2 +-
 .../test/functional/AccumuloInputFormatIT.java       | 15 +++++++++------
 .../apache/accumulo/test/functional/BinaryIT.java    | 15 ++++++++++-----
 .../accumulo/test/functional/LogicalTimeIT.java      |  2 +-
 .../apache/accumulo/test/functional/SimpleMacIT.java |  1 +
 6 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4135e4f8/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 15c1fd3..6d10f10 100644
--- a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -1202,8 +1202,11 @@ public class ConditionalWriterIT extends SimpleMacIT {
   @Test(timeout = 60 * 1000)
   public void testTrace() throws Exception {
 
-    Process tracer = getStaticCluster().exec(TraceServer.class);
+    Process tracer = null;
     Connector conn = getConnector();
+    if (!conn.tableOperations().exists("trace")) {
+      getStaticCluster().exec(TraceServer.class);
+    }
     while (!conn.tableOperations().exists("trace")) {
       UtilWaitThread.sleep(1000);
     }
@@ -1250,6 +1253,8 @@ public class ConditionalWriterIT extends SimpleMacIT {
         break;
       }
     }
-    tracer.destroy();
+    if (tracer != null) {
+      tracer.destroy();
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4135e4f8/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index 427b12f..f1eba61 100644
--- a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -60,7 +60,7 @@ public class MultiTableBatchWriterIT extends SimpleMacIT {
   }
 
   public MultiTableBatchWriter getMultiTableBatchWriter(long cacheTimeoutInSeconds) {
-    return new MultiTableBatchWriterImpl(connector.getInstance(), new Credentials("root",
new PasswordToken(getStaticCluster().getConfig().getRootPassword())),
+    return new MultiTableBatchWriterImpl(connector.getInstance(), new Credentials("root",
new PasswordToken(ROOT_PASSWORD)),
         new BatchWriterConfig(), cacheTimeoutInSeconds, TimeUnit.SECONDS);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4135e4f8/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
b/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
index 17e319c..150222f 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
@@ -29,6 +29,8 @@ import java.util.TreeSet;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
@@ -57,25 +59,26 @@ public class AccumuloInputFormatIT extends SimpleMacIT {
    */
   @Test
   public void testGetSplits() throws IOException, AccumuloSecurityException, AccumuloException,
TableNotFoundException, TableExistsException {
+    Connector conn = getConnector();
     String table = getUniqueNames(1)[0];
-    getConnector().tableOperations().create(table);
+    conn.tableOperations().create(table);
     insertData(table, currentTimeMillis());
 
-    @SuppressWarnings("deprecation")
     Job job = new Job();
     AccumuloInputFormat.setInputTableName(job, table);
-    AccumuloInputFormat.setZooKeeperInstance(job, getStaticCluster().getClientConfig());
+    AccumuloInputFormat.setZooKeeperInstance(job, new ClientConfiguration().withInstance(conn.getInstance().getInstanceName())
+        .withZkHosts(conn.getInstance().getZooKeepers()));
     AccumuloInputFormat.setConnectorInfo(job, "root", new PasswordToken(ROOT_PASSWORD));
 
     // split table
     TreeSet<Text> splitsToAdd = new TreeSet<Text>();
     for (int i = 0; i < 10000; i += 1000)
       splitsToAdd.add(new Text(String.format("%09d", i)));
-    getConnector().tableOperations().addSplits(table, splitsToAdd);
+    conn.tableOperations().addSplits(table, splitsToAdd);
     UtilWaitThread.sleep(500); // wait for splits to be propagated
 
     // get splits without setting any range
-    Collection<Text> actualSplits = getConnector().tableOperations().listSplits(table);
+    Collection<Text> actualSplits = conn.tableOperations().listSplits(table);
     List<InputSplit> splits = inputFormat.getSplits(job);
     assertEquals(actualSplits.size() + 1, splits.size()); // No ranges set on the job so
it'll start with -inf
 
@@ -94,7 +97,7 @@ public class AccumuloInputFormatIT extends SimpleMacIT {
       fail("An exception should have been thrown");
     } catch (Exception e) {}
 
-    getConnector().tableOperations().offline(table);
+    conn.tableOperations().offline(table);
     splits = inputFormat.getSplits(job);
     assertEquals(actualSplits.size(), splits.size());
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4135e4f8/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java
index e6c73c2..9c0edaa 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/BinaryIT.java
@@ -26,7 +26,7 @@ import org.apache.accumulo.test.TestBinaryRows;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
-public class BinaryIT extends ConfigurableMacIT {
+public class BinaryIT extends SimpleMacIT {
 
   @Override
   protected int defaultTimeoutSeconds() {
@@ -42,20 +42,25 @@ public class BinaryIT extends ConfigurableMacIT {
 
   @Test
   public void testPreSplit() throws Exception {
+    String tableName = "bt2";
     Connector c = getConnector();
-    c.tableOperations().create("bt");
+    c.tableOperations().create(tableName);
     SortedSet<Text> splits = new TreeSet<Text>();
     splits.add(new Text("8"));
     splits.add(new Text("256"));
-    c.tableOperations().addSplits("bt", splits);
-    runTest(c);
+    c.tableOperations().addSplits(tableName, splits);
+    runTest(c, tableName);
   }
 
   public static void runTest(Connector c) throws Exception {
+    runTest(c, "bt");
+  }
+
+  public static void runTest(Connector c, String tableName) throws Exception {
     BatchWriterOpts bwOpts = new BatchWriterOpts();
     ScannerOpts scanOpts = new ScannerOpts();
     TestBinaryRows.Opts opts = new TestBinaryRows.Opts();
-    opts.tableName = "bt";
+    opts.tableName = tableName;
     opts.start = 0;
     opts.num = 100000;
     opts.mode = "ingest";

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4135e4f8/test/src/test/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/LogicalTimeIT.java b/test/src/test/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
index f66eb22..6aec7cd 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
-public class LogicalTimeIT extends ConfigurableMacIT {
+public class LogicalTimeIT extends SimpleMacIT {
 
   @Override
   protected int defaultTimeoutSeconds() {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/4135e4f8/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
index f43f458..b166ffd 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
@@ -50,6 +50,7 @@ public class SimpleMacIT extends AbstractMacIT {
   @BeforeClass
   public static synchronized void setUp() throws Exception {
     if (getInstanceOneConnector() == null && cluster == null) {
+      log.info("No shared instance available, falling back to creating MAC");
       folder = createSharedTestDir(SimpleMacIT.class.getName());
       MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(folder, ROOT_PASSWORD);
       cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath());


Mime
View raw message