You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/07/17 04:33:04 UTC
[02/50] [abbrv] ACCUMULO-1537 converted many more functional tests to
integration tests
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java b/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
new file mode 100644
index 0000000..40e6f02
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/RowDeleteIT.java
@@ -0,0 +1,116 @@
+/*
+ * 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.apache.accumulo.test.functional.FunctionalTestUtils.checkRFiles;
+import static org.apache.accumulo.test.functional.FunctionalTestUtils.nm;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
+import org.apache.accumulo.core.iterators.user.RowDeletingIterator;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class RowDeleteIT extends MacTest {
+
+
+ @Override
+ public void configure(MiniAccumuloConfig cfg) {
+ cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "50ms"));
+ }
+
+ @Test(timeout=30*1000)
+ public void run() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("rdel1");
+ Map<String,Set<Text>> groups = new HashMap<String, Set<Text>>();
+ groups.put("lg1", Collections.singleton(new Text("foo")));
+ groups.put("dg", Collections.<Text>emptySet());
+ c.tableOperations().setLocalityGroups("rdel1", groups);
+ IteratorSetting setting = new IteratorSetting(30, RowDeletingIterator.class);
+ c.tableOperations().attachIterator("rdel1", setting, EnumSet.of(IteratorScope.majc));
+ c.tableOperations().setProperty("rdel1", Property.TABLE_MAJC_RATIO.getKey(), "100");
+
+ BatchWriter bw = c.createBatchWriter("rdel1", new BatchWriterConfig());
+
+ bw.addMutation(nm("r1", "foo", "cf1", "v1"));
+ bw.addMutation(nm("r1", "bar", "cf1", "v2"));
+
+ bw.flush();
+ c.tableOperations().flush("rdel1", null, null, true);
+
+ checkRFiles(c, "rdel1", 1, 1, 1, 1);
+
+ int count = 0;
+ Scanner scanner = c.createScanner("rdel1", Authorizations.EMPTY);
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : scanner) {
+ count++;
+ }
+ if (count != 2)
+ throw new Exception("1 count=" + count);
+
+ bw.addMutation(nm("r1", "", "", RowDeletingIterator.DELETE_ROW_VALUE));
+
+ bw.flush();
+ c.tableOperations().flush("rdel1", null, null, true);
+
+ checkRFiles(c, "rdel1", 1, 1, 2, 2);
+
+ count = 0;
+ scanner = c.createScanner("rdel1", Authorizations.EMPTY);
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : scanner) {
+ count++;
+ }
+ if (count != 3)
+ throw new Exception("2 count=" + count);
+
+ c.tableOperations().compact("rdel1", null, null, false, true);
+
+ checkRFiles(c, "rdel1", 1, 1, 0, 0);
+
+ count = 0;
+ scanner = c.createScanner("rdel1", Authorizations.EMPTY);
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : scanner) {
+ count++;
+ }
+ if (count != 0)
+ throw new Exception("3 count=" + count);
+
+ bw.close();
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java
new file mode 100644
index 0000000..5c71b30
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ScanIteratorIT.java
@@ -0,0 +1,125 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.ScannerBase;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class ScanIteratorIT extends MacTest {
+
+ @Test(timeout=30*1000)
+ public void run() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("foo");
+
+ BatchWriter bw = c.createBatchWriter("foo", new BatchWriterConfig());
+
+ for (int i = 0; i < 1000; i++) {
+ Mutation m = new Mutation(new Text(String.format("%06d", i)));
+ m.put(new Text("cf1"), new Text("cq1"), new Value(("" + (1000 - i)).getBytes()));
+ m.put(new Text("cf1"), new Text("cq2"), new Value(("" + (i - 1000)).getBytes()));
+
+ bw.addMutation(m);
+ }
+
+ bw.close();
+
+ Scanner scanner = c.createScanner("foo", new Authorizations());
+
+ setupIter(scanner);
+ verify(scanner, 1, 999);
+
+ BatchScanner bscanner = c.createBatchScanner("foo", new Authorizations(), 3);
+ bscanner.setRanges(Collections.singleton(new Range((Key) null, null)));
+
+ setupIter(bscanner);
+ verify(bscanner, 1, 999);
+
+ ArrayList<Range> ranges = new ArrayList<Range>();
+ ranges.add(new Range(new Text(String.format("%06d", 1))));
+ ranges.add(new Range(new Text(String.format("%06d", 6)), new Text(String.format("%06d", 16))));
+ ranges.add(new Range(new Text(String.format("%06d", 20))));
+ ranges.add(new Range(new Text(String.format("%06d", 23))));
+ ranges.add(new Range(new Text(String.format("%06d", 56)), new Text(String.format("%06d", 61))));
+ ranges.add(new Range(new Text(String.format("%06d", 501)), new Text(String.format("%06d", 504))));
+ ranges.add(new Range(new Text(String.format("%06d", 998)), new Text(String.format("%06d", 1000))));
+
+ HashSet<Integer> got = new HashSet<Integer>();
+ HashSet<Integer> expected = new HashSet<Integer>();
+ for (int i : new int[] {1, 7, 9, 11, 13, 15, 23, 57, 59, 61, 501, 503, 999}) {
+ expected.add(i);
+ }
+
+ bscanner.setRanges(ranges);
+
+ for (Entry<Key,Value> entry : bscanner) {
+ got.add(Integer.parseInt(entry.getKey().getRow().toString()));
+ }
+
+ System.out.println("got : " + got);
+
+ if (!got.equals(expected)) {
+ throw new Exception(got + " != " + expected);
+ }
+
+ bscanner.close();
+
+ }
+
+ private void verify(Iterable<Entry<Key,Value>> scanner, int start, int finish) throws Exception {
+
+ int expected = start;
+ for (Entry<Key,Value> entry : scanner) {
+ if (Integer.parseInt(entry.getKey().getRow().toString()) != expected) {
+ throw new Exception("Saw unexpexted " + entry.getKey().getRow() + " " + expected);
+ }
+
+ if (entry.getKey().getColumnQualifier().toString().equals("cq2")) {
+ expected += 2;
+ }
+ }
+
+ if (expected != finish + 2) {
+ throw new Exception("Ended at " + expected + " not " + (finish + 2));
+ }
+ }
+
+ private void setupIter(ScannerBase scanner) throws Exception {
+ IteratorSetting dropMod = new IteratorSetting(50, "dropMod", "org.apache.accumulo.test.functional.DropModIter");
+ dropMod.addOption("mod", "2");
+ dropMod.addOption("drop", "0");
+ scanner.addScanIterator(dropMod);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java
new file mode 100644
index 0000000..94369a3
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ScanRangeIT.java
@@ -0,0 +1,233 @@
+/*
+ * 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 java.util.Map.Entry;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+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.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class ScanRangeIT extends MacTest {
+
+ private static final int TS_LIMIT = 1;
+ private static final int CQ_LIMIT = 5;
+ private static final int CF_LIMIT = 5;
+ private static final int ROW_LIMIT = 100;
+
+ @Test(timeout=30*1000)
+ public void run() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("table1");
+ c.tableOperations().create("table2");
+ TreeSet<Text> splitRows = new TreeSet<Text>();
+ int splits = 3;
+ for (int i = (ROW_LIMIT / splits); i < ROW_LIMIT; i += (ROW_LIMIT / splits))
+ splitRows.add(createRow(i));
+ c.tableOperations().addSplits("table2", splitRows);
+
+ insertData(c, "table1");
+ scanTable(c, "table1");
+
+ insertData(c, "table2");
+ scanTable(c, "table2");
+ }
+
+ private void scanTable(Connector c, String table) throws Exception {
+ scanRange(c, table, new IntKey(0, 0, 0, 0), new IntKey(1, 0, 0, 0));
+
+ scanRange(c, table, new IntKey(0, 0, 0, 0), new IntKey(ROW_LIMIT - 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+
+ scanRange(c, table, null, null);
+
+ for (int i = 0; i < ROW_LIMIT; i += (ROW_LIMIT / 3)) {
+ for (int j = 0; j < CF_LIMIT; j += (CF_LIMIT / 2)) {
+ for (int k = 1; k < CQ_LIMIT; k += (CQ_LIMIT / 2)) {
+ scanRange(c, table, null, new IntKey(i, j, k, 0));
+ scanRange(c, table, new IntKey(0, 0, 0, 0), new IntKey(i, j, k, 0));
+
+ scanRange(c, table, new IntKey(i, j, k, 0), new IntKey(ROW_LIMIT - 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+
+ scanRange(c, table, new IntKey(i, j, k, 0), null);
+
+ }
+ }
+ }
+
+ for (int i = 0; i < ROW_LIMIT; i++) {
+ scanRange(c, table, new IntKey(i, 0, 0, 0), new IntKey(i, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+
+ if (i > 0 && i < ROW_LIMIT - 1) {
+ scanRange(c, table, new IntKey(i - 1, 0, 0, 0), new IntKey(i + 1, CF_LIMIT - 1, CQ_LIMIT - 1, 0));
+ }
+ }
+
+ }
+
+ private static class IntKey {
+ private int row;
+ private int cf;
+ private int cq;
+ private long ts;
+
+ IntKey(IntKey ik) {
+ this.row = ik.row;
+ this.cf = ik.cf;
+ this.cq = ik.cq;
+ this.ts = ik.ts;
+ }
+
+ IntKey(int row, int cf, int cq, long ts) {
+ this.row = row;
+ this.cf = cf;
+ this.cq = cq;
+ this.ts = ts;
+ }
+
+ Key createKey() {
+ Text trow = createRow(row);
+ Text tcf = createCF(cf);
+ Text tcq = createCQ(cq);
+
+ return new Key(trow, tcf, tcq, ts);
+ }
+
+ IntKey increment() {
+
+ IntKey ik = new IntKey(this);
+
+ ik.ts++;
+ if (ik.ts >= TS_LIMIT) {
+ ik.ts = 0;
+ ik.cq++;
+ if (ik.cq >= CQ_LIMIT) {
+ ik.cq = 0;
+ ik.cf++;
+ if (ik.cf >= CF_LIMIT) {
+ ik.cf = 0;
+ ik.row++;
+ }
+ }
+ }
+
+ return ik;
+ }
+
+ }
+
+ private void scanRange(Connector c, String table, IntKey ik1, IntKey ik2) throws Exception {
+ scanRange(c, table, ik1, false, ik2, false);
+ scanRange(c, table, ik1, false, ik2, true);
+ scanRange(c, table, ik1, true, ik2, false);
+ scanRange(c, table, ik1, true, ik2, true);
+ }
+
+ private void scanRange(Connector c, String table, IntKey ik1, boolean inclusive1, IntKey ik2, boolean inclusive2) throws Exception {
+ Scanner scanner = c.createScanner(table, Authorizations.EMPTY);
+
+ Key key1 = null;
+ Key key2 = null;
+
+ IntKey expectedIntKey;
+ IntKey expectedEndIntKey;
+
+ if (ik1 != null) {
+ key1 = ik1.createKey();
+ expectedIntKey = ik1;
+
+ if (!inclusive1) {
+ expectedIntKey = expectedIntKey.increment();
+ }
+ } else {
+ expectedIntKey = new IntKey(0, 0, 0, 0);
+ }
+
+ if (ik2 != null) {
+ key2 = ik2.createKey();
+ expectedEndIntKey = ik2;
+
+ if (inclusive2) {
+ expectedEndIntKey = expectedEndIntKey.increment();
+ }
+ } else {
+ expectedEndIntKey = new IntKey(ROW_LIMIT, 0, 0, 0);
+ }
+
+ Range range = new Range(key1, inclusive1, key2, inclusive2);
+
+ scanner.setRange(range);
+
+ for (Entry<Key,Value> entry : scanner) {
+
+ Key expectedKey = expectedIntKey.createKey();
+ if (!expectedKey.equals(entry.getKey())) {
+ throw new Exception(" " + expectedKey + " != " + entry.getKey());
+ }
+
+ expectedIntKey = expectedIntKey.increment();
+ }
+
+ if (!expectedIntKey.createKey().equals(expectedEndIntKey.createKey())) {
+ throw new Exception(" " + expectedIntKey.createKey() + " != " + expectedEndIntKey.createKey());
+ }
+ }
+
+ private static Text createCF(int cf) {
+ Text tcf = new Text(String.format("cf_%03d", cf));
+ return tcf;
+ }
+
+ private static Text createCQ(int cf) {
+ Text tcf = new Text(String.format("cq_%03d", cf));
+ return tcf;
+ }
+
+ private static Text createRow(int row) {
+ Text trow = new Text(String.format("r_%06d", row));
+ return trow;
+ }
+
+ private void insertData(Connector c, String table) throws Exception {
+
+ BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig());
+
+ for (int i = 0; i < ROW_LIMIT; i++) {
+ Mutation m = new Mutation(createRow(i));
+
+ for (int j = 0; j < CF_LIMIT; j++) {
+ for (int k = 0; k < CQ_LIMIT; k++) {
+ for (int t = 0; t < TS_LIMIT; t++) {
+ m.put(createCF(j), createCQ(k), t, new Value(String.format("%06d_%03d_%03d_%03d", i, j, k, t).getBytes()));
+ }
+ }
+ }
+
+ bw.addMutation(m);
+ }
+
+ bw.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java
new file mode 100644
index 0000000..6d066a6
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java
@@ -0,0 +1,104 @@
+/*
+ * 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 java.util.Collections;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class ScanSessionTimeOutIT extends MacTest {
+
+ @Override
+ public void configure(MiniAccumuloConfig cfg) {
+ cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_SESSION_MAXIDLE.getKey(), "3"));
+ }
+
+ @Test(timeout=30*1000)
+ public void run() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("abc");
+
+ BatchWriter bw = c.createBatchWriter("abc", new BatchWriterConfig());
+
+ for (int i = 0; i < 100000; i++) {
+ Mutation m = new Mutation(new Text(String.format("%08d", i)));
+ for (int j = 0; j < 3; j++)
+ m.put(new Text("cf1"), new Text("cq" + j), new Value(("" + i + "_" + j).getBytes()));
+
+ bw.addMutation(m);
+ }
+
+ bw.close();
+
+ Scanner scanner = c.createScanner("abc", new Authorizations());
+ scanner.setBatchSize(1000);
+
+ Iterator<Entry<Key,Value>> iter = scanner.iterator();
+
+ verify(iter, 0, 200);
+
+ // sleep three times the session timeout
+ UtilWaitThread.sleep(9000);
+
+ verify(iter, 200, 100000);
+
+ }
+
+ private void verify(Iterator<Entry<Key,Value>> iter, int start, int stop) throws Exception {
+ for (int i = start; i < stop; i++) {
+
+ Text er = new Text(String.format("%08d", i));
+
+ for (int j = 0; j < 3; j++) {
+ Entry<Key,Value> entry = iter.next();
+
+ if (!entry.getKey().getRow().equals(er)) {
+ throw new Exception("row " + entry.getKey().getRow() + " != " + er);
+ }
+
+ if (!entry.getKey().getColumnFamily().equals(new Text("cf1"))) {
+ throw new Exception("cf " + entry.getKey().getColumnFamily() + " != cf1");
+ }
+
+ if (!entry.getKey().getColumnQualifier().equals(new Text("cq" + j))) {
+ throw new Exception("cq " + entry.getKey().getColumnQualifier() + " != cq" + j);
+ }
+
+ if (!entry.getValue().toString().equals("" + i + "_" + j)) {
+ throw new Exception("value " + entry.getValue() + " != " + i + "_" + j);
+ }
+
+ }
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
new file mode 100644
index 0000000..3237fc1
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
@@ -0,0 +1,119 @@
+/*
+ * 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 java.util.Collections;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.iterators.Combiner;
+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 ServerSideErrorIT extends MacTest {
+
+ @Test
+ public void run() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("tt");
+ IteratorSetting is = new IteratorSetting(5, "Bad Aggregator", BadCombiner.class);
+ Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("acf")));
+ c.tableOperations().attachIterator("tt", is);
+
+ BatchWriter bw = c.createBatchWriter("tt", new BatchWriterConfig());
+
+ Mutation m = new Mutation(new Text("r1"));
+ m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
+
+ bw.addMutation(m);
+
+ bw.close();
+
+ // try to scan table
+ Scanner scanner = c.createScanner("tt", Authorizations.EMPTY);
+
+ boolean caught = false;
+ try {
+ for (Entry<Key,Value> entry : scanner) {
+ entry.getKey();
+ }
+ } catch (Exception e) {
+ caught = true;
+ }
+
+ if (!caught)
+ throw new Exception("Scan did not fail");
+
+ // try to batch scan the table
+ BatchScanner bs = c.createBatchScanner("tt", Authorizations.EMPTY, 2);
+ bs.setRanges(Collections.singleton(new Range()));
+
+ caught = false;
+ try {
+ for (Entry<Key,Value> entry : bs) {
+ entry.getKey();
+ }
+ bs.close();
+ } catch (Exception e) {
+ caught = true;
+ }
+ if (!caught)
+ throw new Exception("batch scan did not fail");
+
+ // remove the bad agg so accumulo can shutdown
+ TableOperations to = c.tableOperations();
+ for (Entry<String,String> e : to.getProperties("tt")) {
+ to.removeProperty("tt", e.getKey());
+ }
+
+ UtilWaitThread.sleep(500);
+
+ // should be able to scan now
+ scanner = c.createScanner("tt", Authorizations.EMPTY);
+ for (Entry<Key,Value> entry : scanner) {
+ entry.getKey();
+ }
+
+ // set a non existant iterator, should cause scan to fail on server side
+ scanner.addScanIterator(new IteratorSetting(100, "bogus", "com.bogus.iterator"));
+
+ caught = false;
+ try {
+ for (Entry<Key,Value> entry : scanner) {
+ // should error
+ entry.getKey();
+ }
+ } catch (Exception e) {
+ caught = true;
+ }
+
+ if (!caught)
+ throw new Exception("Scan did not fail");
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java
new file mode 100644
index 0000000..4d1b21b
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ShutdownIT.java
@@ -0,0 +1,104 @@
+/*
+ * 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.assertFalse;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.server.util.Admin;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.TestRandomDeletes;
+import org.apache.accumulo.test.VerifyIngest;
+import org.junit.Test;
+
+public class ShutdownIT extends MacTest {
+
+ @Test(timeout=60*1000)
+ public void shutdownDuringIngest() throws Exception {
+ Process ingest = cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable");
+ UtilWaitThread.sleep(100);
+ assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+ ingest.destroy();
+ }
+
+ @Test(timeout=60*1000)
+ public void shutdownDuringQuery() throws Exception {
+ assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable").waitFor());
+ Process verify = cluster.exec(VerifyIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD);
+ UtilWaitThread.sleep(100);
+ assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+ verify.destroy();
+ }
+
+ @Test(timeout=30*1000)
+ public void shutdownDuringDelete() throws Exception {
+ assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable").waitFor());
+ Process deleter = cluster.exec(TestRandomDeletes.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD);
+ UtilWaitThread.sleep(100);
+ assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+ deleter.destroy();
+ }
+
+
+ @Test(timeout=30*1000)
+ public void shutdownDuringDeleteTable() throws Exception {
+ final Connector c = getConnector();
+ for (int i = 0; i < 10 ; i++) {
+ c.tableOperations().create("table" + i);
+ }
+ final AtomicReference<Exception> ref = new AtomicReference<Exception>();
+ Thread async = new Thread() {
+ public void run() {
+ try {
+ for (int i = 0; i < 10; i++)
+ c.tableOperations().delete("table" + i);
+ } catch (Exception ex) {
+ ref.set(ex);
+ }
+ }
+ };
+ async.start();
+ UtilWaitThread.sleep(100);
+ assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+ if (ref.get() != null)
+ throw ref.get();
+ }
+
+ @Test(timeout=60*1000)
+ public void stopDuringStart() throws Exception {
+ assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+ }
+
+ @Test(timeout=30*1000)
+ public void adminStop() throws Exception {
+ Connector c = getConnector();
+ assertEquals(0, cluster.exec(TestIngest.class, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "-p", MacTest.PASSWORD, "--createTable").waitFor());
+ List<String> tabletServers = c.instanceOperations().getTabletServers();
+ assertEquals(2, tabletServers.size());
+ String doomed = tabletServers.get(0);
+ assertEquals(0, cluster.exec(Admin.class, "stop", doomed).waitFor());
+ tabletServers = c.instanceOperations().getTabletServers();
+ assertEquals(1, tabletServers.size());
+ assertFalse(tabletServers.get(0).equals(doomed));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
new file mode 100644
index 0000000..620dc47
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
@@ -0,0 +1,90 @@
+/*
+ * 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.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.MasterClient;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.master.thrift.MasterClientService;
+import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
+import org.apache.accumulo.core.master.thrift.TableInfo;
+import org.apache.accumulo.core.master.thrift.TabletServerStatus;
+import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.trace.instrument.Tracer;
+import org.junit.Test;
+
+public class SimpleBalancerFairnessIT extends MacTest {
+
+ @Override
+ public void configure(MiniAccumuloConfig cfg) {
+ Map<String,String> siteConfig = new HashMap<String, String>();
+ siteConfig.put(Property.TSERV_MAXMEM.getKey(), "10K");
+ siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "0");
+ cfg.setSiteConfig(siteConfig );
+ }
+
+ @Test(timeout=120*1000)
+ public void simpleBalancerFairness() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("test_ingest");
+ c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+ c.tableOperations().create("unused");
+ c.tableOperations().addSplits("unused", TestIngest.getSplitPoints(0, 10000000, 2000));
+ List<String> tservers = c.instanceOperations().getTabletServers();
+ TestIngest.Opts opts = new TestIngest.Opts();
+ opts.rows = 200000;
+ TestIngest.ingest(c, opts, new BatchWriterOpts());
+ c.tableOperations().flush("test_ingest", null, null, false);
+ UtilWaitThread.sleep(15*1000);
+ TCredentials creds = CredentialHelper.create("root", new PasswordToken(MacTest.PASSWORD), c.getInstance().getInstanceName());
+
+ MasterClientService.Iface client = null;
+ MasterMonitorInfo stats = null;
+ try {
+ client = MasterClient.getConnectionWithRetry(c.getInstance());
+ stats = client.getMasterStats(Tracer.traceInfo(), creds);
+ } finally {
+ if (client != null)
+ MasterClient.close(client);
+ }
+ List<Integer> counts = new ArrayList<Integer>();
+ for (TabletServerStatus server: stats.tServerInfo) {
+ int count = 0;
+ for (TableInfo table : server.tableMap.values()) {
+ count += table.onlineTablets;
+ }
+ counts.add(count);
+ }
+ assertTrue(counts.size() > 1);
+ for (int i = 1; i < counts.size(); i++)
+ assertTrue(Math.abs(counts.get(0) - counts.get(i)) <= tservers.size());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
new file mode 100644
index 0000000..1f4a3fc
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
@@ -0,0 +1,102 @@
+/*
+ * 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 java.util.Iterator;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+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.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+/**
+ * This test recreates issue ACCUMULO-516. Until that issue is fixed this test should time out.
+ */
+public class SparseColumnFamilyIT extends MacTest {
+
+ @Test(timeout=30*1000)
+ public void sparceColumnFamily() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("scftt");
+
+ BatchWriter bw = c.createBatchWriter("scftt", new BatchWriterConfig());
+
+ // create file in the tablet that has mostly column family 0, with a few entries for column family 1
+
+ bw.addMutation(nm(0, 1, 0));
+ for (int i = 1; i < 99999; i++) {
+ bw.addMutation(nm(i * 2, 0, i));
+ }
+ bw.addMutation(nm(99999 * 2, 1, 99999));
+ bw.flush();
+
+ c.tableOperations().flush("scftt", null, null, true);
+
+ // create a file that has column family 1 and 0 interleaved
+ for (int i = 0; i < 100000; i++) {
+ bw.addMutation(nm(i * 2 + 1, i % 2 == 0 ? 0 : 1, i));
+ }
+ bw.close();
+
+ c.tableOperations().flush("scftt", null, null, true);
+
+ Scanner scanner = c.createScanner("scftt", Authorizations.EMPTY);
+
+ for (int i = 0; i < 200; i++) {
+
+ // every time we search for column family 1, it will scan the entire file
+ // that has mostly column family 0 until the bug is fixed
+ scanner.setRange(new Range(String.format("%06d", i), null));
+ scanner.clearColumns();
+ scanner.setBatchSize(3);
+ scanner.fetchColumnFamily(new Text(String.format("%03d", 1)));
+
+ long t1 = System.currentTimeMillis();
+ Iterator<Entry<Key,Value>> iter = scanner.iterator();
+ if (iter.hasNext()) {
+ Entry<Key,Value> entry = iter.next();
+ if (!"001".equals(entry.getKey().getColumnFamilyData().toString())) {
+ throw new Exception();
+ }
+ }
+ long t2 = System.currentTimeMillis();
+
+ System.out.println("time " + (t2 - t1));
+
+ }
+ }
+
+ /**
+ * @param i
+ * @param j
+ * @param k
+ * @return
+ */
+ private Mutation nm(int row, int cf, int val) {
+ Mutation m = new Mutation(String.format("%06d", row));
+ m.put(String.format("%03d", cf), "", "" + val);
+ return m;
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
new file mode 100644
index 0000000..dc4adc2
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
@@ -0,0 +1,103 @@
+/*
+ * 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.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.server.util.CheckForMetadataProblems;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+public class SplitIT extends MacTest {
+
+ @Override
+ public void configure(MiniAccumuloConfig cfg) {
+ Map<String, String> siteConfig = new HashMap<String, String>();
+ siteConfig.put(Property.TSERV_MAXMEM.getKey(), "5K");
+ siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
+ cfg.setSiteConfig(siteConfig);
+ }
+
+ @Test(timeout=60*1000)
+ public void tabletShouldSplit() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("test_ingest");
+ c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "256K");
+ c.tableOperations().setProperty("test_ingest", Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K");
+ TestIngest.Opts opts = new TestIngest.Opts();
+ opts.rows = 100000;
+ TestIngest.ingest(c, opts, new BatchWriterOpts());
+ VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+ vopts.rows = opts.rows;
+ VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+ UtilWaitThread.sleep(10*1000);
+ String id = c.tableOperations().tableIdMap().get("test_ingest");
+ Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+ KeyExtent extent = new KeyExtent(new Text(id), null, null);
+ s.setRange(extent.toMetadataRange());
+ MetadataTable.PREV_ROW_COLUMN.fetch(s);
+ int count = 0;
+ int shortened = 0;
+ for (Entry<Key,Value> entry : s) {
+ extent = new KeyExtent(entry.getKey().getRow(), entry.getValue());
+ if (extent.getEndRow() != null && extent.getEndRow().toString().length() < 14)
+ shortened++;
+ count++;
+ }
+ assertTrue(shortened > 0);
+ assertTrue(count > 10);
+ assertEquals(0, cluster.exec(CheckForMetadataProblems.class, "-i", cluster.getInstanceName(), "-u", "root", "-p", MacTest.PASSWORD, "-z", cluster.getZooKeepers()).waitFor());
+ }
+
+ @Test(timeout=60*1000)
+ public void interleaveSplit() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("test_ingest");
+ c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+ ReadWriteIT.interleaveTest(c);
+ UtilWaitThread.sleep(10*1000);
+ assertTrue(c.tableOperations().listSplits("test_ingest").size() > 20);
+ }
+
+ @Test(timeout=120*1000)
+ public void deleteSplit() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("test_ingest");
+ c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+ DeleteIT.deleteTest(c);
+ assertTrue(c.tableOperations().listSplits("test_ingest").size() > 30);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java b/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java
new file mode 100644
index 0000000..3a7fc93
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java
@@ -0,0 +1,33 @@
+/*
+ * 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.*;
+
+import org.apache.accumulo.start.TestMain;
+import org.junit.Test;
+
+public class StartIT extends MacTest {
+
+ @Test(timeout=10*1000)
+ public void test() throws Exception {
+ assertTrue(cluster.exec(TestMain.class, "exception").waitFor() != 0);
+ assertEquals(0, cluster.exec(TestMain.class, "success").waitFor());
+ assertTrue(cluster.exec(TestMain.class).waitFor() != 0);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java b/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
new file mode 100644
index 0000000..d92088e
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
@@ -0,0 +1,75 @@
+package org.apache.accumulo.test.functional;
+/*
+ * 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.
+ */
+import static org.junit.Assert.*;
+
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.cli.ScannerOpts;
+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.KeyExtent;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.server.util.Admin;
+import org.apache.accumulo.test.TestIngest;
+import org.apache.accumulo.test.VerifyIngest;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+
+public class TableIT extends MacTest {
+
+ @Test(timeout=60*1000)
+ public void test() throws Exception {
+ Connector c = getConnector();
+ c.tableOperations().create("test_ingest");
+ TestIngest.Opts opts = new TestIngest.Opts();
+ TestIngest.ingest(c, opts, new BatchWriterOpts());
+ VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+ VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+ String id = c.tableOperations().tableIdMap().get("test_ingest");
+ Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+ s.setRange(new KeyExtent(new Text(id), null, null).toMetadataRange());
+ int count = 0;
+ for (@SuppressWarnings("unused") Entry<Key,Value> entry : s) {
+ count++;
+ }
+ assertTrue(count > 0);
+ FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
+ assertTrue(fs.listStatus(new Path(cluster.getConfig().getDir() + "/accumulo/tables/" + id)).length > 0);
+ c.tableOperations().delete("test_ingest");
+ count = 0;
+ for (@SuppressWarnings("unused") Entry<Key,Value> entry : s) {
+ count++;
+ }
+ assertEquals(0, count);
+ assertEquals(0, fs.listStatus(new Path(cluster.getConfig().getDir() + "/accumulo/tables/" + id)).length);
+ assertNull(c.tableOperations().tableIdMap().get("test_ingest"));
+ c.tableOperations().create("test_ingest");
+ TestIngest.ingest(c, opts, new BatchWriterOpts());
+ VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+ assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java b/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java
new file mode 100644
index 0000000..f222a04
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java
@@ -0,0 +1,47 @@
+/*
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.test.CreateTestTable;
+import org.junit.Test;
+
+public class TabletIT extends MacTest {
+
+ private static final int N = 1000;
+
+ @Override
+ public void configure(MiniAccumuloConfig cfg) {
+ Map<String, String> siteConfig = new HashMap<String,String>();
+ siteConfig.put(Property.TABLE_SPLIT_THRESHOLD.getKey(), "200");
+ siteConfig.put(Property.TSERV_MAXMEM.getKey(), "128M");
+ cfg.setSiteConfig(siteConfig);
+ }
+
+ @Test(timeout=30*1000)
+ public void test() throws Exception {
+ assertEquals(0, cluster.exec(CreateTestTable.class, "" + N).waitFor());
+ assertEquals(0, cluster.exec(CreateTestTable.class, "-readonly", "" + N).waitFor());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java b/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java
new file mode 100644
index 0000000..c9c9d3b
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java
@@ -0,0 +1,115 @@
+/*
+ * 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 java.util.Collections;
+import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.core.client.TimedOutException;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class TimeoutIT extends MacTest {
+
+ @Test
+ public void run() throws Exception {
+ Connector conn = getConnector();
+ testBatchWriterTimeout(conn);
+ testBatchScannerTimeout(conn);
+ }
+
+ public void testBatchWriterTimeout(Connector conn) throws Exception {
+ conn.tableOperations().create("foo1");
+ conn.tableOperations().addConstraint("foo1", SlowConstraint.class.getName());
+
+ // give constraint time to propagate through zookeeper
+ UtilWaitThread.sleep(250);
+
+ BatchWriter bw = conn.createBatchWriter("foo1", new BatchWriterConfig().setTimeout(3, TimeUnit.SECONDS));
+
+ Mutation mut = new Mutation("r1");
+ mut.put("cf1", "cq1", "v1");
+
+ bw.addMutation(mut);
+ try {
+ bw.close();
+ fail("batch writer did not timeout");
+ } catch (MutationsRejectedException mre) {
+ if (!(mre.getCause() instanceof TimedOutException)) {
+ throw mre;
+ }
+ }
+ }
+
+ public void testBatchScannerTimeout(Connector conn) throws Exception {
+ getConnector().tableOperations().create("timeout");
+
+ BatchWriter bw = getConnector().createBatchWriter("timeout", new BatchWriterConfig());
+
+ Mutation m = new Mutation("r1");
+ m.put("cf1", "cq1", "v1");
+ m.put("cf1", "cq2", "v2");
+ m.put("cf1", "cq3", "v3");
+ m.put("cf1", "cq4", "v4");
+
+ bw.addMutation(m);
+
+ bw.close();
+
+ BatchScanner bs = getConnector().createBatchScanner("timeout", Authorizations.EMPTY, 2);
+ bs.setTimeout(1, TimeUnit.SECONDS);
+ bs.setRanges(Collections.singletonList(new Range()));
+
+ // should not timeout
+ for (Entry<Key,Value> entry : bs) {
+ entry.getKey();
+ }
+
+ IteratorSetting iterSetting = new IteratorSetting(100, SlowIterator.class);
+ iterSetting.addOption("sleepTime", 2000 + "");
+ getConnector().tableOperations().attachIterator("timeout", iterSetting);
+ UtilWaitThread.sleep(250);
+
+ try {
+ for (Entry<Key,Value> entry : bs) {
+ entry.getKey();
+ }
+ fail("batch scanner did not time out");
+ } catch (TimedOutException toe) {
+ // toe.printStackTrace();
+ }
+
+ bs.close();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/system/auto/simple/examples.py
----------------------------------------------------------------------
diff --git a/test/system/auto/simple/examples.py b/test/system/auto/simple/examples.py
deleted file mode 100755
index 069148d..0000000
--- a/test/system/auto/simple/examples.py
+++ /dev/null
@@ -1,348 +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.
-
-import os
-
-import logging
-import unittest
-import time
-import sys
-import glob
-
-from TestUtils import TestUtilsMixin, ACCUMULO_HOME, SITE, ROOT, ROOT_PASSWORD, INSTANCE_NAME, ZOOKEEPERS
-
-table='testTable'
-count=str(10000)
-min=str(0)
-max=str(99999)
-valueSize=str(100)
-memory=str(1<<20)
-latency=str(1000)
-numThreads=str(4)
-visibility='A|B'
-auths='A,B'
-
-log = logging.getLogger('test.auto')
-
-class Examples(TestUtilsMixin, unittest.TestCase):
- "Start a clean accumulo, run the examples"
- order = 21
-
- def runExample(self, cmd):
- return self.wait(self.runOn(self.masterHost(), [self.accumulo_sh(),] + cmd))
-
- def ashell(self, input, expected = 0):
- out, err, code = self.shell(self.masterHost(), input + '\n')
- self.assert_(code == expected)
- return out
-
- def comment(self, description):
- LINE = '-'*40
- log.info(LINE)
- log.info(description)
- log.info(LINE)
-
- def execute(self, *cmd):
- self.wait(self.runOn('localhost', cmd))
-
- def runTest(self):
- examplesJar = glob.glob(ACCUMULO_HOME+'/lib/accumulo-examples-simple*.jar')[0]
-
- self.comment("Testing MaxMutation constraint")
- self.ashell('createtable test_ingest\n'
- 'constraint -a org.apache.accumulo.examples.simple.constraints.MaxMutationSize\n')
- handle = self.runOn('localhost', [self.accumulo_sh(), 'org.apache.accumulo.test.TestIngest', '-u', ROOT, '--rows', '1', '--start', '0', '--cols', '10000', '-p', ROOT_PASSWORD])
- out, err = handle.communicate()
- self.failIf(handle.returncode==0)
- self.failUnless(err.find("MutationsRejectedException: # constraint violations : 1") >= 0, "Was able to insert a mutation larger than max size")
-
- self.ashell('createtable %s\nsetauths -u %s -s A,B\nquit\n' %(table, ROOT))
- self.comment("Testing dirlist example (a little)")
- self.comment(" ingesting accumulo source")
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.examples.simple.dirlist.Ingest',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-u', ROOT, '-p', ROOT_PASSWORD,
- '--dirTable', 'dirTable',
- '--indexTable', 'indexTable',
- '--dataTable', 'dataTable',
- '--vis', visibility,
- '--chunkSize', 100000,
- ACCUMULO_HOME+"/test")
- self.comment(" searching for a file")
- handle = self.runOn('localhost', [self.accumulo_sh(), 'org.apache.accumulo.examples.simple.dirlist.QueryUtil',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-u', ROOT, '-p', ROOT_PASSWORD,
- '-t', 'indexTable', '--auths', auths, '--search', '--path', 'examples.py'])
- out, err = handle.communicate()
- self.assert_(handle.returncode == 0)
- self.assert_(out.find('test/system/auto/simple/examples.py') >= 0)
- self.comment(" found file at " + out)
-
-
- self.comment("Testing ageoff filtering")
- out = self.ashell("createtable filtertest\n"
- "setiter -t filtertest -scan -p 10 -n myfilter -ageoff\n"
- "\n"
- "5000\n"
- "\n"
- "insert foo a b c\n"
- "scan\n"
- "sleep 5\n"
- "scan\n")
- self.assert_(2 == len([line for line in out.split('\n') if line.find('foo') >= 0]))
-
- self.comment("Testing bloom filters are fast for missing data")
- self.ashell('createtable bloom_test\nconfig -t bloom_test -s table.bloom.enabled=true\n')
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.examples.simple.client.RandomBatchWriter', '--seed', '7',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-u', ROOT, '-p', ROOT_PASSWORD, '-t', 'bloom_test',
- '--num', '1000000', '--min', '0', '--max', '1000000000', '--size', '50', '--batchMemory', '2M', '--batchLatency', '60s',
- '--batchThreads', '3')
- self.ashell('flush -t bloom_test -w\n')
- now = time.time()
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.examples.simple.client.RandomBatchScanner', '--seed', '7',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-u', ROOT, '-p', ROOT_PASSWORD, '-t', 'bloom_test',
- '--num', '500', '--min', '0', '--max', '1000000000', '--size', '50', '--scanThreads', 4)
- diff = time.time() - now
- now = time.time()
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.examples.simple.client.RandomBatchScanner', '--seed', '8',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-u', ROOT, '-p', ROOT_PASSWORD, '-t', 'bloom_test',
- '--num', '500', '--min', '0', '--max', '1000000000', '--size', '50', '--scanThreads', 4)
- diff2 = time.time() - now
- self.assert_(diff2 < diff)
-
- self.comment("Creating a sharded index of the accumulo java files")
- self.ashell('createtable shard\ncreatetable doc2term\nquit\n')
- self.execute('/bin/sh', '-c',
- 'find src -name "*.java" | xargs ./bin/accumulo org.apache.accumulo.simple.examples.shard.Index -i %s -z %s -t shard -u %s -p %s --partitions 30' %
- (INSTANCE_NAME, ZOOKEEPERS, ROOT, ROOT_PASSWORD))
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.simple.examples.shard.Query',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-t', 'shard', '-u', ROOT, '-p', ROOT_PASSWORD,
- 'foo', 'bar')
- self.comment("Creating a word index of the sharded files")
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.simple.examples.shard.Reverse',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-t', 'shard', '--doc2Term', 'doc2term', '-u', ROOT, '-p', ROOT_PASSWORD)
- self.comment("Making 1000 conjunctive queries of 5 random words")
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.simple.examples.shard.ContinuousQuery',
- '-i', INSTANCE_NAME, '-z', ZOOKEEPERS, '-t', 'shard', '--doc2Term', 'doc2term', '-u', ROOT, '-p', ROOT_PASSWORD, '--term', 5, '--count', 1000)
-
- self.execute('hadoop', 'fs', '-rmr', "/tmp/input", "/tmp/files", "/tmp/splits.txt", "/tmp/failures")
- self.execute('hadoop', 'fs', '-mkdir', "/tmp/input")
- self.comment("Starting bulk ingest example")
- self.comment(" Creating some test data")
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.simple.examples.mapreduce.bulk.GenerateTestData', 0, 1000000, '/tmp/input/data')
- self.execute(self.accumulo_sh(), 'org.apache.accumulo.simple.examples.mapreduce.bulk.SetupTable',
- INSTANCE_NAME, ZOOKEEPERS, ROOT, ROOT_PASSWORD, 'bulkTable')
- self.execute(ACCUMULO_HOME+'/bin/tool.sh', examplesJar, 'org.apache.accumulo.simple.examples.mapreduce.bulk.BulkIngestExample',
- INSTANCE_NAME, ZOOKEEPERS, ROOT, ROOT_PASSWORD, 'bulkTable', '/tmp/input', '/tmp')
- self.execute(ACCUMULO_HOME+'/bin/tool.sh', examplesJar, 'org.apache.accumulo.simple.examples.mapreduce.bulk.VerifyIngest',
- INSTANCE_NAME, ZOOKEEPERS, ROOT, ROOT_PASSWORD, 'bulkTable', 0, 1000000)
- self.wait(self.runOn(self.masterHost(), [
- 'hadoop', 'fs', '-rmr', "/tmp/tableFile", "/tmp/nines"
- ]))
- self.comment("Running TeraSortIngest for a million rows")
- # 10,000 times smaller than the real terasort
- ROWS = 1000*1000
- self.wait(self.runOn(self.masterHost(), [
- ACCUMULO_HOME+'/bin/tool.sh',
- examplesJar,
- 'org.apache.accumulo.simple.examples.mapreduce.TeraSortIngest',
- '--count', ROWS,
- '-nk', 10, '-xk', 10,
- '-nk', 78, '-xk', 78,
- '-t', 'sorted',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '--splits', 4]))
- self.comment("Looking for '999' in all rows")
- self.wait(self.runOn(self.masterHost(), [
- ACCUMULO_HOME+'/bin/tool.sh',
- examplesJar,
- 'org.apache.accumulo.simple.examples.mapreduce.RegexExample',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', 'sorted',
- '--rowRegex', '.*999.*',
- '/tmp/nines']))
- self.comment("Generating hashes of each row into a new table")
- self.wait(self.runOn(self.masterHost(), [
- ACCUMULO_HOME+'/bin/tool.sh',
- examplesJar,
- 'org.apache.accumulo.simple.examples.mapreduce.RowHash',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', 'sorted',
- '--column', ':',
- 'sortedHashed',
- ]))
- self.comment("Exporting the table to HDFS")
- self.wait(self.runOn(self.masterHost(), [
- ACCUMULO_HOME+'/bin/tool.sh',
- examplesJar,
- 'org.apache.accumulo.simple.examples.mapreduce.TableToFile',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', 'sorted',
- '--output', '/tmp/tableFile'
- ]))
- self.comment("Running WordCount using Accumulo aggregators")
- self.wait(self.runOn(self.masterHost(), [
- 'hadoop', 'fs', '-rmr', "/tmp/wc"
- ]))
- self.wait(self.runOn(self.masterHost(), [
- 'hadoop', 'fs', '-mkdir', "/tmp/wc"
- ]))
- self.wait(self.runOn(self.masterHost(), [
- 'hadoop', 'fs', '-copyFromLocal', ACCUMULO_HOME + "/README", "/tmp/wc/Accumulo.README"
- ]))
- self.ashell('createtable wordCount\nsetiter -scan -majc -minc -p 10 -n sum -class org.apache.accumulo.core.iterators.user.SummingCombiner\n\ncount\n\nSTRING\nquit\n')
- self.wait(self.runOn(self.masterHost(), [
- ACCUMULO_HOME+'/bin/tool.sh',
- examplesJar,
- 'org.apache.accumulo.simple.examples.mapreduce.WordCount',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '--input', '/tmp/wc',
- '-t', 'wctable'
- ]))
- self.comment("Inserting data with a batch writer")
- self.runExample(['org.apache.accumulo.simple.examples.helloworld.InsertWithBatchWriter',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-t', 'helloBatch',
- '-u', ROOT,
- '-p', ROOT_PASSWORD])
- self.comment("Reading data")
- self.runExample(['org.apache.accumulo.simple.examples.helloworld.ReadData',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-t', 'helloBatch',
- '-u', ROOT,
- '-p', ROOT_PASSWORD])
- self.comment("Running isolated scans")
- self.runExample(['org.apache.accumulo.simple.examples.isolation.InterferenceTest',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', 'itest1',
- '--iterations', 100000,
- '--isolated'])
- self.comment("Running scans without isolation")
- self.runExample(['org.apache.accumulo.simple.examples.isolation.InterferenceTest',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', 'itest2',
- '--iterations', 100000])
- self.comment("Using some example constraints")
- self.ashell('\n'.join([
- 'createtable testConstraints',
- 'constraint -t testConstraints -a org.apache.accumulo.examples.simple.constraints.NumericValueConstraint',
- 'constraint -t testConstraints -a org.apache.accumulo.examples.simple.constraints.AlphaNumKeyConstraint',
- 'insert r1 cf1 cq1 1111',
- 'insert r1 cf1 cq1 ABC',
- 'scan',
- 'quit'
- ]), 1)
- self.comment("Performing some row operations")
- self.runExample(['org.apache.accumulo.simple.examples.client.RowOperations',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD ])
- self.comment("Using the batch writer")
- self.runExample(['org.apache.accumulo.simple.examples.client.SequentialBatchWriter',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', table,
- '--start', min,
- '--num', count,
- '--size', valueSize,
- '--batchMemory', memory,
- '--batchLatency', latency,
- '--batchThreads', numThreads,
- '--vis', visibility])
- self.comment("Reading and writing some data")
- self.runExample(['org.apache.accumulo.simple.examples.client.ReadWriteExample',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '--auths', auths,
- '-t', table,
- '--createtable',
- '-c',
- '--debug'])
- self.comment("Deleting some data")
- self.runExample(['org.apache.accumulo.simple.examples.client.ReadWriteExample',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-s', auths,
- '-t', table,
- '-d',
- '--debug'])
- self.comment("Writing some random data with the batch writer")
- self.runExample(['org.apache.accumulo.simple.examples.client.RandomBatchWriter',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', table,
- '--num', count,
- '--min', min,
- '--max', max,
- '--size', valueSize,
- '--batchMemory', memory,
- '--batchLatency', latency,
- '--batchThreads', numThreads,
- '--vis', visibility])
- self.comment("Writing some random data with the batch writer")
- self.runExample(['org.apache.accumulo.simple.examples.client.RandomBatchScanner',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', table,
- '--num', count,
- '--min', min,
- '--max', max,
- '--size', valueSize,
- '--scanThreads', numThreads,
- '--auths', auths]);
- self.comment("Running an example table operation (Flush)")
- self.runExample(['org.apache.accumulo.simple.examples.client.Flush',
- '-i', INSTANCE_NAME,
- '-z', ZOOKEEPERS,
- '-u', ROOT,
- '-p', ROOT_PASSWORD,
- '-t', table])
- self.shutdown_accumulo();
-
-
-def suite():
- result = unittest.TestSuite()
- result.addTest(Examples())
- return result
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/system/auto/simple/fateStartvation.py
----------------------------------------------------------------------
diff --git a/test/system/auto/simple/fateStartvation.py b/test/system/auto/simple/fateStartvation.py
deleted file mode 100755
index 6c5151c..0000000
--- a/test/system/auto/simple/fateStartvation.py
+++ /dev/null
@@ -1,30 +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.
-
-from JavaTest import JavaTest
-
-import unittest
-
-class FateStarvationTest(JavaTest):
- "Try to trigger a bug that was found in FATE"
-
- order = 21
- testClass="org.apache.accumulo.test.functional.FateStarvationTest"
-
-
-def suite():
- result = unittest.TestSuite()
- result.addTest(FateStarvationTest())
- return result
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/system/auto/simple/gc.py
----------------------------------------------------------------------
diff --git a/test/system/auto/simple/gc.py b/test/system/auto/simple/gc.py
deleted file mode 100755
index f06467f..0000000
--- a/test/system/auto/simple/gc.py
+++ /dev/null
@@ -1,120 +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.
-
-import os
-
-import glob
-import logging
-import unittest
-import sleep
-import signal
-
-from TestUtils import ROOT, ROOT_PASSWORD, INSTANCE_NAME, TestUtilsMixin, ACCUMULO_HOME, ACCUMULO_DIR, ZOOKEEPERS, ID
-from simple.readwrite import SunnyDayTest
-
-log = logging.getLogger('test.auto')
-
-class GCTest(SunnyDayTest):
-
- order = SunnyDayTest.order + 1
-
- settings = SunnyDayTest.settings.copy()
- settings.update({
- 'gc.cycle.start': 1,
- 'gc.cycle.delay': 1,
- 'tserver.memory.maps.max':'5K',
- 'tserver.compaction.major.delay': 1,
- })
- tableSettings = SunnyDayTest.tableSettings.copy()
- tableSettings['test_ingest'] = {
- 'table.split.threshold': '5K',
- }
-
- def fileCount(self):
- handle = self.runOn(self.masterHost(),
- ['hadoop', 'fs', '-lsr', ACCUMULO_DIR+"/tables"])
- out, err = handle.communicate()
- return len(out.split('\n'))
-
- def waitForFileCountToStabilize(self):
- count = self.fileCount()
- while True:
- self.sleep(5)
- update = self.fileCount()
- if update == count:
- return count
- count = update
-
- def runTest(self):
- self.stop_gc(self.masterHost())
- self.waitForStop(self.ingester, 60)
- self.shell(self.masterHost(), 'flush -t test_ingest -w')
-
- count = self.waitForFileCountToStabilize()
- gc = self.runOn(self.masterHost(), [self.accumulo_sh(), 'gc'])
- self.sleep(10)
- collected = self.fileCount()
- self.assert_(count > collected)
-
- handle = self.runOn(self.masterHost(),
- ['grep', '-q', 'root_tablet'] +
- glob.glob(os.path.join(ACCUMULO_HOME,'logs',ID,'gc_*')))
- out, err = handle.communicate()
- self.assert_(handle.returncode != 0)
- self.pkill(self.masterHost(), 'app=gc', signal.SIGHUP)
- self.wait(gc)
- log.info("Verifying Ingestion")
- self.waitForStop(self.verify(self.masterHost(), self.options.rows),
- 10)
- self.shutdown_accumulo()
-
-class GCLotsOfCandidatesTest(TestUtilsMixin, unittest.TestCase):
-
- order = GCTest.order + 1
- settings = SunnyDayTest.settings.copy()
- settings.update({
- 'gc.cycle.start': 1,
- 'gc.cycle.delay': 1
- })
-
- def runTest(self):
- self.stop_gc(self.masterHost())
- log.info("Filling !METADATA table with bogus delete flags")
- prep = self.runOn(self.masterHost(),
- [self.accumulo_sh(),
- 'org.apache.accumulo.test.GCLotsOfCandidatesTest',
- '-i',INSTANCE_NAME,'-z', ZOOKEEPERS,'-u', ROOT, '-p', ROOT_PASSWORD])
- out, err = prep.communicate()
- self.assert_(prep.returncode == 0)
-
- log.info("Running GC with low memory allotment")
- gc = self.runOn('localhost',
- ['bash', '-c', 'ACCUMULO_GC_OPTS="-Xmx10m " ' + self.accumulo_sh() + ' gc'])
- self.sleep(10)
- self.pkill('localhost', 'app=gc', signal.SIGHUP)
- self.wait(gc)
-
- log.info("Verifying GC ran out of memory and cycled instead of giving up")
- grep = self.runOn('localhost',
- ['grep', '-q', 'delete candidates has exceeded'] +
- glob.glob(os.path.join(ACCUMULO_HOME,'logs', ID, 'gc_*')))
- out, err = grep.communicate()
- self.assert_(grep.returncode == 0)
-
-def suite():
- result = unittest.TestSuite()
- result.addTest(GCTest())
- result.addTest(GCLotsOfCandidatesTest())
- return result
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/system/auto/simple/largeRow.py
----------------------------------------------------------------------
diff --git a/test/system/auto/simple/largeRow.py b/test/system/auto/simple/largeRow.py
deleted file mode 100755
index b0ca92a..0000000
--- a/test/system/auto/simple/largeRow.py
+++ /dev/null
@@ -1,30 +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.
-
-from JavaTest import JavaTest
-
-import unittest
-
-class LargeRowTest(JavaTest):
- "Test large rows"
-
- order = 21
- testClass="org.apache.accumulo.test.functional.LargeRowTest"
-
-
-def suite():
- result = unittest.TestSuite()
- result.addTest(LargeRowTest())
- return result
http://git-wip-us.apache.org/repos/asf/accumulo/blob/aea43136/test/system/auto/simple/logicalTime.py
----------------------------------------------------------------------
diff --git a/test/system/auto/simple/logicalTime.py b/test/system/auto/simple/logicalTime.py
deleted file mode 100755
index 406eda6..0000000
--- a/test/system/auto/simple/logicalTime.py
+++ /dev/null
@@ -1,30 +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.
-
-from JavaTest import JavaTest
-
-import unittest
-
-class LogicalTimeTest(JavaTest):
- "Logical Time Test"
-
- order = 21
- testClass="org.apache.accumulo.test.functional.LogicalTimeTest"
-
-
-def suite():
- result = unittest.TestSuite()
- result.addTest(LogicalTimeTest())
- return result