accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject git commit: ACCUMULO-2361 made test a functional SimpleIT for 1.6 and later
Date Tue, 18 Feb 2014 16:56:40 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master d9e3e3c4b -> ad9f9c13d


ACCUMULO-2361 made test a functional SimpleIT for 1.6 and later


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

Branch: refs/heads/master
Commit: ad9f9c13dce4c9bc635c4645a5bafd04131a33cd
Parents: d9e3e3c
Author: Eric Newton <eric.newton@gmail.com>
Authored: Tue Feb 18 11:56:57 2014 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Tue Feb 18 11:56:57 2014 -0500

----------------------------------------------------------------------
 .../functional/DeleteTableDuringSplitIT.java    | 100 +++++++++++++++++++
 1 file changed, 100 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ad9f9c13/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
new file mode 100644
index 0000000..79cb188
--- /dev/null
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.functional;
+
+import static org.junit.Assert.assertFalse;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.concurrent.Future;
+
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.util.SimpleThreadPool;
+import org.apache.accumulo.fate.util.UtilWaitThread;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+// ACCUMULO-2361
+public class DeleteTableDuringSplitIT extends SimpleMacIT {
+  
+  @Test(timeout= 10 * 60 * 1000)
+  public void test() throws Exception {
+    String[] tableNames = getTableNames(50);
+    // make a bunch of tables
+    for (String tableName : tableNames) {
+      getConnector().tableOperations().create(tableName);
+    }
+    final SortedSet<Text> splits = new TreeSet<Text>();
+    for (byte i = 0; i < 100; i++) {
+      splits.add(new Text(new byte[] {0, 0, i}));
+    }
+
+    List<Future<?>> results = new ArrayList<Future<?>>();
+    SimpleThreadPool es = new SimpleThreadPool(tableNames.length, "concurrent-api-requests");
+    for (String tableName : tableNames) {
+      final String finalName = tableName;
+      results.add(es.submit(new Runnable() {
+        @Override
+        public void run() {
+          try {
+            getConnector().tableOperations().addSplits(finalName, splits);
+          } catch (TableNotFoundException ex) {
+          } catch (Exception ex) {
+            throw new RuntimeException(finalName, ex);
+          }
+        }
+      }));
+      results.add(es.submit(new Runnable() {
+        @Override
+        public void run() {
+          try {
+            UtilWaitThread.sleep(500);
+            getConnector().tableOperations().delete(finalName);
+          } catch (Exception ex) {
+            throw new RuntimeException(ex);
+          }
+        }
+      }));
+    }
+    for (Future<?> f : results) {
+      f.get();
+    }
+//    results.clear();
+//    for (String tableName : tableNames) {
+//      final String finalName = tableName;
+//      results.add(es.submit(new Runnable() {
+//        @Override
+//        public void run() {
+//          try {
+//            getConnector().tableOperations().delete(finalName);
+//          } catch (Exception ex) {
+//            throw new RuntimeException(ex);
+//          }
+//        }
+//      }));
+//    }
+//    for (Future<?> f : results) {
+//      f.get();
+//    }
+    for (String tableName : tableNames) {
+      assertFalse(getConnector().tableOperations().exists(tableName));
+    }
+  }
+
+}


Mime
View raw message