accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [38/50] [abbrv] accumulo git commit: ACCUMULO-3167 Revert some changes to NamespacesIT to make it more stable
Date Wed, 26 Nov 2014 04:23:54 GMT
ACCUMULO-3167 Revert some changes to NamespacesIT to make it more stable

Lots of issues with ZK coming up on an already bound port.


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

Branch: refs/heads/1.6
Commit: f94a511077ac1cfbf7be4883aacdf712d7d3c0eb
Parents: fb8c7e7
Author: Josh Elser <elserj@apache.org>
Authored: Mon Nov 24 22:24:09 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Nov 24 22:38:26 2014 -0500

----------------------------------------------------------------------
 .../org/apache/accumulo/test/NamespacesIT.java  | 29 ++++++++++++++++----
 1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f94a5110/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index 757b4e5..40a11d8 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -50,6 +50,7 @@ import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.admin.NamespaceOperations;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.client.impl.Namespaces;
+import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.thrift.TableOperation;
 import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType;
 import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
@@ -79,13 +80,14 @@ import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
 import org.apache.hadoop.io.Text;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 // Testing default namespace configuration with inheritance requires altering the system
state and restoring it back to normal
 // Punt on this for now and just let it use a minicluster.
 public class NamespacesIT extends AccumuloIT {
 
-  private MiniAccumuloClusterImpl cluster;
+  private static MiniAccumuloClusterImpl cluster;
   private Connector c;
   private String namespace;
 
@@ -94,7 +96,7 @@ public class NamespacesIT extends AccumuloIT {
     return 60;
   }
 
-  private AuthenticationToken getToken() {
+  private static AuthenticationToken getToken() {
     return new PasswordToken("rootPassword1");
   }
 
@@ -106,12 +108,16 @@ public class NamespacesIT extends AccumuloIT {
     }
   }
 
-  @Before
-  public void setUpConnectorAndNamespace() throws Exception {
+  @BeforeClass
+  public static void setupMiniCluster() throws Exception {
     MiniClusterHarness harness = new MiniClusterHarness();
     cluster = harness.create(getToken());
     cluster.getConfig().setNumTservers(1);
     cluster.start();
+  }
+  
+  @Before
+  public void setupConnectorAndNamespace() throws Exception {
     // prepare a unique namespace and get a new root connector for each test
     c = getConnector();
     namespace = "ns_" + getUniqueNames(1)[0];
@@ -119,8 +125,19 @@ public class NamespacesIT extends AccumuloIT {
 
   @After
   public void swingMj├Âlnir() throws Exception {
-    // Just making a new MAC is so much less work than hammering things
-    cluster.stop();
+    // clean up any added tables, namespaces, and users, after each test
+    for (String t : c.tableOperations().list())
+      if (!Tables.qualify(t).getFirst().equals(Namespaces.ACCUMULO_NAMESPACE))
+        c.tableOperations().delete(t);
+    assertEquals(2, c.tableOperations().list().size());
+    for (String n : c.namespaceOperations().list())
+      if (!n.equals(Namespaces.ACCUMULO_NAMESPACE) && !n.equals(Namespaces.DEFAULT_NAMESPACE))
+        c.namespaceOperations().delete(n);
+    assertEquals(2, c.namespaceOperations().list().size());
+    for (String u : c.securityOperations().listLocalUsers())
+      if (!"root".equals(u))
+        c.securityOperations().dropLocalUser(u);
+    assertEquals(1, c.securityOperations().listLocalUsers().size());
   }
 
   @Test


Mime
View raw message