You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/07/02 22:57:23 UTC
svn commit: r1499110 [3/3] - in /accumulo/trunk:
core/src/main/java/org/apache/accumulo/core/conf/
server/src/main/java/org/apache/accumulo/server/util/
test/src/main/java/org/apache/accumulo/test/
test/src/main/java/org/apache/accumulo/test/functional...
Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java?rev=1499110&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java Tue Jul 2 20:57:21 2013
@@ -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);
+ }
+
+}
Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/StartIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java?rev=1499110&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java Tue Jul 2 20:57:21 2013
@@ -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());
+ }
+
+}
Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java?rev=1499110&view=auto
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java (added)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java Tue Jul 2 20:57:21 2013
@@ -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());
+ }
+
+}
Propchange: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TabletIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java (from r1498909, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/TimeoutTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/TimeoutTest.java&r1=1498909&r2=1499110&rev=1499110&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/TimeoutTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java Tue Jul 2 20:57:21 2013
@@ -17,8 +17,6 @@
package org.apache.accumulo.test.functional;
import java.util.Collections;
-import java.util.List;
-import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
@@ -35,36 +33,26 @@ import org.apache.accumulo.core.data.Ran
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 TimeoutTest extends FunctionalTest {
+public class TimeoutIT extends MacTest {
- @Override
- public Map<String,String> getInitialConfig() {
- return Collections.emptyMap();
- }
-
- @Override
- public List<TableSetup> getTablesToCreate() {
- return Collections.emptyList();
- }
-
- @Override
+ @Test
public void run() throws Exception {
- testBatchScannerTimeout();
- testBatchWriterTimeout();
+ Connector conn = getConnector();
+ testBatchWriterTimeout(conn);
+ testBatchScannerTimeout(conn);
}
- public void testBatchWriterTimeout() throws Exception {
- Connector conn = getConnector();
-
+ public void testBatchWriterTimeout(Connector conn) throws Exception {
conn.tableOperations().create("foo1");
-
conn.tableOperations().addConstraint("foo1", SlowConstraint.class.getName());
- // give constraint time to propogate through zookeeper
+ // give constraint time to propagate through zookeeper
UtilWaitThread.sleep(250);
BatchWriter bw = conn.createBatchWriter("foo1", new BatchWriterConfig().setTimeout(3, TimeUnit.SECONDS));
@@ -75,7 +63,7 @@ public class TimeoutTest extends Functio
bw.addMutation(mut);
try {
bw.close();
- throw new Exception("batch writer did not timeout");
+ fail("batch writer did not timeout");
} catch (MutationsRejectedException mre) {
if (!(mre.getCause() instanceof TimedOutException)) {
throw mre;
@@ -83,7 +71,7 @@ public class TimeoutTest extends Functio
}
}
- public void testBatchScannerTimeout() throws Exception {
+ public void testBatchScannerTimeout(Connector conn) throws Exception {
getConnector().tableOperations().create("timeout");
BatchWriter bw = getConnector().createBatchWriter("timeout", new BatchWriterConfig());
@@ -116,7 +104,7 @@ public class TimeoutTest extends Functio
for (Entry<Key,Value> entry : bs) {
entry.getKey();
}
- throw new Exception("batch scanner did not time out");
+ fail("batch scanner did not time out");
} catch (TimedOutException toe) {
// toe.printStackTrace();
}
@@ -124,9 +112,4 @@ public class TimeoutTest extends Functio
bs.close();
}
- @Override
- public void cleanup() throws Exception {
-
- }
-
}