accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject git commit: ACCUMULO-335 Create test to ensure batch scanning over metadata works
Date Fri, 06 Sep 2013 20:47:12 GMT
Updated Branches:
  refs/heads/master 018e520e7 -> 2a9685635


ACCUMULO-335 Create test to ensure batch scanning over metadata works


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

Branch: refs/heads/master
Commit: 2a968563500f2fbbfcef75be4112694e24a5eda6
Parents: 018e520
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Fri Sep 6 16:46:44 2013 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Fri Sep 6 16:46:44 2013 -0400

----------------------------------------------------------------------
 .../accumulo/test/functional/MergeMetaIT.java   | 64 -------------
 .../accumulo/test/functional/MetadataIT.java    | 94 ++++++++++++++++++++
 2 files changed, 94 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/2a968563/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
deleted file mode 100644
index 8ccd516..0000000
--- a/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map.Entry;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.hadoop.io.Text;
-import org.junit.Test;
-
-public class MergeMetaIT extends SimpleMacIT {
-  
-  @Test(timeout = 60 * 1000)
-  public void mergeMeta() throws Exception {
-    Connector c = getConnector();
-    SortedSet<Text> splits = new TreeSet<Text>();
-    for (String id : "1 2 3 4 5".split(" ")) {
-      splits.add(new Text(id));
-    }
-    c.tableOperations().addSplits(MetadataTable.NAME, splits);
-    for (String tableName : "a1 a2 a3 a4 a5".split(" ")) {
-      c.tableOperations().create(tableName);
-    }
-    c.tableOperations().merge(MetadataTable.NAME, null, null);
-    UtilWaitThread.sleep(2 * 1000);
-    Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.DeletesSection.getRange());
-    int count = 0;
-    for (@SuppressWarnings("unused")
-    Entry<Key,Value> e : s) {
-      count++;
-    }
-    assertTrue(count > 0);
-    assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2a968563/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
new file mode 100644
index 0000000..aa5f8b0
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
@@ -0,0 +1,94 @@
+/*
+ * 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.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.Map.Entry;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class MetadataIT extends SimpleMacIT {
+
+  @Test(timeout = 60 * 1000)
+  public void mergeMeta() throws Exception {
+    Connector c = getConnector();
+    SortedSet<Text> splits = new TreeSet<Text>();
+    for (String id : "1 2 3 4 5".split(" ")) {
+      splits.add(new Text(id));
+    }
+    c.tableOperations().addSplits(MetadataTable.NAME, splits);
+    for (String tableName : "a1 a2 a3 a4 a5".split(" ")) {
+      c.tableOperations().create(tableName);
+    }
+    c.tableOperations().merge(MetadataTable.NAME, null, null);
+    UtilWaitThread.sleep(2 * 1000);
+    Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY);
+    s.setRange(MetadataSchema.DeletesSection.getRange());
+    int count = 0;
+    for (@SuppressWarnings("unused")
+    Entry<Key,Value> e : s) {
+      count++;
+    }
+    assertTrue(count > 0);
+    assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
+  }
+
+  @Test(timeout = 2 * 60 * 1000)
+  public void batchScanTest() throws Exception {
+    Connector c = getConnector();
+    String tableName = makeTableName();
+    c.tableOperations().create(tableName);
+
+    // batch scan regular metadata table
+    BatchScanner s = c.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1);
+    s.setRanges(Collections.singleton(new Range()));
+    int count = 0;
+    for (Entry<Key,Value> e : s) {
+      if (e != null)
+        count++;
+    }
+    assertTrue(count > 0);
+
+    // batch scan root metadata table
+    s = c.createBatchScanner(RootTable.NAME, Authorizations.EMPTY, 1);
+    s.setRanges(Collections.singleton(new Range()));
+    count = 0;
+    for (Entry<Key,Value> e : s) {
+      if (e != null)
+        count++;
+    }
+    assertTrue(count > 0);
+  }
+
+}


Mime
View raw message