You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/10/28 19:00:22 UTC
[1/3] git commit: ACCUMULO-3243 Add missing timeouts of transition to
scalable timeout JUnit Rule.
Repository: accumulo
Updated Branches:
refs/heads/1.6 41fc5fbc2 -> b0771ef66
refs/heads/master 4d6176b39 -> 5f21edfc1
ACCUMULO-3243 Add missing timeouts of transition to scalable timeout JUnit Rule.
Ported TableOperationsIT over to SimpleMacIT.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b0771ef6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b0771ef6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b0771ef6
Branch: refs/heads/1.6
Commit: b0771ef664551ffe595dc5d5735d8025f085c2ac
Parents: 41fc5fb
Author: Josh Elser <el...@apache.org>
Authored: Mon Oct 27 11:11:37 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Tue Oct 28 11:28:08 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/proxy/SimpleProxyIT.java | 53 +++++++++----
.../apache/accumulo/test/Accumulo3010IT.java | 13 ++-
.../apache/accumulo/test/Accumulo3030IT.java | 7 +-
.../apache/accumulo/test/AuditMessageIT.java | 17 ++--
.../org/apache/accumulo/test/BatchWriterIT.java | 7 +-
.../accumulo/test/BulkImportVolumeIT.java | 11 ++-
.../org/apache/accumulo/test/CleanWalIT.java | 13 ++-
.../org/apache/accumulo/test/DeleteRowsIT.java | 9 ++-
.../org/apache/accumulo/test/DumpConfigIT.java | 7 +-
.../org/apache/accumulo/test/ExistingMacIT.java | 5 ++
.../test/MasterRepairsDualAssignmentIT.java | 10 ++-
.../accumulo/test/MetaConstraintRetryIT.java | 7 +-
.../org/apache/accumulo/test/MetaSplitIT.java | 9 ++-
.../accumulo/test/MultiTableBatchWriterIT.java | 5 ++
.../org/apache/accumulo/test/NamespacesIT.java | 7 +-
.../accumulo/test/NoMutationRecoveryIT.java | 15 ++--
.../org/apache/accumulo/test/ShellConfigIT.java | 8 +-
.../org/apache/accumulo/test/ShellServerIT.java | 83 +++++++++++---------
.../apache/accumulo/test/SplitRecoveryIT.java | 7 +-
.../test/TableConfigurationUpdateIT.java | 7 +-
.../apache/accumulo/test/TableOperationsIT.java | 52 ++++++------
.../functional/ConfigurableCompactionIT.java | 7 +-
.../accumulo/test/functional/CredentialsIT.java | 19 +++--
.../test/functional/GarbageCollectorIT.java | 17 ++--
.../accumulo/test/functional/MetadataIT.java | 15 ++--
.../accumulo/test/functional/RestartIT.java | 19 +++--
.../apache/accumulo/test/functional/SslIT.java | 15 ++--
.../test/functional/SslWithClientAuthIT.java | 2 +-
28 files changed, 291 insertions(+), 155 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
----------------------------------------------------------------------
diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
index 62e5b64..50e53a9 100644
--- a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
+++ b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
@@ -112,6 +112,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
+import org.junit.rules.Timeout;
/**
* Call every method on the proxy and try to verify that it works.
@@ -162,6 +163,18 @@ public class SimpleProxyIT {
@Rule
public TestName testName = new TestName();
+ @Rule
+ public Timeout testsShouldTimeout() {
+ int waitLonger;
+ try {
+ waitLonger = Integer.parseInt(System.getProperty("timeout.factor"));
+ } catch (NumberFormatException e) {
+ waitLonger = 1;
+ }
+
+ return new Timeout(waitLonger * 60 * 1000);
+ }
+
@BeforeClass
public static void setupMiniCluster() throws Exception {
FileUtils.deleteQuietly(macTestFolder);
@@ -198,7 +211,18 @@ public class SimpleProxyIT {
creds = client.login(principal, properties);
}
- @Test(timeout = 10000)
+ @AfterClass
+ public static void tearDownMiniCluster() throws Exception {
+ if (null != proxyServer) {
+ proxyServer.stop();
+ thread.interrupt();
+ thread.join(5000);
+ }
+ accumulo.stop();
+ FileUtils.deleteQuietly(macTestFolder);
+ }
+
+ @Test
public void security() throws Exception {
client.createLocalUser(creds, "user", s2bb(secret));
ByteBuffer badLogin = client.login("user", properties);
@@ -473,7 +497,7 @@ public class SimpleProxyIT {
} catch (AccumuloSecurityException ex) {}
}
- @Test(timeout = 10000)
+ @Test
public void tableNotFound() throws Exception {
final String doesNotExist = "doesNotExists";
try {
@@ -632,8 +656,8 @@ public class SimpleProxyIT {
client.createConditionalWriter(creds, doesNotExist, new ConditionalWriterOptions());
} catch (TableNotFoundException ex) {}
}
-
- @Test(timeout = 10 * 1000)
+
+ @Test
public void testExists() throws Exception {
client.createTable(creds, "ett1", false, TimeType.MILLIS);
client.createTable(creds, "ett2", false, TimeType.MILLIS);
@@ -651,7 +675,7 @@ public class SimpleProxyIT {
} catch (TableExistsException tee) {}
}
- @Test(timeout = 10000)
+ @Test
public void testUnknownScanner() throws Exception {
final String TABLE_TEST = makeTableName();
@@ -689,7 +713,7 @@ public class SimpleProxyIT {
} catch (UnknownScanner us) {}
}
- @Test(timeout = 10000)
+ @Test
public void testUnknownWriter() throws Exception {
final String TABLE_TEST = makeTableName();
@@ -722,7 +746,7 @@ public class SimpleProxyIT {
} catch (UnknownWriter uw) {}
}
- @Test(timeout = 10000)
+ @Test
public void testDelete() throws Exception {
final String TABLE_TEST = makeTableName();
@@ -740,7 +764,7 @@ public class SimpleProxyIT {
assertScan(new String[][] {}, TABLE_TEST);
}
- @Test(timeout = 60000)
+ @Test
public void testInstanceOperations() throws Exception {
int tservers = 0;
for (String tserver : client.getTabletServers(creds)) {
@@ -806,7 +830,7 @@ public class SimpleProxyIT {
};
t.start();
- // look for the scan many times
+ // look for the scan many times
List<ActiveScan> scans = new ArrayList<ActiveScan>();
for (int i = 0; i < 100 && scans.isEmpty(); i++) {
for (String tserver : client.getTabletServers(creds)) {
@@ -1012,7 +1036,7 @@ public class SimpleProxyIT {
assertScan(new String[][] {}, TABLE_TEST);
UtilWaitThread.sleep(2000);
-
+
writerOptions = new WriterOptions();
writerOptions.setLatencyMs(10000);
writerOptions.setMaxMemory(3000);
@@ -1551,11 +1575,11 @@ public class SimpleProxyIT {
static private ByteBuffer t2bb(Text t) {
return ByteBuffer.wrap(t.getBytes());
}
-
+
@Test
public void testGetRowRange() throws Exception {
Range range = client.getRowRange(s2bb("xyzzy"));
- org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
+ org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
assertEquals(0, range.start.row.compareTo(t2bb(range2.getStartKey().getRow())));
assertEquals(0, range.stop.row.compareTo(t2bb(range2.getEndKey().getRow())));
assertEquals(range.startInclusive, range2.isStartKeyInclusive());
@@ -1567,9 +1591,4 @@ public class SimpleProxyIT {
assertEquals(range.start.timestamp, range.start.timestamp);
assertEquals(range.stop.timestamp, range.stop.timestamp);
}
-
- @AfterClass
- public static void tearDownMiniCluster() throws Exception {
- accumulo.stop();
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java b/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
index 1a0bfa2..791b1d5 100644
--- a/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
+++ b/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
@@ -41,14 +41,19 @@ import org.junit.Test;
public class Accumulo3010IT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
// file system supports recovery
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
-
- @Test(timeout = 60 * 1000)
+
+ @Test
public void test() throws Exception {
// create a table
String tableName = getUniqueNames(1)[0];
@@ -86,6 +91,6 @@ public class Accumulo3010IT extends ConfigurableMacIT {
Assert.assertFalse(parts[parts.length-1].startsWith("M"));
}
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java b/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
index 91674a5..3512e4a 100644
--- a/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
+++ b/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
@@ -37,11 +37,16 @@ import org.junit.Test;
public class Accumulo3030IT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
}
- @Test(timeout = 60 * 1000)
+ @Test
public void test() throws Exception {
// make a table
final String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
index 3ed1f02..e44d8df 100644
--- a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -72,6 +72,11 @@ public class AuditMessageIT extends ConfigurableMacIT {
private static final Authorizations auths = new Authorizations("private", "public");
@Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void beforeClusterStart(MiniAccumuloConfigImpl cfg) throws Exception {
new File(cfg.getConfDir(), "auditLog.xml").delete();
}
@@ -176,7 +181,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testTableOperationsAudits() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
@@ -208,7 +213,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testUserOperationsAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, InterruptedException, IOException {
conn.securityOperations().createLocalUser(AUDIT_USER_1, new PasswordToken(PASSWORD));
@@ -257,7 +262,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
assertEquals(1, findAuditMessage(auditMessages, "action: dropUser; targetUser: " + AUDIT_USER_2).size());
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testImportExportOperationsAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException,
IOException, InterruptedException {
@@ -339,7 +344,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testDataOperationsAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
@@ -392,7 +397,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testDeniedAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
@@ -459,7 +464,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
"operation: denied;.*" + String.format(AuditedSecurityOperation.CAN_DELETE_RANGE_AUDIT_TEMPLATE, OLD_TEST_TABLE_NAME, "myRow", "myRow~")).size());
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testFailedAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
index ff45f47..ca72e7a 100644
--- a/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
@@ -26,7 +26,12 @@ import org.junit.Test;
public class BatchWriterIT extends SimpleMacIT {
- @Test(timeout = 30 * 1000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
+ }
+
+ @Test
public void test() throws Exception {
// call the batchwriter with buffer of size zero
String table = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
index 37ba5c7..79a2513 100644
--- a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
@@ -35,7 +35,12 @@ public class BulkImportVolumeIT extends ConfigurableMacIT {
File volDirBase = null;
Path v1, v2;
-
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
File baseDir = cfg.getDir();
@@ -54,7 +59,7 @@ public class BulkImportVolumeIT extends ConfigurableMacIT {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Test(timeout= 60 * 1000)
+ @Test
public void testBulkImportFailure() throws Exception {
String tableName = getUniqueNames(1)[0];
TableOperations to = getConnector().tableOperations();
@@ -69,6 +74,6 @@ public class BulkImportVolumeIT extends ConfigurableMacIT {
to.importDirectory(tableName, bulk.toString(), err.toString(), false);
assertEquals(1, err.list().length);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
index a6f836c..d0bfe3f 100644
--- a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
@@ -41,6 +41,11 @@ import org.junit.Test;
public class CleanWalIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 4 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s");
cfg.setNumTservers(1);
@@ -48,7 +53,7 @@ public class CleanWalIT extends ConfigurableMacIT {
}
// test for ACCUMULO-1830
- @Test(timeout= 4 * 60 * 1000)
+ @Test
public void test() throws Exception {
Connector conn = getConnector();
String tableName = getUniqueNames(1)[0];
@@ -67,7 +72,7 @@ public class CleanWalIT extends ConfigurableMacIT {
assertEquals(1, count(tableName, conn));
for (String table : new String[]{MetadataTable.NAME, RootTable.NAME})
assertEquals(0, countLogs(table, conn));
-
+
bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
m = new Mutation("row");
m.putDelete("cf", "cq");
@@ -89,9 +94,9 @@ public class CleanWalIT extends ConfigurableMacIT {
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
return FunctionalTestUtils.count(scanner);
}
-
+
int count(String tableName, Connector conn) throws Exception {
return FunctionalTestUtils.count(conn.createScanner(tableName, Authorizations.EMPTY));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java b/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
index c7892ce..ff67e89 100644
--- a/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
@@ -26,8 +26,13 @@ import org.apache.accumulo.test.functional.SimpleMacIT;
import org.junit.Test;
public class DeleteRowsIT extends SimpleMacIT {
-
- @Test(timeout = 5 * 60 * 1000)
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
+ @Test
public void test() throws Exception {
Connector c = getConnector();
String[] tableNames = this.getUniqueNames(20);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java b/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
index 717e500..f3cee1d 100644
--- a/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
@@ -41,11 +41,16 @@ public class DumpConfigIT extends ConfigurableMacIT {
public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setSiteConfig(Collections.singletonMap(Property.TABLE_FILE_BLOCK_SIZE.getKey(), "1234567"));
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void test() throws Exception {
File siteFileBackup = new File(folder.getRoot(), "accumulo-site.xml.bak");
assertFalse(siteFileBackup.exists());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
index 5d1978e..ec72281 100644
--- a/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -50,6 +50,11 @@ import org.junit.Test;
public class ExistingMacIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index 6801b7f..8d25f0d 100644
--- a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -52,7 +52,11 @@ import org.junit.Test;
public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
-
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
@@ -61,7 +65,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Test(timeout = 5 * 60 * 1000)
+ @Test
public void test() throws Exception {
// make some tablets, spread 'em around
Connector c = getConnector();
@@ -107,7 +111,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
System.out.println(states + " size " + states.size() + " allAssigned " + allAssigned);
if (states.size() != 2 && allAssigned == true)
break;
- }
+ }
assertEquals(1, states.size());
// pick an assigned tablet and assign it to the old tablet
TabletLocationState moved = null;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
index b5487ff..b3c3640 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
@@ -32,8 +32,13 @@ import org.junit.Test;
public class MetaConstraintRetryIT extends SimpleMacIT {
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
+ }
+
//a test for ACCUMULO-3096
- @Test(timeout = 30 * 1000, expected = ConstraintViolationException.class)
+ @Test(expected = ConstraintViolationException.class)
public void test() throws Exception {
getConnector().securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java b/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
index 8a655dd..50a1446 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
@@ -33,7 +33,12 @@ import org.junit.Test;
public class MetaSplitIT extends SimpleMacIT {
- @Test(expected = AccumuloException.class, timeout = 30000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 3 * 60;
+ }
+
+ @Test(expected = AccumuloException.class)
public void testRootTableSplit() throws Exception {
TableOperations opts = getConnector().tableOperations();
SortedSet<Text> splits = new TreeSet<Text>();
@@ -55,7 +60,7 @@ public class MetaSplitIT extends SimpleMacIT {
opts.addSplits(MetadataTable.NAME, splits);
}
- @Test(timeout = 180000)
+ @Test
public void testMetadataTableSplit() throws Exception {
TableOperations opts = getConnector().tableOperations();
for (int i = 1; i <= 10; i++) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index f1eba61..484c048 100644
--- a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -53,6 +53,11 @@ public class MultiTableBatchWriterIT extends SimpleMacIT {
private Connector connector;
private MultiTableBatchWriter mtbw;
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
@Before
public void setUpArgs() throws AccumuloException, AccumuloSecurityException {
connector = getConnector();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index 10c7264..c1e779e 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -84,6 +84,11 @@ public class NamespacesIT extends SimpleMacIT {
private Connector c;
private String namespace;
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Before
public void setUpConnectorAndNamespace() throws Exception {
// prepare a unique namespace and get a new root connector for each test
@@ -868,7 +873,7 @@ public class NamespacesIT extends SimpleMacIT {
assertFalse(c.securityOperations().hasNamespacePermission(c.whoami(), namespace, NamespacePermission.READ));
c.securityOperations().grantNamespacePermission(c.whoami(), namespace, NamespacePermission.READ);
assertTrue(c.securityOperations().hasNamespacePermission(c.whoami(), namespace, NamespacePermission.READ));
-
+
c.namespaceOperations().delete(namespace);
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
index ab17740..d666e1e 100644
--- a/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
@@ -50,19 +50,24 @@ public class NoMutationRecoveryIT extends ConfigurableMacIT {
static final String TABLE = "table";
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.useMiniDFS(true);
cfg.setNumTservers(1);
}
-
+
public boolean equals(Entry<Key, Value> a, Entry<Key, Value> b) {
// comparison, without timestamp
Key akey = a.getKey();
Key bkey = b.getKey();
- return akey.compareTo(bkey, PartialKey.ROW_COLFAM_COLQUAL_COLVIS) == 0 && a.getValue().equals(b.getValue());
+ return akey.compareTo(bkey, PartialKey.ROW_COLFAM_COLQUAL_COLVIS) == 0 && a.getValue().equals(b.getValue());
}
-
- @Test(timeout = 2 * 60 * 1000)
+
+ @Test
public void test() throws Exception {
Connector conn = getConnector();
conn.tableOperations().create(TABLE);
@@ -104,7 +109,7 @@ public class NoMutationRecoveryIT extends ConfigurableMacIT {
s.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
return s;
}
-
+
private Entry<Key,Value> getLogRef(Connector conn, String table) throws Exception {
return getLogRefs(conn, table).iterator().next();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java b/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
index b6c7553..bcfa45c 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
@@ -27,11 +27,17 @@ import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
public class ShellConfigIT extends ConfigurableMacIT {
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.CRYPTO_BLOCK_STREAM_SIZE, "7K");
}
- @Test(timeout = 30000)
+ @Test
public void experimentalPropTest() throws Exception {
// ensure experimental props do not show up in config output unless set
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index 7449148..677e634 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@ -266,7 +266,12 @@ public class ShellServerIT extends SimpleMacIT {
ts.shell.shutdown();
}
- @Test(timeout = 60000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Test
public void exporttableImporttable() throws Exception {
final String table = name.getMethodName(), table2 = table + "2";
@@ -310,7 +315,7 @@ public class ShellServerIT extends SimpleMacIT {
throw new RuntimeException("Unexpected constructors for DistCp");
}
- @Test(timeout = 45000)
+ @Test
public void setscaniterDeletescaniter() throws Exception {
final String table = name.getMethodName();
@@ -328,7 +333,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void execfile() throws Exception {
// execfile
File file = File.createTempFile("ShellServerIT.execfile", ".conf", getFolder());
@@ -339,7 +344,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void egrep() throws Exception {
final String table = name.getMethodName();
@@ -351,7 +356,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void du() throws Exception {
final String table = name.getMethodName();
@@ -375,7 +380,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 1000)
+ @Test
public void debug() throws Exception {
ts.exec("debug", true, "off", true);
ts.exec("debug on", true);
@@ -386,7 +391,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("debug debug debug", false);
}
- @Test(timeout = 45000)
+ @Test
public void user() throws Exception {
final String table = name.getMethodName();
@@ -422,7 +427,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("users", true, "xyzzy", false);
}
- @Test(timeout = 45000)
+ @Test
public void iter() throws Exception {
final String table = name.getMethodName();
@@ -471,7 +476,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void setIterOptionPrompt() throws Exception {
Connector conn = getConnector();
String tableName = name.getMethodName();
@@ -555,7 +560,7 @@ public class ShellServerIT extends SimpleMacIT {
fail("Failed to find expected property on " + tableName + ": " + expectedKey + "=" + expectedValue);
}
- @Test(timeout = 45000)
+ @Test
public void notable() throws Exception {
final String table = name.getMethodName();
@@ -569,7 +574,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void sleep() throws Exception {
// sleep
long now = System.currentTimeMillis();
@@ -579,7 +584,7 @@ public class ShellServerIT extends SimpleMacIT {
assertTrue("Diff was actually " + diff, diff < 600);
}
- @Test(timeout = 45000)
+ @Test
public void addauths() throws Exception {
final String table = name.getMethodName();
// addauths
@@ -633,7 +638,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void byeQuitExit() throws Exception {
// bye, quit, exit
for (String cmd : "bye quit exit".split(" ")) {
@@ -644,13 +649,13 @@ public class ShellServerIT extends SimpleMacIT {
}
}
- @Test(timeout = 45000)
+ @Test
public void classpath() throws Exception {
// classpath
ts.exec("classpath", true, "Level 2: Java Classloader (loads everything defined by java classpath) URL classpath items are", true);
}
- @Test(timeout = 45000)
+ @Test
public void clearCls() throws Exception {
// clear/cls
if (ts.shell.getReader().getTerminal().isAnsiSupported()) {
@@ -662,7 +667,7 @@ public class ShellServerIT extends SimpleMacIT {
}
}
- @Test(timeout = 45000)
+ @Test
public void clonetable() throws Exception {
final String table = name.getMethodName(), clone = table + "_clone";
@@ -681,7 +686,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + clone);
}
- @Test(timeout = 45000)
+ @Test
public void testCompactions() throws Exception {
final String table = name.getMethodName();
@@ -721,7 +726,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void constraint() throws Exception {
final String table = name.getMethodName();
@@ -740,7 +745,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void deletemany() throws Exception {
final String table = name.getMethodName();
@@ -769,7 +774,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void deleterows() throws Exception {
final String table = name.getMethodName();
@@ -801,7 +806,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void groups() throws Exception {
final String table = name.getMethodName();
@@ -812,7 +817,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void grep() throws Exception {
final String table = name.getMethodName();
@@ -847,7 +852,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("history", true, "history", true);
}
- @Test(timeout = 45000)
+ @Test
public void importDirectory() throws Exception {
final String table = name.getMethodName();
@@ -885,12 +890,12 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void info() throws Exception {
ts.exec("info", true, Constants.VERSION, true);
}
- @Test(timeout = 45000)
+ @Test
public void interpreter() throws Exception {
final String table = name.getMethodName();
@@ -907,7 +912,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void listcompactions() throws Exception {
final String table = name.getMethodName();
@@ -928,7 +933,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void maxrow() throws Exception {
final String table = name.getMethodName();
@@ -943,7 +948,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void merge() throws Exception {
final String table = name.getMethodName();
@@ -962,7 +967,7 @@ public class ShellServerIT extends SimpleMacIT {
assertEquals(1, ts.output.get().split("\n").length);
}
- @Test(timeout = 45000)
+ @Test
public void ping() throws Exception {
for (int i = 0; i < 10; i++) {
ts.exec("ping", true, "OK", true);
@@ -975,7 +980,7 @@ public class ShellServerIT extends SimpleMacIT {
assertEquals(3, ts.output.get().split("\n").length);
}
- @Test(timeout = 45000)
+ @Test
public void renametable() throws Exception {
final String table = name.getMethodName() + "1", rename = name.getMethodName() + "2";
@@ -988,7 +993,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + rename, true);
}
- @Test(timeout = 30000)
+ @Test
public void tables() throws Exception {
final String table = name.getMethodName(), table1 = table + "_z", table2 = table + "_a";
ts.exec("createtable " + table1);
@@ -1000,7 +1005,7 @@ public class ShellServerIT extends SimpleMacIT {
assertTrue(lst.indexOf(table1) < lst.indexOf(table2));
}
- @Test(timeout = 45000)
+ @Test
public void systempermission() throws Exception {
ts.exec("systempermissions");
assertEquals(11, ts.output.get().split("\n").length - 1);
@@ -1008,7 +1013,7 @@ public class ShellServerIT extends SimpleMacIT {
assertEquals(6, ts.output.get().split("\n").length - 1);
}
- @Test(timeout = 45000)
+ @Test
public void listscans() throws Exception {
final String table = name.getMethodName();
@@ -1073,7 +1078,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void testPertableClasspath() throws Exception {
final String table = name.getMethodName();
@@ -1120,7 +1125,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void trace() throws Exception {
// Make sure to not collide with the "trace" table
final String table = name.getMethodName() + "Test";
@@ -1138,14 +1143,14 @@ public class ShellServerIT extends SimpleMacIT {
assertTrue(trace.contains("DeleteTable"));
}
- @Test(timeout = 30000)
+ @Test
public void badLogin() throws Exception {
ts.input.set(ROOT_PASSWORD + "\n");
String err = ts.exec("user NoSuchUser", false);
assertTrue(err.contains("BAD_CREDENTIALS for user NoSuchUser"));
}
- @Test(timeout = 60 * 1000)
+ @Test
public void namespaces() throws Exception {
ts.exec("namespaces", true, "\"\"", true); // default namespace, displayed as quoted empty string
ts.exec("namespaces", true, Namespaces.ACCUMULO_NAMESPACE, true);
@@ -1221,7 +1226,7 @@ public class ShellServerIT extends SimpleMacIT {
return ts.output.get().split("\n").length - 1;
}
- @Test(timeout = 30000)
+ @Test
public void scans() throws Exception {
ts.exec("createtable t");
make10();
@@ -1240,7 +1245,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f t");
}
- @Test(timeout = 30000)
+ @Test
public void whoami() throws Exception {
assertTrue(ts.exec("whoami", true).contains("root"));
ts.input.set("secret\nsecret\n");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
index f290ac1..96d3a1a 100644
--- a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
@@ -57,7 +57,12 @@ public class SplitRecoveryIT extends SimpleMacIT {
return FunctionalTestUtils.count(scanner) == 0;
}
- @Test(timeout = 60000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Test
public void test() throws Exception {
String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
index 5e2b2c9..0d9a211 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
@@ -40,6 +40,11 @@ import org.junit.Test;
public class TableConfigurationUpdateIT extends SimpleMacIT {
private static final Logger log = Logger.getLogger(TableConfigurationUpdateIT.class);
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Test
public void test() throws Exception {
Connector conn = getConnector();
@@ -57,7 +62,7 @@ public class TableConfigurationUpdateIT extends SimpleMacIT {
// Number of iterations per thread
int iterations = 100000;
AccumuloConfiguration tableConf = new TableConfiguration(inst.getInstanceID(), inst, table, defaultConf);
-
+
long start = System.currentTimeMillis();
ExecutorService svc = Executors.newFixedThreadPool(numThreads);
CountDownLatch countDown = new CountDownLatch(numThreads);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
index 167c07f..bb12279 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -20,8 +20,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
-import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -52,47 +50,46 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.accumulo.test.functional.SimpleMacIT;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
-import org.apache.thrift.transport.TTransportException;
-import org.junit.AfterClass;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-public class TableOperationsIT {
+public class TableOperationsIT extends SimpleMacIT {
- static TemporaryFolder tempFolder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
static final String ROOT = "root";
- static final String ROOT_PASS = "password";
- static MiniAccumuloCluster accumuloCluster;
-
- static Connector connector;
static TabletClientService.Client client;
static AtomicInteger tableCounter;
- @BeforeClass
- public static void startUp() throws IOException, AccumuloException, AccumuloSecurityException, TTransportException, InterruptedException {
- tableCounter = new AtomicInteger(0);
- tempFolder.create();
- accumuloCluster = new MiniAccumuloCluster(tempFolder.getRoot(), ROOT_PASS);
+ String makeTableName() {
+ return "table" + tableCounter.getAndIncrement();
+ }
- accumuloCluster.start();
+ private Connector connector;
- connector = accumuloCluster.getConnector(ROOT, ROOT_PASS);
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
}
- String makeTableName() {
- return "table" + tableCounter.getAndIncrement();
+ @BeforeClass
+ public static void setupClass() {
+ tableCounter = new AtomicInteger(0);
}
- @Test(timeout = 30 * 1000)
+ @Before
+ public void setup() throws Exception {
+ connector = getConnector();
+ }
+
+ @Test
public void getDiskUsageErrors() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TException {
String tableName = makeTableName();
connector.tableOperations().create(tableName);
@@ -114,7 +111,7 @@ public class TableOperationsIT {
} catch (TableNotFoundException e) {}
}
- @Test(timeout = 30 * 1000)
+ @Test
public void getDiskUsage() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TException {
String tableName = makeTableName();
@@ -172,7 +169,7 @@ public class TableOperationsIT {
connector.tableOperations().delete(tableName);
}
- @Test(timeout = 30 * 1000)
+ @Test
public void createTable() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException {
String tableName = makeTableName();
connector.tableOperations().create(tableName);
@@ -182,7 +179,7 @@ public class TableOperationsIT {
connector.tableOperations().delete(tableName);
}
- @Test(timeout = 30 * 1000)
+ @Test
public void createMergeClonedTable() throws Exception {
String originalTable = makeTableName();
TableOperations tops = connector.tableOperations();
@@ -245,9 +242,4 @@ public class TableOperationsIT {
return map;
}
- @AfterClass
- public static void shutDown() throws IOException, InterruptedException {
- accumuloCluster.stop();
- tempFolder.delete();
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
index 2b90c81..32c1a3f 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
@@ -47,6 +47,11 @@ import org.junit.Test;
public class ConfigurableCompactionIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
}
@@ -88,7 +93,7 @@ public class ConfigurableCompactionIT extends ConfigurableMacIT {
runTest(c, tableName, 5);
}
- @Test(timeout = 60000)
+ @Test
public void testPerTableClasspath() throws Exception {
final Connector c = getConnector();
final String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
index cfc274a..8e2e1e0 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
@@ -42,23 +42,28 @@ import org.junit.Before;
import org.junit.Test;
/**
- *
+ *
*/
public class CredentialsIT extends SimpleMacIT {
-
+
private static final String username = CredentialsIT.class.getSimpleName();
private static final String password = Base64.encodeBase64String(username.getBytes());
-
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
@Before
public void createLocalUser() throws AccumuloException, AccumuloSecurityException {
getConnector().securityOperations().createLocalUser(username, new PasswordToken(password));
}
-
+
@After
public void deleteLocalUser() throws AccumuloException, AccumuloSecurityException {
getConnector().securityOperations().dropLocalUser(username);
}
-
+
@Test
public void testConnectorWithDestroyedToken() throws DestroyFailedException, AccumuloException {
PasswordToken token = new PasswordToken(password);
@@ -72,7 +77,7 @@ public class CredentialsIT extends SimpleMacIT {
assertTrue(e.getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
}
}
-
+
@Test
public void testDestroyTokenBeforeRPC() throws AccumuloException, DestroyFailedException, AccumuloSecurityException, TableNotFoundException {
PasswordToken token = new PasswordToken(password);
@@ -92,5 +97,5 @@ public class CredentialsIT extends SimpleMacIT {
assertTrue(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index f04f196..d5b92cf 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -72,7 +72,12 @@ import org.junit.Test;
public class GarbageCollectorIT extends ConfigurableMacIT {
private static final String OUR_SECRET = "itsreallysecret";
-
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> settings = new HashMap<String,String>();
@@ -103,7 +108,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertNull(getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR));
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void gcTest() throws Exception {
killMacGc();
Connector c = getConnector();
@@ -132,7 +137,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertTrue(after < before);
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void gcLotsOfCandidatesIT() throws Exception {
killMacGc();
@@ -147,7 +152,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertTrue(output.contains("delete candidates has exceeded"));
}
- @Test(timeout = 20 * 60 * 1000)
+ @Test
public void dontGCRootLog() throws Exception {
killMacGc();
// dirty metadata
@@ -176,7 +181,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
return delFlag;
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testInvalidDelete() throws Exception {
killMacGc();
@@ -226,7 +231,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
Assert.assertFalse(iter.hasNext());
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testProperPortAdvertisement() throws Exception {
Connector conn = getConnector();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/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
index 00fbf7e..bd0282d 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
@@ -43,11 +43,16 @@ import org.junit.Test;
public class MetadataIT extends SimpleMacIT {
- @Test(timeout = 60 * 1000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Test
public void testFlushAndCompact() throws Exception {
Connector c = getConnector();
String tableNames[] = getUniqueNames(2);
-
+
// create a table to write some data to metadata table
c.tableOperations().create(tableNames[0]);
@@ -75,12 +80,12 @@ public class MetadataIT extends SimpleMacIT {
Set<String> files3 = new HashSet<String>();
for (Entry<Key,Value> entry : rootScanner)
files3.add(entry.getKey().getColumnQualifier().toString());
-
+
// compaction of metadata table should change file set in root table
Assert.assertNotEquals(files2, files3);
}
- @Test(timeout = 60 * 1000)
+ @Test
public void mergeMeta() throws Exception {
Connector c = getConnector();
SortedSet<Text> splits = new TreeSet<Text>();
@@ -100,7 +105,7 @@ public class MetadataIT extends SimpleMacIT {
assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void batchScanTest() throws Exception {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java b/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
index cb7bddb..e4b9c5a 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
@@ -43,6 +43,11 @@ import org.junit.Test;
public class RestartIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 10 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> props = new HashMap<String,String>();
props.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "5s");
@@ -60,7 +65,7 @@ public class RestartIT extends ConfigurableMacIT {
OPTS.rows = VOPTS.rows = 10 * 1000;
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void restartMaster() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -75,7 +80,7 @@ public class RestartIT extends ConfigurableMacIT {
ingest.destroy();
}
- @Test(timeout = 8 * 60 * 1000)
+ @Test
public void restartMasterRecovery() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -94,7 +99,7 @@ public class RestartIT extends ConfigurableMacIT {
VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void restartMasterSplit() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -110,7 +115,7 @@ public class RestartIT extends ConfigurableMacIT {
ingest.destroy();
}
- @Test(timeout = 10 * 60 * 1000)
+ @Test
public void killedTabletServer() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -124,7 +129,7 @@ public class RestartIT extends ConfigurableMacIT {
VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void killedTabletServer2() throws Exception {
Connector c = getConnector();
c.tableOperations().create("t");
@@ -139,7 +144,7 @@ public class RestartIT extends ConfigurableMacIT {
c.tableOperations().create("tt");
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void killedTabletServerDuringShutdown() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -149,7 +154,7 @@ public class RestartIT extends ConfigurableMacIT {
assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
}
- @Test(timeout = 8 * 60 * 1000)
+ @Test
public void shutdownDuringCompactingSplitting() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
index 7d5e565..a14795c 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
@@ -29,33 +29,38 @@ import org.junit.Test;
*/
public class SslIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 6 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
super.configure(cfg, hadoopCoreSite);
configureForSsl(cfg, createSharedTestDir(this.getClass().getName() + "-ssl"));
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void binary() throws AccumuloException, AccumuloSecurityException, Exception {
getConnector().tableOperations().create("bt");
BinaryIT.runTest(getConnector());
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void concurrency() throws Exception {
ConcurrencyIT.runTest(getConnector());
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void adminStop() throws Exception {
ShutdownIT.runAdminStopTest(getConnector(), getCluster());
}
- @Test(timeout = 6 * 60 * 1000)
+ @Test
public void bulk() throws Exception {
BulkIT.runTest(getConnector(), getUniqueNames(1)[0], this.getClass().getName(), testName.getMethodName());
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void mapReduce() throws Exception {
MapReduceIT.runTest(getConnector(), getCluster());
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
index 8745707..bb00b19 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
@@ -41,7 +41,7 @@ public class SslWithClientAuthIT extends SslIT {
}
@Override
- protected int defaultTimeoutSeconds() {
+ public int defaultTimeoutSeconds() {
return 8 * 60;
}
[2/3] git commit: ACCUMULO-3243 Add missing timeouts of transition to
scalable timeout JUnit Rule.
Posted by el...@apache.org.
ACCUMULO-3243 Add missing timeouts of transition to scalable timeout JUnit Rule.
Ported TableOperationsIT over to SimpleMacIT.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b0771ef6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b0771ef6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b0771ef6
Branch: refs/heads/master
Commit: b0771ef664551ffe595dc5d5735d8025f085c2ac
Parents: 41fc5fb
Author: Josh Elser <el...@apache.org>
Authored: Mon Oct 27 11:11:37 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Tue Oct 28 11:28:08 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/proxy/SimpleProxyIT.java | 53 +++++++++----
.../apache/accumulo/test/Accumulo3010IT.java | 13 ++-
.../apache/accumulo/test/Accumulo3030IT.java | 7 +-
.../apache/accumulo/test/AuditMessageIT.java | 17 ++--
.../org/apache/accumulo/test/BatchWriterIT.java | 7 +-
.../accumulo/test/BulkImportVolumeIT.java | 11 ++-
.../org/apache/accumulo/test/CleanWalIT.java | 13 ++-
.../org/apache/accumulo/test/DeleteRowsIT.java | 9 ++-
.../org/apache/accumulo/test/DumpConfigIT.java | 7 +-
.../org/apache/accumulo/test/ExistingMacIT.java | 5 ++
.../test/MasterRepairsDualAssignmentIT.java | 10 ++-
.../accumulo/test/MetaConstraintRetryIT.java | 7 +-
.../org/apache/accumulo/test/MetaSplitIT.java | 9 ++-
.../accumulo/test/MultiTableBatchWriterIT.java | 5 ++
.../org/apache/accumulo/test/NamespacesIT.java | 7 +-
.../accumulo/test/NoMutationRecoveryIT.java | 15 ++--
.../org/apache/accumulo/test/ShellConfigIT.java | 8 +-
.../org/apache/accumulo/test/ShellServerIT.java | 83 +++++++++++---------
.../apache/accumulo/test/SplitRecoveryIT.java | 7 +-
.../test/TableConfigurationUpdateIT.java | 7 +-
.../apache/accumulo/test/TableOperationsIT.java | 52 ++++++------
.../functional/ConfigurableCompactionIT.java | 7 +-
.../accumulo/test/functional/CredentialsIT.java | 19 +++--
.../test/functional/GarbageCollectorIT.java | 17 ++--
.../accumulo/test/functional/MetadataIT.java | 15 ++--
.../accumulo/test/functional/RestartIT.java | 19 +++--
.../apache/accumulo/test/functional/SslIT.java | 15 ++--
.../test/functional/SslWithClientAuthIT.java | 2 +-
28 files changed, 291 insertions(+), 155 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
----------------------------------------------------------------------
diff --git a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
index 62e5b64..50e53a9 100644
--- a/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
+++ b/proxy/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
@@ -112,6 +112,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
+import org.junit.rules.Timeout;
/**
* Call every method on the proxy and try to verify that it works.
@@ -162,6 +163,18 @@ public class SimpleProxyIT {
@Rule
public TestName testName = new TestName();
+ @Rule
+ public Timeout testsShouldTimeout() {
+ int waitLonger;
+ try {
+ waitLonger = Integer.parseInt(System.getProperty("timeout.factor"));
+ } catch (NumberFormatException e) {
+ waitLonger = 1;
+ }
+
+ return new Timeout(waitLonger * 60 * 1000);
+ }
+
@BeforeClass
public static void setupMiniCluster() throws Exception {
FileUtils.deleteQuietly(macTestFolder);
@@ -198,7 +211,18 @@ public class SimpleProxyIT {
creds = client.login(principal, properties);
}
- @Test(timeout = 10000)
+ @AfterClass
+ public static void tearDownMiniCluster() throws Exception {
+ if (null != proxyServer) {
+ proxyServer.stop();
+ thread.interrupt();
+ thread.join(5000);
+ }
+ accumulo.stop();
+ FileUtils.deleteQuietly(macTestFolder);
+ }
+
+ @Test
public void security() throws Exception {
client.createLocalUser(creds, "user", s2bb(secret));
ByteBuffer badLogin = client.login("user", properties);
@@ -473,7 +497,7 @@ public class SimpleProxyIT {
} catch (AccumuloSecurityException ex) {}
}
- @Test(timeout = 10000)
+ @Test
public void tableNotFound() throws Exception {
final String doesNotExist = "doesNotExists";
try {
@@ -632,8 +656,8 @@ public class SimpleProxyIT {
client.createConditionalWriter(creds, doesNotExist, new ConditionalWriterOptions());
} catch (TableNotFoundException ex) {}
}
-
- @Test(timeout = 10 * 1000)
+
+ @Test
public void testExists() throws Exception {
client.createTable(creds, "ett1", false, TimeType.MILLIS);
client.createTable(creds, "ett2", false, TimeType.MILLIS);
@@ -651,7 +675,7 @@ public class SimpleProxyIT {
} catch (TableExistsException tee) {}
}
- @Test(timeout = 10000)
+ @Test
public void testUnknownScanner() throws Exception {
final String TABLE_TEST = makeTableName();
@@ -689,7 +713,7 @@ public class SimpleProxyIT {
} catch (UnknownScanner us) {}
}
- @Test(timeout = 10000)
+ @Test
public void testUnknownWriter() throws Exception {
final String TABLE_TEST = makeTableName();
@@ -722,7 +746,7 @@ public class SimpleProxyIT {
} catch (UnknownWriter uw) {}
}
- @Test(timeout = 10000)
+ @Test
public void testDelete() throws Exception {
final String TABLE_TEST = makeTableName();
@@ -740,7 +764,7 @@ public class SimpleProxyIT {
assertScan(new String[][] {}, TABLE_TEST);
}
- @Test(timeout = 60000)
+ @Test
public void testInstanceOperations() throws Exception {
int tservers = 0;
for (String tserver : client.getTabletServers(creds)) {
@@ -806,7 +830,7 @@ public class SimpleProxyIT {
};
t.start();
- // look for the scan many times
+ // look for the scan many times
List<ActiveScan> scans = new ArrayList<ActiveScan>();
for (int i = 0; i < 100 && scans.isEmpty(); i++) {
for (String tserver : client.getTabletServers(creds)) {
@@ -1012,7 +1036,7 @@ public class SimpleProxyIT {
assertScan(new String[][] {}, TABLE_TEST);
UtilWaitThread.sleep(2000);
-
+
writerOptions = new WriterOptions();
writerOptions.setLatencyMs(10000);
writerOptions.setMaxMemory(3000);
@@ -1551,11 +1575,11 @@ public class SimpleProxyIT {
static private ByteBuffer t2bb(Text t) {
return ByteBuffer.wrap(t.getBytes());
}
-
+
@Test
public void testGetRowRange() throws Exception {
Range range = client.getRowRange(s2bb("xyzzy"));
- org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
+ org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
assertEquals(0, range.start.row.compareTo(t2bb(range2.getStartKey().getRow())));
assertEquals(0, range.stop.row.compareTo(t2bb(range2.getEndKey().getRow())));
assertEquals(range.startInclusive, range2.isStartKeyInclusive());
@@ -1567,9 +1591,4 @@ public class SimpleProxyIT {
assertEquals(range.start.timestamp, range.start.timestamp);
assertEquals(range.stop.timestamp, range.stop.timestamp);
}
-
- @AfterClass
- public static void tearDownMiniCluster() throws Exception {
- accumulo.stop();
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java b/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
index 1a0bfa2..791b1d5 100644
--- a/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
+++ b/test/src/test/java/org/apache/accumulo/test/Accumulo3010IT.java
@@ -41,14 +41,19 @@ import org.junit.Test;
public class Accumulo3010IT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
// file system supports recovery
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
-
- @Test(timeout = 60 * 1000)
+
+ @Test
public void test() throws Exception {
// create a table
String tableName = getUniqueNames(1)[0];
@@ -86,6 +91,6 @@ public class Accumulo3010IT extends ConfigurableMacIT {
Assert.assertFalse(parts[parts.length-1].startsWith("M"));
}
}
-
-
+
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java b/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
index 91674a5..3512e4a 100644
--- a/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
+++ b/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
@@ -37,11 +37,16 @@ import org.junit.Test;
public class Accumulo3030IT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(1);
}
- @Test(timeout = 60 * 1000)
+ @Test
public void test() throws Exception {
// make a table
final String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
index 3ed1f02..e44d8df 100644
--- a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -72,6 +72,11 @@ public class AuditMessageIT extends ConfigurableMacIT {
private static final Authorizations auths = new Authorizations("private", "public");
@Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Override
public void beforeClusterStart(MiniAccumuloConfigImpl cfg) throws Exception {
new File(cfg.getConfDir(), "auditLog.xml").delete();
}
@@ -176,7 +181,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testTableOperationsAudits() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
@@ -208,7 +213,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testUserOperationsAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, InterruptedException, IOException {
conn.securityOperations().createLocalUser(AUDIT_USER_1, new PasswordToken(PASSWORD));
@@ -257,7 +262,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
assertEquals(1, findAuditMessage(auditMessages, "action: dropUser; targetUser: " + AUDIT_USER_2).size());
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testImportExportOperationsAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException,
IOException, InterruptedException {
@@ -339,7 +344,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testDataOperationsAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
@@ -392,7 +397,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testDeniedAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
@@ -459,7 +464,7 @@ public class AuditMessageIT extends ConfigurableMacIT {
"operation: denied;.*" + String.format(AuditedSecurityOperation.CAN_DELETE_RANGE_AUDIT_TEMPLATE, OLD_TEST_TABLE_NAME, "myRow", "myRow~")).size());
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testFailedAudits() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException, IOException,
InterruptedException {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
index ff45f47..ca72e7a 100644
--- a/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java
@@ -26,7 +26,12 @@ import org.junit.Test;
public class BatchWriterIT extends SimpleMacIT {
- @Test(timeout = 30 * 1000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
+ }
+
+ @Test
public void test() throws Exception {
// call the batchwriter with buffer of size zero
String table = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
index 37ba5c7..79a2513 100644
--- a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
@@ -35,7 +35,12 @@ public class BulkImportVolumeIT extends ConfigurableMacIT {
File volDirBase = null;
Path v1, v2;
-
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
File baseDir = cfg.getDir();
@@ -54,7 +59,7 @@ public class BulkImportVolumeIT extends ConfigurableMacIT {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Test(timeout= 60 * 1000)
+ @Test
public void testBulkImportFailure() throws Exception {
String tableName = getUniqueNames(1)[0];
TableOperations to = getConnector().tableOperations();
@@ -69,6 +74,6 @@ public class BulkImportVolumeIT extends ConfigurableMacIT {
to.importDirectory(tableName, bulk.toString(), err.toString(), false);
assertEquals(1, err.list().length);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
index a6f836c..d0bfe3f 100644
--- a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java
@@ -41,6 +41,11 @@ import org.junit.Test;
public class CleanWalIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 4 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s");
cfg.setNumTservers(1);
@@ -48,7 +53,7 @@ public class CleanWalIT extends ConfigurableMacIT {
}
// test for ACCUMULO-1830
- @Test(timeout= 4 * 60 * 1000)
+ @Test
public void test() throws Exception {
Connector conn = getConnector();
String tableName = getUniqueNames(1)[0];
@@ -67,7 +72,7 @@ public class CleanWalIT extends ConfigurableMacIT {
assertEquals(1, count(tableName, conn));
for (String table : new String[]{MetadataTable.NAME, RootTable.NAME})
assertEquals(0, countLogs(table, conn));
-
+
bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
m = new Mutation("row");
m.putDelete("cf", "cq");
@@ -89,9 +94,9 @@ public class CleanWalIT extends ConfigurableMacIT {
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
return FunctionalTestUtils.count(scanner);
}
-
+
int count(String tableName, Connector conn) throws Exception {
return FunctionalTestUtils.count(conn.createScanner(tableName, Authorizations.EMPTY));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java b/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
index c7892ce..ff67e89 100644
--- a/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/DeleteRowsIT.java
@@ -26,8 +26,13 @@ import org.apache.accumulo.test.functional.SimpleMacIT;
import org.junit.Test;
public class DeleteRowsIT extends SimpleMacIT {
-
- @Test(timeout = 5 * 60 * 1000)
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
+ @Test
public void test() throws Exception {
Connector c = getConnector();
String[] tableNames = this.getUniqueNames(20);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java b/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
index 717e500..f3cee1d 100644
--- a/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/DumpConfigIT.java
@@ -41,11 +41,16 @@ public class DumpConfigIT extends ConfigurableMacIT {
public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setSiteConfig(Collections.singletonMap(Property.TABLE_FILE_BLOCK_SIZE.getKey(), "1234567"));
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void test() throws Exception {
File siteFileBackup = new File(folder.getRoot(), "accumulo-site.xml.bak");
assertFalse(siteFileBackup.exists());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
index 5d1978e..ec72281 100644
--- a/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -50,6 +50,11 @@ import org.junit.Test;
public class ExistingMacIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index 6801b7f..8d25f0d 100644
--- a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -52,7 +52,11 @@ import org.junit.Test;
public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
-
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
@@ -61,7 +65,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- @Test(timeout = 5 * 60 * 1000)
+ @Test
public void test() throws Exception {
// make some tablets, spread 'em around
Connector c = getConnector();
@@ -107,7 +111,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
System.out.println(states + " size " + states.size() + " allAssigned " + allAssigned);
if (states.size() != 2 && allAssigned == true)
break;
- }
+ }
assertEquals(1, states.size());
// pick an assigned tablet and assign it to the old tablet
TabletLocationState moved = null;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
index b5487ff..b3c3640 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
@@ -32,8 +32,13 @@ import org.junit.Test;
public class MetaConstraintRetryIT extends SimpleMacIT {
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
+ }
+
//a test for ACCUMULO-3096
- @Test(timeout = 30 * 1000, expected = ConstraintViolationException.class)
+ @Test(expected = ConstraintViolationException.class)
public void test() throws Exception {
getConnector().securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java b/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
index 8a655dd..50a1446 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaSplitIT.java
@@ -33,7 +33,12 @@ import org.junit.Test;
public class MetaSplitIT extends SimpleMacIT {
- @Test(expected = AccumuloException.class, timeout = 30000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 3 * 60;
+ }
+
+ @Test(expected = AccumuloException.class)
public void testRootTableSplit() throws Exception {
TableOperations opts = getConnector().tableOperations();
SortedSet<Text> splits = new TreeSet<Text>();
@@ -55,7 +60,7 @@ public class MetaSplitIT extends SimpleMacIT {
opts.addSplits(MetadataTable.NAME, splits);
}
- @Test(timeout = 180000)
+ @Test
public void testMetadataTableSplit() throws Exception {
TableOperations opts = getConnector().tableOperations();
for (int i = 1; i <= 10; i++) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index f1eba61..484c048 100644
--- a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -53,6 +53,11 @@ public class MultiTableBatchWriterIT extends SimpleMacIT {
private Connector connector;
private MultiTableBatchWriter mtbw;
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
@Before
public void setUpArgs() throws AccumuloException, AccumuloSecurityException {
connector = getConnector();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index 10c7264..c1e779e 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -84,6 +84,11 @@ public class NamespacesIT extends SimpleMacIT {
private Connector c;
private String namespace;
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Before
public void setUpConnectorAndNamespace() throws Exception {
// prepare a unique namespace and get a new root connector for each test
@@ -868,7 +873,7 @@ public class NamespacesIT extends SimpleMacIT {
assertFalse(c.securityOperations().hasNamespacePermission(c.whoami(), namespace, NamespacePermission.READ));
c.securityOperations().grantNamespacePermission(c.whoami(), namespace, NamespacePermission.READ);
assertTrue(c.securityOperations().hasNamespacePermission(c.whoami(), namespace, NamespacePermission.READ));
-
+
c.namespaceOperations().delete(namespace);
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
index ab17740..d666e1e 100644
--- a/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
@@ -50,19 +50,24 @@ public class NoMutationRecoveryIT extends ConfigurableMacIT {
static final String TABLE = "table";
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.useMiniDFS(true);
cfg.setNumTservers(1);
}
-
+
public boolean equals(Entry<Key, Value> a, Entry<Key, Value> b) {
// comparison, without timestamp
Key akey = a.getKey();
Key bkey = b.getKey();
- return akey.compareTo(bkey, PartialKey.ROW_COLFAM_COLQUAL_COLVIS) == 0 && a.getValue().equals(b.getValue());
+ return akey.compareTo(bkey, PartialKey.ROW_COLFAM_COLQUAL_COLVIS) == 0 && a.getValue().equals(b.getValue());
}
-
- @Test(timeout = 2 * 60 * 1000)
+
+ @Test
public void test() throws Exception {
Connector conn = getConnector();
conn.tableOperations().create(TABLE);
@@ -104,7 +109,7 @@ public class NoMutationRecoveryIT extends ConfigurableMacIT {
s.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
return s;
}
-
+
private Entry<Key,Value> getLogRef(Connector conn, String table) throws Exception {
return getLogRefs(conn, table).iterator().next();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java b/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
index b6c7553..bcfa45c 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellConfigIT.java
@@ -27,11 +27,17 @@ import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
public class ShellConfigIT extends ConfigurableMacIT {
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setProperty(Property.CRYPTO_BLOCK_STREAM_SIZE, "7K");
}
- @Test(timeout = 30000)
+ @Test
public void experimentalPropTest() throws Exception {
// ensure experimental props do not show up in config output unless set
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index 7449148..677e634 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@ -266,7 +266,12 @@ public class ShellServerIT extends SimpleMacIT {
ts.shell.shutdown();
}
- @Test(timeout = 60000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Test
public void exporttableImporttable() throws Exception {
final String table = name.getMethodName(), table2 = table + "2";
@@ -310,7 +315,7 @@ public class ShellServerIT extends SimpleMacIT {
throw new RuntimeException("Unexpected constructors for DistCp");
}
- @Test(timeout = 45000)
+ @Test
public void setscaniterDeletescaniter() throws Exception {
final String table = name.getMethodName();
@@ -328,7 +333,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void execfile() throws Exception {
// execfile
File file = File.createTempFile("ShellServerIT.execfile", ".conf", getFolder());
@@ -339,7 +344,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void egrep() throws Exception {
final String table = name.getMethodName();
@@ -351,7 +356,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void du() throws Exception {
final String table = name.getMethodName();
@@ -375,7 +380,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 1000)
+ @Test
public void debug() throws Exception {
ts.exec("debug", true, "off", true);
ts.exec("debug on", true);
@@ -386,7 +391,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("debug debug debug", false);
}
- @Test(timeout = 45000)
+ @Test
public void user() throws Exception {
final String table = name.getMethodName();
@@ -422,7 +427,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("users", true, "xyzzy", false);
}
- @Test(timeout = 45000)
+ @Test
public void iter() throws Exception {
final String table = name.getMethodName();
@@ -471,7 +476,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void setIterOptionPrompt() throws Exception {
Connector conn = getConnector();
String tableName = name.getMethodName();
@@ -555,7 +560,7 @@ public class ShellServerIT extends SimpleMacIT {
fail("Failed to find expected property on " + tableName + ": " + expectedKey + "=" + expectedValue);
}
- @Test(timeout = 45000)
+ @Test
public void notable() throws Exception {
final String table = name.getMethodName();
@@ -569,7 +574,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void sleep() throws Exception {
// sleep
long now = System.currentTimeMillis();
@@ -579,7 +584,7 @@ public class ShellServerIT extends SimpleMacIT {
assertTrue("Diff was actually " + diff, diff < 600);
}
- @Test(timeout = 45000)
+ @Test
public void addauths() throws Exception {
final String table = name.getMethodName();
// addauths
@@ -633,7 +638,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void byeQuitExit() throws Exception {
// bye, quit, exit
for (String cmd : "bye quit exit".split(" ")) {
@@ -644,13 +649,13 @@ public class ShellServerIT extends SimpleMacIT {
}
}
- @Test(timeout = 45000)
+ @Test
public void classpath() throws Exception {
// classpath
ts.exec("classpath", true, "Level 2: Java Classloader (loads everything defined by java classpath) URL classpath items are", true);
}
- @Test(timeout = 45000)
+ @Test
public void clearCls() throws Exception {
// clear/cls
if (ts.shell.getReader().getTerminal().isAnsiSupported()) {
@@ -662,7 +667,7 @@ public class ShellServerIT extends SimpleMacIT {
}
}
- @Test(timeout = 45000)
+ @Test
public void clonetable() throws Exception {
final String table = name.getMethodName(), clone = table + "_clone";
@@ -681,7 +686,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + clone);
}
- @Test(timeout = 45000)
+ @Test
public void testCompactions() throws Exception {
final String table = name.getMethodName();
@@ -721,7 +726,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void constraint() throws Exception {
final String table = name.getMethodName();
@@ -740,7 +745,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void deletemany() throws Exception {
final String table = name.getMethodName();
@@ -769,7 +774,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void deleterows() throws Exception {
final String table = name.getMethodName();
@@ -801,7 +806,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void groups() throws Exception {
final String table = name.getMethodName();
@@ -812,7 +817,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void grep() throws Exception {
final String table = name.getMethodName();
@@ -847,7 +852,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("history", true, "history", true);
}
- @Test(timeout = 45000)
+ @Test
public void importDirectory() throws Exception {
final String table = name.getMethodName();
@@ -885,12 +890,12 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table);
}
- @Test(timeout = 45000)
+ @Test
public void info() throws Exception {
ts.exec("info", true, Constants.VERSION, true);
}
- @Test(timeout = 45000)
+ @Test
public void interpreter() throws Exception {
final String table = name.getMethodName();
@@ -907,7 +912,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void listcompactions() throws Exception {
final String table = name.getMethodName();
@@ -928,7 +933,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void maxrow() throws Exception {
final String table = name.getMethodName();
@@ -943,7 +948,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void merge() throws Exception {
final String table = name.getMethodName();
@@ -962,7 +967,7 @@ public class ShellServerIT extends SimpleMacIT {
assertEquals(1, ts.output.get().split("\n").length);
}
- @Test(timeout = 45000)
+ @Test
public void ping() throws Exception {
for (int i = 0; i < 10; i++) {
ts.exec("ping", true, "OK", true);
@@ -975,7 +980,7 @@ public class ShellServerIT extends SimpleMacIT {
assertEquals(3, ts.output.get().split("\n").length);
}
- @Test(timeout = 45000)
+ @Test
public void renametable() throws Exception {
final String table = name.getMethodName() + "1", rename = name.getMethodName() + "2";
@@ -988,7 +993,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + rename, true);
}
- @Test(timeout = 30000)
+ @Test
public void tables() throws Exception {
final String table = name.getMethodName(), table1 = table + "_z", table2 = table + "_a";
ts.exec("createtable " + table1);
@@ -1000,7 +1005,7 @@ public class ShellServerIT extends SimpleMacIT {
assertTrue(lst.indexOf(table1) < lst.indexOf(table2));
}
- @Test(timeout = 45000)
+ @Test
public void systempermission() throws Exception {
ts.exec("systempermissions");
assertEquals(11, ts.output.get().split("\n").length - 1);
@@ -1008,7 +1013,7 @@ public class ShellServerIT extends SimpleMacIT {
assertEquals(6, ts.output.get().split("\n").length - 1);
}
- @Test(timeout = 45000)
+ @Test
public void listscans() throws Exception {
final String table = name.getMethodName();
@@ -1073,7 +1078,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f " + table, true);
}
- @Test(timeout = 45000)
+ @Test
public void testPertableClasspath() throws Exception {
final String table = name.getMethodName();
@@ -1120,7 +1125,7 @@ public class ShellServerIT extends SimpleMacIT {
}
- @Test(timeout = 45000)
+ @Test
public void trace() throws Exception {
// Make sure to not collide with the "trace" table
final String table = name.getMethodName() + "Test";
@@ -1138,14 +1143,14 @@ public class ShellServerIT extends SimpleMacIT {
assertTrue(trace.contains("DeleteTable"));
}
- @Test(timeout = 30000)
+ @Test
public void badLogin() throws Exception {
ts.input.set(ROOT_PASSWORD + "\n");
String err = ts.exec("user NoSuchUser", false);
assertTrue(err.contains("BAD_CREDENTIALS for user NoSuchUser"));
}
- @Test(timeout = 60 * 1000)
+ @Test
public void namespaces() throws Exception {
ts.exec("namespaces", true, "\"\"", true); // default namespace, displayed as quoted empty string
ts.exec("namespaces", true, Namespaces.ACCUMULO_NAMESPACE, true);
@@ -1221,7 +1226,7 @@ public class ShellServerIT extends SimpleMacIT {
return ts.output.get().split("\n").length - 1;
}
- @Test(timeout = 30000)
+ @Test
public void scans() throws Exception {
ts.exec("createtable t");
make10();
@@ -1240,7 +1245,7 @@ public class ShellServerIT extends SimpleMacIT {
ts.exec("deletetable -f t");
}
- @Test(timeout = 30000)
+ @Test
public void whoami() throws Exception {
assertTrue(ts.exec("whoami", true).contains("root"));
ts.input.set("secret\nsecret\n");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
index f290ac1..96d3a1a 100644
--- a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java
@@ -57,7 +57,12 @@ public class SplitRecoveryIT extends SimpleMacIT {
return FunctionalTestUtils.count(scanner) == 0;
}
- @Test(timeout = 60000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
+ @Test
public void test() throws Exception {
String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
index 5e2b2c9..0d9a211 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
@@ -40,6 +40,11 @@ import org.junit.Test;
public class TableConfigurationUpdateIT extends SimpleMacIT {
private static final Logger log = Logger.getLogger(TableConfigurationUpdateIT.class);
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 60;
+ }
+
@Test
public void test() throws Exception {
Connector conn = getConnector();
@@ -57,7 +62,7 @@ public class TableConfigurationUpdateIT extends SimpleMacIT {
// Number of iterations per thread
int iterations = 100000;
AccumuloConfiguration tableConf = new TableConfiguration(inst.getInstanceID(), inst, table, defaultConf);
-
+
long start = System.currentTimeMillis();
ExecutorService svc = Executors.newFixedThreadPool(numThreads);
CountDownLatch countDown = new CountDownLatch(numThreads);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
index 167c07f..bb12279 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -20,8 +20,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
-import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -52,47 +50,46 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.accumulo.test.functional.SimpleMacIT;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
-import org.apache.thrift.transport.TTransportException;
-import org.junit.AfterClass;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-public class TableOperationsIT {
+public class TableOperationsIT extends SimpleMacIT {
- static TemporaryFolder tempFolder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
static final String ROOT = "root";
- static final String ROOT_PASS = "password";
- static MiniAccumuloCluster accumuloCluster;
-
- static Connector connector;
static TabletClientService.Client client;
static AtomicInteger tableCounter;
- @BeforeClass
- public static void startUp() throws IOException, AccumuloException, AccumuloSecurityException, TTransportException, InterruptedException {
- tableCounter = new AtomicInteger(0);
- tempFolder.create();
- accumuloCluster = new MiniAccumuloCluster(tempFolder.getRoot(), ROOT_PASS);
+ String makeTableName() {
+ return "table" + tableCounter.getAndIncrement();
+ }
- accumuloCluster.start();
+ private Connector connector;
- connector = accumuloCluster.getConnector(ROOT, ROOT_PASS);
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 30;
}
- String makeTableName() {
- return "table" + tableCounter.getAndIncrement();
+ @BeforeClass
+ public static void setupClass() {
+ tableCounter = new AtomicInteger(0);
}
- @Test(timeout = 30 * 1000)
+ @Before
+ public void setup() throws Exception {
+ connector = getConnector();
+ }
+
+ @Test
public void getDiskUsageErrors() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TException {
String tableName = makeTableName();
connector.tableOperations().create(tableName);
@@ -114,7 +111,7 @@ public class TableOperationsIT {
} catch (TableNotFoundException e) {}
}
- @Test(timeout = 30 * 1000)
+ @Test
public void getDiskUsage() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException, TException {
String tableName = makeTableName();
@@ -172,7 +169,7 @@ public class TableOperationsIT {
connector.tableOperations().delete(tableName);
}
- @Test(timeout = 30 * 1000)
+ @Test
public void createTable() throws TableExistsException, AccumuloException, AccumuloSecurityException, TableNotFoundException {
String tableName = makeTableName();
connector.tableOperations().create(tableName);
@@ -182,7 +179,7 @@ public class TableOperationsIT {
connector.tableOperations().delete(tableName);
}
- @Test(timeout = 30 * 1000)
+ @Test
public void createMergeClonedTable() throws Exception {
String originalTable = makeTableName();
TableOperations tops = connector.tableOperations();
@@ -245,9 +242,4 @@ public class TableOperationsIT {
return map;
}
- @AfterClass
- public static void shutDown() throws IOException, InterruptedException {
- accumuloCluster.stop();
- tempFolder.delete();
- }
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
index 2b90c81..32c1a3f 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
@@ -47,6 +47,11 @@ import org.junit.Test;
public class ConfigurableCompactionIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
}
@@ -88,7 +93,7 @@ public class ConfigurableCompactionIT extends ConfigurableMacIT {
runTest(c, tableName, 5);
}
- @Test(timeout = 60000)
+ @Test
public void testPerTableClasspath() throws Exception {
final Connector c = getConnector();
final String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
index cfc274a..8e2e1e0 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
@@ -42,23 +42,28 @@ import org.junit.Before;
import org.junit.Test;
/**
- *
+ *
*/
public class CredentialsIT extends SimpleMacIT {
-
+
private static final String username = CredentialsIT.class.getSimpleName();
private static final String password = Base64.encodeBase64String(username.getBytes());
-
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
@Before
public void createLocalUser() throws AccumuloException, AccumuloSecurityException {
getConnector().securityOperations().createLocalUser(username, new PasswordToken(password));
}
-
+
@After
public void deleteLocalUser() throws AccumuloException, AccumuloSecurityException {
getConnector().securityOperations().dropLocalUser(username);
}
-
+
@Test
public void testConnectorWithDestroyedToken() throws DestroyFailedException, AccumuloException {
PasswordToken token = new PasswordToken(password);
@@ -72,7 +77,7 @@ public class CredentialsIT extends SimpleMacIT {
assertTrue(e.getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
}
}
-
+
@Test
public void testDestroyTokenBeforeRPC() throws AccumuloException, DestroyFailedException, AccumuloSecurityException, TableNotFoundException {
PasswordToken token = new PasswordToken(password);
@@ -92,5 +97,5 @@ public class CredentialsIT extends SimpleMacIT {
assertTrue(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index f04f196..d5b92cf 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -72,7 +72,12 @@ import org.junit.Test;
public class GarbageCollectorIT extends ConfigurableMacIT {
private static final String OUR_SECRET = "itsreallysecret";
-
+
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 5 * 60;
+ }
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> settings = new HashMap<String,String>();
@@ -103,7 +108,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertNull(getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR));
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void gcTest() throws Exception {
killMacGc();
Connector c = getConnector();
@@ -132,7 +137,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertTrue(after < before);
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void gcLotsOfCandidatesIT() throws Exception {
killMacGc();
@@ -147,7 +152,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertTrue(output.contains("delete candidates has exceeded"));
}
- @Test(timeout = 20 * 60 * 1000)
+ @Test
public void dontGCRootLog() throws Exception {
killMacGc();
// dirty metadata
@@ -176,7 +181,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
return delFlag;
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testInvalidDelete() throws Exception {
killMacGc();
@@ -226,7 +231,7 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
Assert.assertFalse(iter.hasNext());
}
- @Test(timeout = 60 * 1000)
+ @Test
public void testProperPortAdvertisement() throws Exception {
Connector conn = getConnector();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/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
index 00fbf7e..bd0282d 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataIT.java
@@ -43,11 +43,16 @@ import org.junit.Test;
public class MetadataIT extends SimpleMacIT {
- @Test(timeout = 60 * 1000)
+ @Override
+ public int defaultTimeoutSeconds() {
+ return 2 * 60;
+ }
+
+ @Test
public void testFlushAndCompact() throws Exception {
Connector c = getConnector();
String tableNames[] = getUniqueNames(2);
-
+
// create a table to write some data to metadata table
c.tableOperations().create(tableNames[0]);
@@ -75,12 +80,12 @@ public class MetadataIT extends SimpleMacIT {
Set<String> files3 = new HashSet<String>();
for (Entry<Key,Value> entry : rootScanner)
files3.add(entry.getKey().getColumnQualifier().toString());
-
+
// compaction of metadata table should change file set in root table
Assert.assertNotEquals(files2, files3);
}
- @Test(timeout = 60 * 1000)
+ @Test
public void mergeMeta() throws Exception {
Connector c = getConnector();
SortedSet<Text> splits = new TreeSet<Text>();
@@ -100,7 +105,7 @@ public class MetadataIT extends SimpleMacIT {
assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void batchScanTest() throws Exception {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java b/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
index cb7bddb..e4b9c5a 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java
@@ -43,6 +43,11 @@ import org.junit.Test;
public class RestartIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 10 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
Map<String,String> props = new HashMap<String,String>();
props.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "5s");
@@ -60,7 +65,7 @@ public class RestartIT extends ConfigurableMacIT {
OPTS.rows = VOPTS.rows = 10 * 1000;
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void restartMaster() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -75,7 +80,7 @@ public class RestartIT extends ConfigurableMacIT {
ingest.destroy();
}
- @Test(timeout = 8 * 60 * 1000)
+ @Test
public void restartMasterRecovery() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -94,7 +99,7 @@ public class RestartIT extends ConfigurableMacIT {
VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void restartMasterSplit() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -110,7 +115,7 @@ public class RestartIT extends ConfigurableMacIT {
ingest.destroy();
}
- @Test(timeout = 10 * 60 * 1000)
+ @Test
public void killedTabletServer() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -124,7 +129,7 @@ public class RestartIT extends ConfigurableMacIT {
VerifyIngest.verifyIngest(c, VOPTS, SOPTS);
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void killedTabletServer2() throws Exception {
Connector c = getConnector();
c.tableOperations().create("t");
@@ -139,7 +144,7 @@ public class RestartIT extends ConfigurableMacIT {
c.tableOperations().create("tt");
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void killedTabletServerDuringShutdown() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -149,7 +154,7 @@ public class RestartIT extends ConfigurableMacIT {
assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
}
- @Test(timeout = 8 * 60 * 1000)
+ @Test
public void shutdownDuringCompactingSplitting() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
index 7d5e565..a14795c 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SslIT.java
@@ -29,33 +29,38 @@ import org.junit.Test;
*/
public class SslIT extends ConfigurableMacIT {
@Override
+ public int defaultTimeoutSeconds() {
+ return 6 * 60;
+ }
+
+ @Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
super.configure(cfg, hadoopCoreSite);
configureForSsl(cfg, createSharedTestDir(this.getClass().getName() + "-ssl"));
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void binary() throws AccumuloException, AccumuloSecurityException, Exception {
getConnector().tableOperations().create("bt");
BinaryIT.runTest(getConnector());
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void concurrency() throws Exception {
ConcurrencyIT.runTest(getConnector());
}
- @Test(timeout = 4 * 60 * 1000)
+ @Test
public void adminStop() throws Exception {
ShutdownIT.runAdminStopTest(getConnector(), getCluster());
}
- @Test(timeout = 6 * 60 * 1000)
+ @Test
public void bulk() throws Exception {
BulkIT.runTest(getConnector(), getUniqueNames(1)[0], this.getClass().getName(), testName.getMethodName());
}
- @Test(timeout = 2 * 60 * 1000)
+ @Test
public void mapReduce() throws Exception {
MapReduceIT.runTest(getConnector(), getCluster());
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0771ef6/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
index 8745707..bb00b19 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SslWithClientAuthIT.java
@@ -41,7 +41,7 @@ public class SslWithClientAuthIT extends SslIT {
}
@Override
- protected int defaultTimeoutSeconds() {
+ public int defaultTimeoutSeconds() {
return 8 * 60;
}
[3/3] git commit: Merge branch '1.6'
Posted by el...@apache.org.
Merge branch '1.6'
Conflicts:
test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/5f21edfc
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/5f21edfc
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/5f21edfc
Branch: refs/heads/master
Commit: 5f21edfc141ff9ddc90edd4299882ee10e491f53
Parents: 4d6176b b0771ef
Author: Josh Elser <el...@apache.org>
Authored: Tue Oct 28 14:00:07 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Tue Oct 28 14:00:07 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/proxy/SimpleProxyIT.java | 43 +++++++---
.../test/AllowScansToBeInterruptedIT.java | 7 +-
.../apache/accumulo/test/AuditMessageIT.java | 17 ++--
.../org/apache/accumulo/test/BatchWriterIT.java | 7 +-
.../accumulo/test/BulkImportVolumeIT.java | 11 ++-
.../org/apache/accumulo/test/CleanWalIT.java | 13 ++-
.../org/apache/accumulo/test/DeleteRowsIT.java | 9 ++-
.../org/apache/accumulo/test/DumpConfigIT.java | 7 +-
.../org/apache/accumulo/test/ExistingMacIT.java | 5 ++
.../test/MasterRepairsDualAssignmentIT.java | 10 ++-
.../accumulo/test/MetaConstraintRetryIT.java | 7 +-
.../org/apache/accumulo/test/MetaSplitIT.java | 9 ++-
.../accumulo/test/MultiTableBatchWriterIT.java | 5 ++
.../org/apache/accumulo/test/NamespacesIT.java | 7 +-
.../accumulo/test/NoMutationRecoveryIT.java | 15 ++--
.../test/RecoveryCompactionsAreFlushesIT.java | 13 ++-
.../org/apache/accumulo/test/ShellConfigIT.java | 8 +-
.../org/apache/accumulo/test/ShellServerIT.java | 83 +++++++++++---------
.../apache/accumulo/test/SplitRecoveryIT.java | 7 +-
.../test/TableConfigurationUpdateIT.java | 7 +-
.../apache/accumulo/test/TableOperationsIT.java | 52 ++++++------
.../functional/ConfigurableCompactionIT.java | 7 +-
.../accumulo/test/functional/CredentialsIT.java | 19 +++--
.../test/functional/GarbageCollectorIT.java | 17 ++--
.../accumulo/test/functional/MetadataIT.java | 15 ++--
.../accumulo/test/functional/RestartIT.java | 19 +++--
.../apache/accumulo/test/functional/SslIT.java | 15 ++--
.../test/functional/SslWithClientAuthIT.java | 2 +-
28 files changed, 286 insertions(+), 150 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
----------------------------------------------------------------------
diff --cc test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
index 6b4bcfb,0000000..50e53a9
mode 100644,000000..100644
--- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
@@@ -1,1575 -1,0 +1,1594 @@@
+/*
+ * 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.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.file.FileOperations;
+import org.apache.accumulo.core.file.FileSKVWriter;
+import org.apache.accumulo.core.iterators.DevNull;
+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.core.iterators.user.SummingCombiner;
+import org.apache.accumulo.core.iterators.user.VersioningIterator;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.ByteBufferUtil;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
+import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client;
+import org.apache.accumulo.proxy.thrift.AccumuloSecurityException;
+import org.apache.accumulo.proxy.thrift.ActiveCompaction;
+import org.apache.accumulo.proxy.thrift.ActiveScan;
+import org.apache.accumulo.proxy.thrift.BatchScanOptions;
+import org.apache.accumulo.proxy.thrift.Column;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.CompactionReason;
+import org.apache.accumulo.proxy.thrift.CompactionType;
+import org.apache.accumulo.proxy.thrift.Condition;
+import org.apache.accumulo.proxy.thrift.ConditionalStatus;
+import org.apache.accumulo.proxy.thrift.ConditionalUpdates;
+import org.apache.accumulo.proxy.thrift.ConditionalWriterOptions;
+import org.apache.accumulo.proxy.thrift.DiskUsage;
+import org.apache.accumulo.proxy.thrift.IteratorScope;
+import org.apache.accumulo.proxy.thrift.IteratorSetting;
+import org.apache.accumulo.proxy.thrift.Key;
+import org.apache.accumulo.proxy.thrift.KeyValue;
+import org.apache.accumulo.proxy.thrift.MutationsRejectedException;
+import org.apache.accumulo.proxy.thrift.PartialKey;
+import org.apache.accumulo.proxy.thrift.Range;
+import org.apache.accumulo.proxy.thrift.ScanColumn;
+import org.apache.accumulo.proxy.thrift.ScanOptions;
+import org.apache.accumulo.proxy.thrift.ScanResult;
+import org.apache.accumulo.proxy.thrift.ScanState;
+import org.apache.accumulo.proxy.thrift.ScanType;
+import org.apache.accumulo.proxy.thrift.SystemPermission;
+import org.apache.accumulo.proxy.thrift.TableExistsException;
+import org.apache.accumulo.proxy.thrift.TableNotFoundException;
+import org.apache.accumulo.proxy.thrift.TablePermission;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.accumulo.proxy.thrift.UnknownScanner;
+import org.apache.accumulo.proxy.thrift.UnknownWriter;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.apache.accumulo.server.util.PortUtils;
+import org.apache.accumulo.test.functional.SlowIterator;
+import org.apache.commons.io.FileUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.Text;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.server.TServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
++import org.junit.rules.Timeout;
+
+/**
+ * Call every method on the proxy and try to verify that it works.
+ */
+public class SimpleProxyIT {
+
+ public static File macTestFolder = new File(System.getProperty("user.dir") + "/target/" + SimpleProxyIT.class.getName());
+
+ private static MiniAccumuloCluster accumulo;
+ private static String secret = "superSecret";
+ private static Random random = new Random();
+ private static TServer proxyServer;
+ private static Thread thread;
+ private static int proxyPort;
+ private static org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client;
+ private static String principal = "root";
+
+ private static Map<String,String> properties = new TreeMap<String,String>() {
+ private static final long serialVersionUID = 1L;
+
+ {
+ put("password", secret);
+ }
+ };
+ private static ByteBuffer creds = null;
+
+ private static Class<? extends TProtocolFactory> protocolClass;
+
+ static Class<? extends TProtocolFactory> getRandomProtocol() {
+ List<Class<? extends TProtocolFactory>> protocolFactories = new ArrayList<Class<? extends TProtocolFactory>>();
+ protocolFactories.add(org.apache.thrift.protocol.TJSONProtocol.Factory.class);
+ protocolFactories.add(org.apache.thrift.protocol.TBinaryProtocol.Factory.class);
+ protocolFactories.add(org.apache.thrift.protocol.TTupleProtocol.Factory.class);
+ protocolFactories.add(org.apache.thrift.protocol.TCompactProtocol.Factory.class);
+
+ return protocolFactories.get(random.nextInt(protocolFactories.size()));
+ }
+
+ private static final AtomicInteger tableCounter = new AtomicInteger(0);
+
+ private static String makeTableName() {
+ return "test" + tableCounter.getAndIncrement();
+ }
+
+ @Rule
+ public TemporaryFolder tempFolder = new TemporaryFolder(macTestFolder);
+
+ @Rule
+ public TestName testName = new TestName();
+
++ @Rule
++ public Timeout testsShouldTimeout() {
++ int waitLonger;
++ try {
++ waitLonger = Integer.parseInt(System.getProperty("timeout.factor"));
++ } catch (NumberFormatException e) {
++ waitLonger = 1;
++ }
++
++ return new Timeout(waitLonger * 60 * 1000);
++ }
++
+ @BeforeClass
+ public static void setupMiniCluster() throws Exception {
+ FileUtils.deleteQuietly(macTestFolder);
+ macTestFolder.mkdirs();
+ MiniAccumuloConfig config = new MiniAccumuloConfig(macTestFolder, secret).setNumTservers(1);
+ accumulo = new MiniAccumuloCluster(config);
+ accumulo.start();
+ // wait for accumulo to be up and functional
+ ZooKeeperInstance zoo = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
+ Connector c = zoo.getConnector("root", new PasswordToken(secret.getBytes()));
+ for (@SuppressWarnings("unused") Entry<org.apache.accumulo.core.data.Key,Value> entry : c.createScanner(MetadataTable.NAME, Authorizations.EMPTY))
+ ;
+
+ Properties props = new Properties();
+ props.put("instance", accumulo.getConfig().getInstanceName());
+ props.put("zookeepers", accumulo.getZooKeepers());
+ props.put("tokenClass", PasswordToken.class.getName());
+
+ protocolClass = getRandomProtocol();
+
+ proxyPort = PortUtils.getRandomFreePort();
+ proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class, org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
+ protocolClass, props);
+ thread = new Thread() {
+ @Override
+ public void run() {
+ proxyServer.serve();
+ }
+ };
+ thread.start();
+ while (!proxyServer.isServing())
+ UtilWaitThread.sleep(100);
+ client = new TestProxyClient("localhost", proxyPort, protocolClass.newInstance()).proxy();
+ creds = client.login(principal, properties);
+ }
+
- @Test(timeout = 10000)
++ @AfterClass
++ public static void tearDownMiniCluster() throws Exception {
++ if (null != proxyServer) {
++ proxyServer.stop();
++ thread.interrupt();
++ thread.join(5000);
++ }
++ accumulo.stop();
++ FileUtils.deleteQuietly(macTestFolder);
++ }
++
++ @Test
+ public void security() throws Exception {
+ client.createLocalUser(creds, "user", s2bb(secret));
+ ByteBuffer badLogin = client.login("user", properties);
+ client.dropLocalUser(creds, "user");
+ final String table = makeTableName();
+ client.createTable(creds, table, false, TimeType.MILLIS);
+
+ final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
+
+ try {
+ client.addConstraint(badLogin, table, NumericValueConstraint.class.getName());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.addSplits(badLogin, table, Collections.singleton(s2bb("1")));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.clearLocatorCache(badLogin, table);
+ fail("exception not thrown");
+ } catch (TException ex) {}
+ try {
+ client.compactTable(badLogin, table, null, null, null, true, false);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.cancelCompaction(badLogin, table);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.createTable(badLogin, table, false, TimeType.MILLIS);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.deleteTable(badLogin, table);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.deleteRows(badLogin, table, null, null);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.tableExists(badLogin, table);
+ fail("exception not thrown");
+ } catch (TException ex) {}
+ try {
+ client.flushTable(badLogin, table, null, null, false);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getLocalityGroups(badLogin, table);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getMaxRow(badLogin, table, Collections.<ByteBuffer> emptySet(), null, false, null, false);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getTableProperties(badLogin, table);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.listSplits(badLogin, table, 10000);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.listTables(badLogin);
+ fail("exception not thrown");
+ } catch (TException ex) {}
+ try {
+ client.listConstraints(badLogin, table);
+ fail("exception not thrown");
+ } catch (TException ex) {}
+ try {
+ client.mergeTablets(badLogin, table, null, null);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.offlineTable(badLogin, table, false);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.onlineTable(badLogin, table, false);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.removeConstraint(badLogin, table, 0);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.removeTableProperty(badLogin, table, Property.TABLE_FILE_MAX.getKey());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.renameTable(badLogin, table, "someTableName");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
+ groups.put("group1", Collections.singleton("cf1"));
+ groups.put("group2", Collections.singleton("cf2"));
+ client.setLocalityGroups(badLogin, table, groups);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.setTableProperty(badLogin, table, Property.TABLE_FILE_MAX.getKey(), "0");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.tableIdMap(badLogin);
+ fail("exception not thrown");
+ } catch (TException ex) {}
+ try {
+ client.getSiteConfiguration(badLogin);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getSystemConfiguration(badLogin);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getTabletServers(badLogin);
+ fail("exception not thrown");
+ } catch (TException ex) {}
+ try {
+ client.getActiveScans(badLogin, "fake");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getActiveCompactions(badLogin, "fakse");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.removeProperty(badLogin, "table.split.threshold");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.setProperty(badLogin, "table.split.threshold", "500M");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.testClassLoad(badLogin, DevNull.class.getName(), SortedKeyValueIterator.class.getName());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.authenticateUser(badLogin, "root", s2pp(secret));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
+ client.changeUserAuthorizations(badLogin, "stooge", auths);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.changeLocalUserPassword(badLogin, "stooge", s2bb(""));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.createLocalUser(badLogin, "stooge", s2bb("password"));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.dropLocalUser(badLogin, "stooge");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getUserAuthorizations(badLogin, "stooge");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.grantSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.grantTablePermission(badLogin, "root", table, TablePermission.WRITE);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.hasSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.hasTablePermission(badLogin, "root", table, TablePermission.WRITE);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.listLocalUsers(badLogin);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.revokeSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.revokeTablePermission(badLogin, "root", table, TablePermission.ALTER_TABLE);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.createScanner(badLogin, table, new ScanOptions());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.createBatchScanner(badLogin, table, new BatchScanOptions());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.updateAndFlush(badLogin, table, new HashMap<ByteBuffer,List<ColumnUpdate>>());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.createWriter(badLogin, table, new WriterOptions());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.attachIterator(badLogin, "slow", setting, EnumSet.allOf(IteratorScope.class));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.checkIteratorConflicts(badLogin, table, setting, EnumSet.allOf(IteratorScope.class));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ final String TABLE_TEST = makeTableName();
+ client.cloneTable(badLogin, table, TABLE_TEST, false, null, null);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.exportTable(badLogin, table, "/tmp");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.importTable(badLogin, "testify", "/tmp");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.getIteratorSetting(badLogin, table, "foo", IteratorScope.SCAN);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.listIterators(badLogin, table);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.removeIterator(badLogin, table, "name", EnumSet.allOf(IteratorScope.class));
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.splitRangeByTablets(badLogin, table, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ File importDir = tempFolder.newFolder("importDir");
+ File failuresDir = tempFolder.newFolder("failuresDir");
+ client.importDirectory(badLogin, table, importDir.getAbsolutePath(), failuresDir.getAbsolutePath(), true);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.pingTabletServer(badLogin, "fake");
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.login("badUser", properties);
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.testTableClassLoad(badLogin, table, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ try {
+ client.createConditionalWriter(badLogin, table, new ConditionalWriterOptions());
+ fail("exception not thrown");
+ } catch (AccumuloSecurityException ex) {}
+ }
+
- @Test(timeout = 10000)
++ @Test
+ public void tableNotFound() throws Exception {
+ final String doesNotExist = "doesNotExists";
+ try {
+ client.addConstraint(creds, doesNotExist, NumericValueConstraint.class.getName());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.addSplits(creds, doesNotExist, Collections.<ByteBuffer> emptySet());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
+ try {
+ client.attachIterator(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.cancelCompaction(creds, doesNotExist);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.checkIteratorConflicts(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.clearLocatorCache(creds, doesNotExist);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ final String TABLE_TEST = makeTableName();
+ client.cloneTable(creds, doesNotExist, TABLE_TEST, false, null, null);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.compactTable(creds, doesNotExist, null, null, null, true, false);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.createBatchScanner(creds, doesNotExist, new BatchScanOptions());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.createScanner(creds, doesNotExist, new ScanOptions());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.createWriter(creds, doesNotExist, new WriterOptions());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.deleteRows(creds, doesNotExist, null, null);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.deleteTable(creds, doesNotExist);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.exportTable(creds, doesNotExist, "/tmp");
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.flushTable(creds, doesNotExist, null, null, false);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.getIteratorSetting(creds, doesNotExist, "foo", IteratorScope.SCAN);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.getLocalityGroups(creds, doesNotExist);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.getMaxRow(creds, doesNotExist, Collections.<ByteBuffer> emptySet(), null, false, null, false);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.getTableProperties(creds, doesNotExist);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.grantTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.hasTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ File importDir = tempFolder.newFolder("importDir");
+ File failuresDir = tempFolder.newFolder("failuresDir");
+ client.importDirectory(creds, doesNotExist, importDir.getAbsolutePath(), failuresDir.getAbsolutePath(), true);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.listConstraints(creds, doesNotExist);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.listSplits(creds, doesNotExist, 10000);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.mergeTablets(creds, doesNotExist, null, null);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.offlineTable(creds, doesNotExist, false);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.onlineTable(creds, doesNotExist, false);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.removeConstraint(creds, doesNotExist, 0);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.removeIterator(creds, doesNotExist, "name", EnumSet.allOf(IteratorScope.class));
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.removeTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.renameTable(creds, doesNotExist, "someTableName");
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.revokeTablePermission(creds, "root", doesNotExist, TablePermission.ALTER_TABLE);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.setTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey(), "0");
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.splitRangeByTablets(creds, doesNotExist, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.updateAndFlush(creds, doesNotExist, new HashMap<ByteBuffer,List<ColumnUpdate>>());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.getDiskUsage(creds, Collections.singleton(doesNotExist));
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.testTableClassLoad(creds, doesNotExist, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
+ fail("exception not thrown");
+ } catch (TableNotFoundException ex) {}
+ try {
+ client.createConditionalWriter(creds, doesNotExist, new ConditionalWriterOptions());
+ } catch (TableNotFoundException ex) {}
+ }
+
- @Test(timeout = 10 * 1000)
++ @Test
+ public void testExists() throws Exception {
+ client.createTable(creds, "ett1", false, TimeType.MILLIS);
+ client.createTable(creds, "ett2", false, TimeType.MILLIS);
+ try {
+ client.createTable(creds, "ett1", false, TimeType.MILLIS);
+ fail("exception not thrown");
+ } catch (TableExistsException tee) {}
+ try {
+ client.renameTable(creds, "ett1", "ett2");
+ fail("exception not thrown");
+ } catch (TableExistsException tee) {}
+ try {
+ client.cloneTable(creds, "ett1", "ett2", false, new HashMap<String,String>(), new HashSet<String>());
+ fail("exception not thrown");
+ } catch (TableExistsException tee) {}
+ }
+
- @Test(timeout = 10000)
++ @Test
+ public void testUnknownScanner() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+
+ String scanner = client.createScanner(creds, TABLE_TEST, null);
+ assertFalse(client.hasNext(scanner));
+ client.closeScanner(scanner);
+
+ try {
+ client.hasNext(scanner);
+ fail("exception not thrown");
+ } catch (UnknownScanner us) {}
+
+ try {
+ client.closeScanner(scanner);
+ fail("exception not thrown");
+ } catch (UnknownScanner us) {}
+
+ try {
+ client.nextEntry("99999999");
+ fail("exception not thrown");
+ } catch (UnknownScanner us) {}
+ try {
+ client.nextK("99999999", 6);
+ fail("exception not thrown");
+ } catch (UnknownScanner us) {}
+ try {
+ client.hasNext("99999999");
+ fail("exception not thrown");
+ } catch (UnknownScanner us) {}
+ try {
+ client.hasNext(UUID.randomUUID().toString());
+ fail("exception not thrown");
+ } catch (UnknownScanner us) {}
+ }
+
- @Test(timeout = 10000)
++ @Test
+ public void testUnknownWriter() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+
+ String writer = client.createWriter(creds, TABLE_TEST, null);
+ client.update(writer, mutation("row0", "cf", "cq", "value"));
+ client.flush(writer);
+ client.update(writer, mutation("row2", "cf", "cq", "value2"));
+ client.closeWriter(writer);
+
+ // this is a oneway call, so it does not throw exceptions
+ client.update(writer, mutation("row2", "cf", "cq", "value2"));
+
+ try {
+ client.flush(writer);
+ fail("exception not thrown");
+ } catch (UnknownWriter uw) {}
+ try {
+ client.flush("99999");
+ fail("exception not thrown");
+ } catch (UnknownWriter uw) {}
+ try {
+ client.flush(UUID.randomUUID().toString());
+ fail("exception not thrown");
+ } catch (UnknownWriter uw) {}
+ try {
+ client.closeWriter("99999");
+ fail("exception not thrown");
+ } catch (UnknownWriter uw) {}
+ }
+
- @Test(timeout = 10000)
++ @Test
+ public void testDelete() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row0", "cf", "cq", "value"));
+
+ assertScan(new String[][] {{"row0", "cf", "cq", "value"}}, TABLE_TEST);
+
+ ColumnUpdate upd = new ColumnUpdate(s2bb("cf"), s2bb("cq"));
+ upd.setDeleteCell(true);
+ Map<ByteBuffer,List<ColumnUpdate>> delete = Collections.singletonMap(s2bb("row0"), Collections.singletonList(upd));
+
+ client.updateAndFlush(creds, TABLE_TEST, delete);
+
+ assertScan(new String[][] {}, TABLE_TEST);
+ }
+
- @Test(timeout = 60000)
++ @Test
+ public void testInstanceOperations() throws Exception {
+ int tservers = 0;
+ for (String tserver : client.getTabletServers(creds)) {
+ client.pingTabletServer(creds, tserver);
+ tservers++;
+ }
+ assertTrue(tservers > 0);
+
+ // get something we know is in the site config
+ Map<String,String> cfg = client.getSiteConfiguration(creds);
+ assertTrue(cfg.get("instance.dfs.dir").startsWith(macTestFolder.getPath()));
+
+ // set a property in zookeeper
+ client.setProperty(creds, "table.split.threshold", "500M");
+
+ // check that we can read it
+ for (int i = 0; i < 5; i++) {
+ cfg = client.getSystemConfiguration(creds);
+ if ("500M".equals(cfg.get("table.split.threshold")))
+ break;
+ UtilWaitThread.sleep(200);
+ }
+ assertEquals("500M", cfg.get("table.split.threshold"));
+
+ // unset the setting, check that it's not what it was
+ client.removeProperty(creds, "table.split.threshold");
+ for (int i = 0; i < 5; i++) {
+ cfg = client.getSystemConfiguration(creds);
+ if (!"500M".equals(cfg.get("table.split.threshold")))
+ break;
+ UtilWaitThread.sleep(200);
+ }
+ assertNotEquals("500M", cfg.get("table.split.threshold"));
+
+ // try to load some classes via the proxy
+ assertTrue(client.testClassLoad(creds, DevNull.class.getName(), SortedKeyValueIterator.class.getName()));
+ assertFalse(client.testClassLoad(creds, "foo.bar", SortedKeyValueIterator.class.getName()));
+
+ // create a table that's very slow, so we can look for scans/compactions
+ client.createTable(creds, "slow", true, TimeType.MILLIS);
+ IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "250"));
+ client.attachIterator(creds, "slow", setting, EnumSet.allOf(IteratorScope.class));
+
+ // Should take 10 seconds to read every record
+ for (int i = 0; i < 40; i++) {
+ client.updateAndFlush(creds, "slow", mutation("row" + i, "cf", "cq", "value"));
+ }
+
+ // scan
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ String scanner;
+ try {
+ Client client2 = new TestProxyClient("localhost", proxyPort, protocolClass.newInstance()).proxy();
+ scanner = client2.createScanner(creds, "slow", null);
+ client2.nextK(scanner, 10);
+ client2.closeScanner(scanner);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ t.start();
+
+ // look for the scan many times
+ List<ActiveScan> scans = new ArrayList<ActiveScan>();
+ for (int i = 0; i < 100 && scans.isEmpty(); i++) {
+ for (String tserver : client.getTabletServers(creds)) {
+ List<ActiveScan> scansForServer = client.getActiveScans(creds, tserver);
+ for (ActiveScan scan : scansForServer) {
+ if ("root".equals(scan.getUser())) {
+ scans.add(scan);
+ }
+ }
+
+ if (!scans.isEmpty())
+ break;
+ UtilWaitThread.sleep(100);
+ }
+ }
+ t.join();
+
+ assertFalse(scans.isEmpty());
+ boolean found = false;
+ Map<String,String> map = null;
+ for (int i = 0; i < scans.size() && !found; i++) {
+ ActiveScan scan = scans.get(i);
+ if ("root".equals(scan.getUser())) {
+ assertTrue(ScanState.RUNNING.equals(scan.getState()) || ScanState.QUEUED.equals(scan.getState()));
+ assertEquals(ScanType.SINGLE, scan.getType());
+ assertEquals("slow", scan.getTable());
+
+ map = client.tableIdMap(creds);
+ assertEquals(map.get("slow"), scan.getExtent().tableId);
+ assertTrue(scan.getExtent().endRow == null);
+ assertTrue(scan.getExtent().prevEndRow == null);
+ found = true;
+ }
+ }
+
+ assertTrue("Could not find a scan against the 'slow' table", found);
+
+ // start a compaction
+ t = new Thread() {
+ @Override
+ public void run() {
+ try {
+ Client client2 = new TestProxyClient("localhost", proxyPort, protocolClass.newInstance()).proxy();
+ client2.compactTable(creds, "slow", null, null, null, true, true);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ t.start();
+
+ final String desiredTableId = map.get("slow");
+
+ // try to catch it in the act
+ List<ActiveCompaction> compactions = new ArrayList<ActiveCompaction>();
+ for (int i = 0; i < 100 && compactions.isEmpty(); i++) {
+ // Iterate over the tservers
+ for (String tserver : client.getTabletServers(creds)) {
+ // And get the compactions on each
+ List<ActiveCompaction> compactionsOnServer = client.getActiveCompactions(creds, tserver);
+ for (ActiveCompaction compact : compactionsOnServer) {
+ // There might be other compactions occurring (e.g. on METADATA) in which
+ // case we want to prune out those that aren't for our slow table
+ if (desiredTableId.equals(compact.getExtent().tableId)) {
+ compactions.add(compact);
+ }
+ }
+
+ // If we found a compaction for the table we wanted, so we can stop looking
+ if (!compactions.isEmpty())
+ break;
+ }
+ UtilWaitThread.sleep(10);
+ }
+ t.join();
+
+ // verify the compaction information
+ assertFalse(compactions.isEmpty());
+ for (ActiveCompaction c : compactions) {
+ if (desiredTableId.equals(c.getExtent().tableId)) {
+ assertTrue(c.inputFiles.isEmpty());
+ assertEquals(CompactionType.MINOR, c.getType());
+ assertEquals(CompactionReason.USER, c.getReason());
+ assertEquals("", c.localityGroup);
+ assertTrue(c.outputFile.contains("default_tablet"));
+
+ return;
+ }
+ }
+ fail("Expection to find running compaction for table 'slow' but did not find one");
+ }
+
+ @Test
+ public void testSecurityOperations() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ // check password
+ assertTrue(client.authenticateUser(creds, "root", s2pp(secret)));
+ assertFalse(client.authenticateUser(creds, "root", s2pp("")));
+
+ // create a user
+ client.createLocalUser(creds, "stooge", s2bb("password"));
+ // change auths
+ Set<String> users = client.listLocalUsers(creds);
+ assertEquals(new HashSet<String>(Arrays.asList("root", "stooge")), users);
+ HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
+ client.changeUserAuthorizations(creds, "stooge", auths);
+ List<ByteBuffer> update = client.getUserAuthorizations(creds, "stooge");
+ assertEquals(auths, new HashSet<ByteBuffer>(update));
+
+ // change password
+ client.changeLocalUserPassword(creds, "stooge", s2bb(""));
+ assertTrue(client.authenticateUser(creds, "stooge", s2pp("")));
+
+ // check permission failure
+ @SuppressWarnings("serial")
+ ByteBuffer stooge = client.login("stooge", new TreeMap<String,String>() {
+ {
+ put("password", "");
+ }
+ });
+
+ try {
+ client.createTable(stooge, "fail", true, TimeType.MILLIS);
+ fail("should not create the table");
+ } catch (AccumuloSecurityException ex) {
+ assertFalse(client.listTables(creds).contains("fail"));
+ }
+ // grant permissions and test
+ assertFalse(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
+ client.grantSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE);
+ assertTrue(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
+ client.createTable(stooge, "success", true, TimeType.MILLIS);
+ client.listTables(creds).contains("succcess");
+
+ // revoke permissions
+ client.revokeSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE);
+ assertFalse(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
+ try {
+ client.createTable(stooge, "fail", true, TimeType.MILLIS);
+ fail("should not create the table");
+ } catch (AccumuloSecurityException ex) {
+ assertFalse(client.listTables(creds).contains("fail"));
+ }
+ // create a table to test table permissions
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+ // denied!
+ try {
+ String scanner = client.createScanner(stooge, TABLE_TEST, null);
+ client.nextK(scanner, 100);
+ fail("stooge should not read table test");
+ } catch (AccumuloSecurityException ex) {}
+ // grant
+ assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
+ client.grantTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
+ assertTrue(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
+ String scanner = client.createScanner(stooge, TABLE_TEST, null);
+ client.nextK(scanner, 10);
+ client.closeScanner(scanner);
+ // revoke
+ client.revokeTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
+ assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
+ try {
+ scanner = client.createScanner(stooge, TABLE_TEST, null);
+ client.nextK(scanner, 100);
+ fail("stooge should not read table test");
+ } catch (AccumuloSecurityException ex) {}
+
+ // delete user
+ client.dropLocalUser(creds, "stooge");
+ users = client.listLocalUsers(creds);
+ assertEquals(1, users.size());
+
+ }
+
+ @Test
+ public void testBatchWriter() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+ client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+
+ WriterOptions writerOptions = new WriterOptions();
+ writerOptions.setLatencyMs(10000);
+ writerOptions.setMaxMemory(2);
+ writerOptions.setThreads(1);
+ writerOptions.setTimeoutMs(100000);
+
+ String batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ try {
+ client.flush(batchWriter);
+ fail("constraint did not fire");
+ } catch (MutationsRejectedException ex) {}
+ try {
+ client.closeWriter(batchWriter);
+ fail("constraint did not fire");
+ } catch (MutationsRejectedException e) {}
+
+ client.removeConstraint(creds, TABLE_TEST, 2);
+
+ assertScan(new String[][] {}, TABLE_TEST);
+
+ UtilWaitThread.sleep(2000);
+
+ writerOptions = new WriterOptions();
+ writerOptions.setLatencyMs(10000);
+ writerOptions.setMaxMemory(3000);
+ writerOptions.setThreads(1);
+ writerOptions.setTimeoutMs(100000);
+
+ batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
+
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ client.flush(batchWriter);
+ client.closeWriter(batchWriter);
+
+ assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, TABLE_TEST);
+
+ client.deleteTable(creds, TABLE_TEST);
+ }
+
+ @Test
+ public void testTableOperations() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+ // constraints
+ client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+ assertEquals(2, client.listConstraints(creds, TABLE_TEST).size());
+
+ UtilWaitThread.sleep(2000);
+
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "123"));
+
+ try {
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
+ fail("constraint did not fire");
+ } catch (MutationsRejectedException ex) {}
+
+ client.removeConstraint(creds, TABLE_TEST, 2);
+
+ UtilWaitThread.sleep(2000);
+
+ assertEquals(1, client.listConstraints(creds, TABLE_TEST).size());
+
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
+ assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, TABLE_TEST);
+ // splits, merge
+ client.addSplits(creds, TABLE_TEST, new HashSet<ByteBuffer>(Arrays.asList(s2bb("a"), s2bb("m"), s2bb("z"))));
+ List<ByteBuffer> splits = client.listSplits(creds, TABLE_TEST, 1);
+ assertEquals(Arrays.asList(s2bb("m")), splits);
+ client.mergeTablets(creds, TABLE_TEST, null, s2bb("m"));
+ splits = client.listSplits(creds, TABLE_TEST, 10);
+ assertEquals(Arrays.asList(s2bb("m"), s2bb("z")), splits);
+ client.mergeTablets(creds, TABLE_TEST, null, null);
+ splits = client.listSplits(creds, TABLE_TEST, 10);
+ List<ByteBuffer> empty = Collections.emptyList();
+ assertEquals(empty, splits);
+ // iterators
+ client.deleteTable(creds, TABLE_TEST);
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+ HashMap<String,String> options = new HashMap<String,String>();
+ options.put("type", "STRING");
+ options.put("columns", "cf");
+ IteratorSetting setting = new IteratorSetting(10, TABLE_TEST, SummingCombiner.class.getName(), options);
+ client.attachIterator(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
+ for (int i = 0; i < 10; i++) {
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "1"));
+ }
+ assertScan(new String[][] {{"row1", "cf", "cq", "10"}}, TABLE_TEST);
+ try {
+ client.checkIteratorConflicts(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
+ fail("checkIteratorConflicts did not throw an exception");
+ } catch (Exception ex) {}
+ client.deleteRows(creds, TABLE_TEST, null, null);
+ client.removeIterator(creds, TABLE_TEST, "test", EnumSet.allOf(IteratorScope.class));
+ String expected[][] = new String[10][];
+ for (int i = 0; i < 10; i++) {
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row" + i, "cf", "cq", "" + i));
+ expected[i] = new String[] {"row" + i, "cf", "cq", "" + i};
+ client.flushTable(creds, TABLE_TEST, null, null, true);
+ }
+ assertScan(expected, TABLE_TEST);
+ // clone
+ final String TABLE_TEST2 = makeTableName();
+ client.cloneTable(creds, TABLE_TEST, TABLE_TEST2, true, null, null);
+ assertScan(expected, TABLE_TEST2);
+ client.deleteTable(creds, TABLE_TEST2);
+
+ // don't know how to test this, call it just for fun
+ client.clearLocatorCache(creds, TABLE_TEST);
+
+ // compact
+ client.compactTable(creds, TABLE_TEST, null, null, null, true, true);
+ assertEquals(1, countFiles(TABLE_TEST));
+ assertScan(expected, TABLE_TEST);
+
+ // get disk usage
+ client.cloneTable(creds, TABLE_TEST, TABLE_TEST2, true, null, null);
+ Set<String> tablesToScan = new HashSet<String>();
+ tablesToScan.add(TABLE_TEST);
+ tablesToScan.add(TABLE_TEST2);
+ tablesToScan.add("foo");
+ client.createTable(creds, "foo", true, TimeType.MILLIS);
+ List<DiskUsage> diskUsage = (client.getDiskUsage(creds, tablesToScan));
+ assertEquals(2, diskUsage.size());
+ assertEquals(1, diskUsage.get(0).getTables().size());
+ assertEquals(2, diskUsage.get(1).getTables().size());
+ client.compactTable(creds, TABLE_TEST2, null, null, null, true, true);
+ diskUsage = (client.getDiskUsage(creds, tablesToScan));
+ assertEquals(3, diskUsage.size());
+ assertEquals(1, diskUsage.get(0).getTables().size());
+ assertEquals(1, diskUsage.get(1).getTables().size());
+ assertEquals(1, diskUsage.get(2).getTables().size());
+ client.deleteTable(creds, "foo");
+ client.deleteTable(creds, TABLE_TEST2);
+
+ // export/import
+ File dir = tempFolder.newFolder("test");
+ File destDir = tempFolder.newFolder("test_dest");
+ client.offlineTable(creds, TABLE_TEST, false);
+ client.exportTable(creds, TABLE_TEST, dir.getAbsolutePath());
+ // copy files to a new location
+ FileSystem fs = FileSystem.get(new Configuration());
+ FSDataInputStream is = fs.open(new Path(dir + "/distcp.txt"));
+ BufferedReader r = new BufferedReader(new InputStreamReader(is));
+ while (true) {
+ String line = r.readLine();
+ if (line == null)
+ break;
+ Path srcPath = new Path(line);
+ FileUtils.copyFile(new File(srcPath.toUri().getPath()), new File(destDir, srcPath.getName()));
+ }
+ client.deleteTable(creds, TABLE_TEST);
+ client.importTable(creds, "testify", destDir.getAbsolutePath());
+ assertScan(expected, "testify");
+ client.deleteTable(creds, "testify");
+
+ try {
+ // ACCUMULO-1558 a second import from the same dir should fail, the first import moved the files
+ client.importTable(creds, "testify2", destDir.getAbsolutePath());
+ fail();
+ } catch (Exception e) {}
+
+ assertFalse(client.listTables(creds).contains("testify2"));
+
+ // Locality groups
+ client.createTable(creds, "test", true, TimeType.MILLIS);
+ Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
+ groups.put("group1", Collections.singleton("cf1"));
+ groups.put("group2", Collections.singleton("cf2"));
+ client.setLocalityGroups(creds, "test", groups);
+ assertEquals(groups, client.getLocalityGroups(creds, "test"));
+ // table properties
+ Map<String,String> orig = client.getTableProperties(creds, "test");
+ client.setTableProperty(creds, "test", "table.split.threshold", "500M");
+ Map<String,String> update = client.getTableProperties(creds, "test");
+ assertEquals(update.get("table.split.threshold"), "500M");
+ client.removeTableProperty(creds, "test", "table.split.threshold");
+ update = client.getTableProperties(creds, "test");
+ assertEquals(orig, update);
+ // rename table
+ Map<String,String> tables = client.tableIdMap(creds);
+ client.renameTable(creds, "test", "bar");
+ Map<String,String> tables2 = client.tableIdMap(creds);
+ assertEquals(tables.get("test"), tables2.get("bar"));
+ // table exists
+ assertTrue(client.tableExists(creds, "bar"));
+ assertFalse(client.tableExists(creds, "test"));
+ // bulk import
+ String filename = dir + "/bulk/import/rfile.rf";
+ FileSKVWriter writer = FileOperations.getInstance().openWriter(filename, fs, fs.getConf(), DefaultConfiguration.getInstance());
+ writer.startDefaultLocalityGroup();
+ writer.append(new org.apache.accumulo.core.data.Key(new Text("a"), new Text("b"), new Text("c")), new Value("value".getBytes()));
+ writer.close();
+ fs.mkdirs(new Path(dir + "/bulk/fail"));
+ client.importDirectory(creds, "bar", dir + "/bulk/import", dir + "/bulk/fail", true);
+ String scanner = client.createScanner(creds, "bar", null);
+ ScanResult more = client.nextK(scanner, 100);
+ client.closeScanner(scanner);
+ assertEquals(1, more.results.size());
+ ByteBuffer maxRow = client.getMaxRow(creds, "bar", null, null, false, null, false);
+ assertEquals(s2bb("a"), maxRow);
+
+ assertFalse(client.testTableClassLoad(creds, "bar", "abc123", SortedKeyValueIterator.class.getName()));
+ assertTrue(client.testTableClassLoad(creds, "bar", VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName()));
+ }
+
+ private Condition newCondition(String cf, String cq) {
+ return new Condition(new Column(s2bb(cf), s2bb(cq), s2bb("")));
+ }
+
+ private Condition newCondition(String cf, String cq, String val) {
+ return newCondition(cf, cq).setValue(s2bb(val));
+ }
+
+ private Condition newCondition(String cf, String cq, long ts, String val) {
+ return newCondition(cf, cq).setValue(s2bb(val)).setTimestamp(ts);
+ }
+
+ private ColumnUpdate newColUpdate(String cf, String cq, String val) {
+ return new ColumnUpdate(s2bb(cf), s2bb(cq)).setValue(s2bb(val));
+ }
+
+ private ColumnUpdate newColUpdate(String cf, String cq, long ts, String val) {
+ return new ColumnUpdate(s2bb(cf), s2bb(cq)).setTimestamp(ts).setValue(s2bb(val));
+ }
+
+ private void assertScan(String[][] expected, String table) throws Exception {
+ String scid = client.createScanner(creds, table, new ScanOptions());
+ ScanResult keyValues = client.nextK(scid, expected.length + 1);
+
+ assertEquals(expected.length, keyValues.results.size());
+ assertFalse(keyValues.more);
+
+ for (int i = 0; i < keyValues.results.size(); i++) {
+ checkKey(expected[i][0], expected[i][1], expected[i][2], expected[i][3], keyValues.results.get(i));
+ }
+
+ client.closeScanner(scid);
+ }
+
+ @Test
+ public void testConditionalWriter() throws Exception {
+ final String TABLE_TEST = makeTableName();
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+
+ client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+
+ String cwid = client.createConditionalWriter(creds, TABLE_TEST, new ConditionalWriterOptions());
+
+ Map<ByteBuffer,ConditionalUpdates> updates = new HashMap<ByteBuffer,ConditionalUpdates>();
+
+ updates.put(
+ s2bb("00345"),
+ new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", 10, "1"),
+ newColUpdate("data", "img", "73435435"))));
+
+ Map<ByteBuffer,ConditionalStatus> results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "73435435"}, {"00345", "meta", "seq", "1"}}, TABLE_TEST);
+
+ // test not setting values on conditions
+ updates.clear();
+
+ updates.put(s2bb("00345"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", "2"))));
+ updates.put(s2bb("00346"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", "1"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(2, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00346")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "73435435"}, {"00345", "meta", "seq", "1"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+ // test setting values on conditions
+ updates.clear();
+
+ updates.put(
+ s2bb("00345"),
+ new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "1")), Arrays.asList(newColUpdate("meta", "seq", 20, "2"),
+ newColUpdate("data", "img", "567890"))));
+
+ updates.put(s2bb("00346"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "2")), Arrays.asList(newColUpdate("meta", "seq", "3"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(2, results.size());
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00346")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", "meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+ // test setting timestamp on condition to a non-existant version
+ updates.clear();
+
+ updates.put(
+ s2bb("00345"),
+ new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 10, "2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
+ newColUpdate("data", "img", "1234567890"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", "meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+ // test setting timestamp to an existing version
+
+ updates.clear();
+
+ updates.put(
+ s2bb("00345"),
+ new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 20, "2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
+ newColUpdate("data", "img", "1234567890"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+ // run test w/ condition that has iterators
+ // following should fail w/o iterator
+ client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
+ client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
+ client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
+
+ updates.clear();
+ updates.put(s2bb("00347"),
+ new ConditionalUpdates(Arrays.asList(newCondition("data", "count", "3")), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "1"}}, TABLE_TEST);
+
+ // following test w/ iterator setup should succeed
+ Condition iterCond = newCondition("data", "count", "3");
+ Map<String,String> props = new HashMap<String,String>();
+ props.put("type", "STRING");
+ props.put("columns", "data:count");
+ IteratorSetting is = new IteratorSetting(1, "sumc", SummingCombiner.class.getName(), props);
+ iterCond.setIterators(Arrays.asList(is));
+
+ updates.clear();
+ updates.put(s2bb("00347"), new ConditionalUpdates(Arrays.asList(iterCond), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00347")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+ // test a mutation that violated a constraint
+ updates.clear();
+ updates.put(s2bb("00347"),
+ new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")), Arrays.asList(newColUpdate("data", "count", "A"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb("00347")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+ // run test with two conditions
+ // both conditions should fail
+ updates.clear();
+ updates.put(
+ s2bb("00347"),
+ new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "565"), newCondition("data", "count", "2")), Arrays.asList(
+ newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+ // one condition should fail
+ updates.clear();
+ updates.put(
+ s2bb("00347"),
+ new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890"), newCondition("data", "count", "2")), Arrays.asList(
+ newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+ // one condition should fail
+ updates.clear();
+ updates.put(
+ s2bb("00347"),
+ new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "565"), newCondition("data", "count", "1")), Arrays.asList(
+ newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+ // both conditions should succeed
+
+ ConditionalStatus result = client.updateRowConditionally(
+ creds,
+ TABLE_TEST,
+ s2bb("00347"),
+ new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890"), newCondition("data", "count", "1")), Arrays.asList(
+ newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+ assertEquals(ConditionalStatus.ACCEPTED, result);
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}}, TABLE_TEST);
+
+ client.closeConditionalWriter(cwid);
+ try {
+ client.updateRowsConditionally(cwid, updates);
+ fail("conditional writer not closed");
+ } catch (UnknownWriter uk) {}
+
+ // run test with colvis
+ client.createLocalUser(creds, "cwuser", s2bb("bestpasswordever"));
+ client.changeUserAuthorizations(creds, "cwuser", Collections.singleton(s2bb("A")));
+ client.grantTablePermission(creds, "cwuser", TABLE_TEST, TablePermission.WRITE);
+ client.grantTablePermission(creds, "cwuser", TABLE_TEST, TablePermission.READ);
+
+ ByteBuffer cwuCreds = client.login("cwuser", Collections.singletonMap("password", "bestpasswordever"));
+
+ cwid = client.createConditionalWriter(cwuCreds, TABLE_TEST, new ConditionalWriterOptions().setAuthorizations(Collections.singleton(s2bb("A"))));
+
+ updates.clear();
+ updates.put(
+ s2bb("00348"),
+ new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A")))), Arrays.asList(newColUpdate("data", "seq", "1"),
+ newColUpdate("data", "c", "1").setColVisibility(s2bb("A")))));
+ updates.put(s2bb("00349"),
+ new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("B")))), Arrays.asList(newColUpdate("data", "seq", "1"))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(2, results.size());
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
+ assertEquals(ConditionalStatus.INVISIBLE_VISIBILITY, results.get(s2bb("00349")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
+
+ updates.clear();
+
+ updates.clear();
+ updates.put(
+ s2bb("00348"),
+ new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("0"))), Arrays.asList(
+ newColUpdate("data", "seq", "2"), newColUpdate("data", "c", "2").setColVisibility(s2bb("A")))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00348")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
+
+ updates.clear();
+ updates.put(
+ s2bb("00348"),
+ new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("1"))), Arrays.asList(
+ newColUpdate("data", "seq", "2"), newColUpdate("data", "c", "2").setColVisibility(s2bb("A")))));
+
+ results = client.updateRowsConditionally(cwid, updates);
+
+ assertEquals(1, results.size());
+ assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
+
+ assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+ {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "2"}}, TABLE_TEST);
+
+ client.closeConditionalWriter(cwid);
+ try {
+ client.updateRowsConditionally(cwid, updates);
+ fail("conditional writer not closed");
+ } catch (UnknownWriter uk) {}
+
+ client.dropLocalUser(creds, "cwuser");
+
+ }
+
+ private void checkKey(String row, String cf, String cq, String val, KeyValue keyValue) {
+ assertEquals(row, ByteBufferUtil.toString(keyValue.key.row));
+ assertEquals(cf, ByteBufferUtil.toString(keyValue.key.colFamily));
+ assertEquals(cq, ByteBufferUtil.toString(keyValue.key.colQualifier));
+ assertEquals("", ByteBufferUtil.toString(keyValue.key.colVisibility));
+ assertEquals(val, ByteBufferUtil.toString(keyValue.value));
+ }
+
+ // scan metadata for file entries for the given table
+ private int countFiles(String table) throws Exception {
+ Map<String,String> tableIdMap = client.tableIdMap(creds);
+ String tableId = tableIdMap.get(table);
+ Key start = new Key();
+ start.row = s2bb(tableId + ";");
+ Key end = new Key();
+ end.row = s2bb(tableId + "<");
+ end = client.getFollowing(end, PartialKey.ROW);
+ ScanOptions opt = new ScanOptions();
+ opt.range = new Range(start, true, end, false);
+ opt.columns = Collections.singletonList(new ScanColumn(s2bb("file")));
+ String scanner = client.createScanner(creds, MetadataTable.NAME, opt);
+ int result = 0;
+ while (true) {
+ ScanResult more = client.nextK(scanner, 100);
+ result += more.getResults().size();
+ if (!more.more)
+ break;
+ }
+ return result;
+ }
+
+ private Map<ByteBuffer,List<ColumnUpdate>> mutation(String row, String cf, String cq, String value) {
+ ColumnUpdate upd = new ColumnUpdate(s2bb(cf), s2bb(cq));
+ upd.setValue(value.getBytes());
+ return Collections.singletonMap(s2bb(row), Collections.singletonList(upd));
+ }
+
+ private ByteBuffer s2bb(String cf) {
+ return ByteBuffer.wrap(cf.getBytes());
+ }
+
+ private Map<String,String> s2pp(String cf) {
+ Map<String,String> toRet = new TreeMap<String,String>();
+ toRet.put("password", cf);
+ return toRet;
+ }
+
+ static private ByteBuffer t2bb(Text t) {
+ return ByteBuffer.wrap(t.getBytes());
+ }
+
+ @Test
+ public void testGetRowRange() throws Exception {
+ Range range = client.getRowRange(s2bb("xyzzy"));
+ org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
+ assertEquals(0, range.start.row.compareTo(t2bb(range2.getStartKey().getRow())));
+ assertEquals(0, range.stop.row.compareTo(t2bb(range2.getEndKey().getRow())));
+ assertEquals(range.startInclusive, range2.isStartKeyInclusive());
+ assertEquals(range.stopInclusive, range2.isEndKeyInclusive());
+ assertEquals(0, range.start.colFamily.compareTo(t2bb(range2.getStartKey().getColumnFamily())));
+ assertEquals(0, range.start.colQualifier.compareTo(t2bb(range2.getStartKey().getColumnQualifier())));
+ assertEquals(0, range.stop.colFamily.compareTo(t2bb(range2.getEndKey().getColumnFamily())));
+ assertEquals(0, range.stop.colQualifier.compareTo(t2bb(range2.getEndKey().getColumnQualifier())));
+ assertEquals(range.start.timestamp, range.start.timestamp);
+ assertEquals(range.stop.timestamp, range.stop.timestamp);
+ }
-
- @AfterClass
- public static void tearDownMiniCluster() throws Exception {
- accumulo.stop();
- }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/AllowScansToBeInterruptedIT.java
----------------------------------------------------------------------
diff --cc test/src/test/java/org/apache/accumulo/test/AllowScansToBeInterruptedIT.java
index 2f28920,0000000..745f448
mode 100644,000000..100644
--- a/test/src/test/java/org/apache/accumulo/test/AllowScansToBeInterruptedIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/AllowScansToBeInterruptedIT.java
@@@ -1,99 -1,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;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+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.ActiveScan;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.apache.accumulo.test.functional.SlowIterator;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+// Accumulo3030
+public class AllowScansToBeInterruptedIT extends ConfigurableMacIT {
+
+ @Override
++ public int defaultTimeoutSeconds() {
++ return 60;
++ }
++
++ @Override
+ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setNumTservers(1);
+ }
+
- @Test(timeout = 60 * 1000)
++ @Test
+ public void test() throws Exception {
+ // make a table
+ final String tableName = getUniqueNames(1)[0];
+ final Connector conn = getConnector();
+ conn.tableOperations().create(tableName);
+ // make the world's slowest scanner
+ final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
+ final IteratorSetting cfg = new IteratorSetting(100, SlowIterator.class);
+ SlowIterator.setSeekSleepTime(cfg, 99999*1000);
+ scanner.addScanIterator(cfg);
+ // create a thread to interrupt the slow scan
+ final Thread scanThread = Thread.currentThread();
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ // ensure the scan is running: not perfect, the metadata tables could be scanned, too.
+ String tserver = conn.instanceOperations().getTabletServers().iterator().next();
+ do {
+ ArrayList<ActiveScan> scans = new ArrayList<ActiveScan>(conn.instanceOperations().getActiveScans(tserver));
+ Iterator<ActiveScan> iter = scans.iterator();
+ while (iter.hasNext()) {
+ ActiveScan scan = iter.next();
+ // Remove scans not against our table and not owned by us
+ if (!"root".equals(scan.getUser()) || !tableName.equals(scan.getTable())) {
+ iter.remove();
+ }
+ }
+
+ if (!scans.isEmpty()) {
+ // We found our scan
+ break;
+ }
+ } while (true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ // BAM!
+ scanThread.interrupt();
+ }
+ };
+ thread.start();
+ try {
+ // Use the scanner, expect problems
+ for (@SuppressWarnings("unused") Entry<Key,Value> entry : scanner) {
+ }
+ Assert.fail("Scan should not succeed");
+ } catch (Exception ex) {
+ } finally {
+ thread.join();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
----------------------------------------------------------------------
diff --cc test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
index 1ed87d5,0000000..8a4f275
mode 100644,000000..100644
--- a/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
@@@ -1,92 -1,0 +1,97 @@@
+/*
+ * 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;
+
+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.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.minicluster.impl.ProcessReference;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.RawLocalFileSystem;
+import org.junit.Assert;
+import org.junit.Test;
+
+// Accumulo3010
+public class RecoveryCompactionsAreFlushesIT extends ConfigurableMacIT {
+
+ @Override
++ public int defaultTimeoutSeconds() {
++ return 60;
++ }
++
++ @Override
+ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setNumTservers(1);
+ cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
+ // file system supports recovery
+ hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
+ }
-
- @Test(timeout = 60 * 1000)
++
++ @Test
+ public void test() throws Exception {
+ // create a table
+ String tableName = getUniqueNames(1)[0];
+ Connector c = getConnector();
+ c.tableOperations().create(tableName);
+ c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "100");
+ c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "3");
+ // create 3 flush files
+ BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+ Mutation m = new Mutation("a");
+ m.put("b", "c", new Value("v".getBytes()));
+ for (int i = 0; i < 3; i++) {
+ bw.addMutation(m);
+ bw.flush();
+ c.tableOperations().flush(tableName, null, null, true);
+ }
+ // create an unsaved mutation
+ bw.addMutation(m);
+ bw.close();
+ // kill the tablet server
+ for (ProcessReference p : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
+ cluster.killProcess(ServerType.TABLET_SERVER, p);
+ }
+ // recover
+ cluster.start();
+ // ensure the table is readable
+ for (@SuppressWarnings("unused") Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {
+ }
+ // ensure that the recovery was not a merging minor compaction
+ Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+ s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+ for (Entry<Key, Value> entry : s) {
+ String filename = entry.getKey().getColumnQualifier().toString();
+ String parts[] = filename.split("/");
+ Assert.assertFalse(parts[parts.length-1].startsWith("M"));
+ }
+ }
-
-
++
++
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
----------------------------------------------------------------------
diff --cc test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
index 5a068af,677e634..644f459
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java
@@@ -418,22 -423,11 +423,22 @@@ public class ShellServerIT extends Simp
ts.exec("revoke -u xyzzy -t " + MetadataTable.NAME + " Table.WRITE", true);
ts.exec("revoke -u xyzzy -t " + MetadataTable.NAME + " Table.GOOFY", false);
ts.exec("revoke -u xyzzy -t " + MetadataTable.NAME + " foo", false);
- ts.exec("deleteuser xyzzy", true);
+ ts.exec("deleteuser xyzzy", true, "deleteuser { xyzzy } (yes|no)?", true);
+ ts.exec("deleteuser -f xyzzy", true);
ts.exec("users", true, "xyzzy", false);
}
+
+ @Test(timeout = 60 * 1000)
+ public void durability() throws Exception {
+ final String table = name.getMethodName();
+ ts.exec("createtable " + table);
+ ts.exec("insert -d none a cf cq randomGunkaASDFWEAQRd");
+ ts.exec("insert -d foo a cf cq2 2", false, "foo", true);
+ ts.exec("scan -r a", true, "randomGunkaASDFWEAQRd", true);
+ ts.exec("scan -r a", true, "foo", false);
+ }
- @Test(timeout = 45000)
+ @Test
public void iter() throws Exception {
final String table = name.getMethodName();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/5f21edfc/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------