You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2018/12/17 20:08:35 UTC

[accumulo] branch master updated: Create shared test methods for duplicate code

This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b8c9eb  Create shared test methods for duplicate code
8b8c9eb is described below

commit 8b8c9eba9d0de88ee4e29f1f484cc229374f4d99
Author: Mike Miller <mm...@apache.org>
AuthorDate: Mon Dec 17 15:07:10 2018 -0500

    Create shared test methods for duplicate code
---
 .../test/functional/WriteAheadLogEncryptedIT.java  | 31 ++----------------
 .../accumulo/test/functional/WriteAheadLogIT.java  | 37 +++++++++++++---------
 2 files changed, 25 insertions(+), 43 deletions(-)

diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java
index c301e12..462d25e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogEncryptedIT.java
@@ -17,22 +17,17 @@
 package org.apache.accumulo.test.functional;
 
 import static org.apache.accumulo.core.conf.Property.INSTANCE_CRYPTO_PREFIX;
+import static org.apache.accumulo.test.functional.WriteAheadLogIT.testWAL;
 
-import org.apache.accumulo.core.cli.BatchWriterOpts;
-import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
-import org.apache.accumulo.minicluster.ServerType;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.test.TestIngest;
-import org.apache.accumulo.test.VerifyIngest;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,13 +44,7 @@ public class WriteAheadLogEncryptedIT extends AccumuloClusterHarness {
         "org.apache.accumulo.core.cryptoImpl.AESCryptoService");
     cfg.setProperty(INSTANCE_CRYPTO_PREFIX.getKey() + "key.uri", keyPath);
 
-    cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "2M");
-    cfg.setProperty(Property.GC_CYCLE_DELAY, "1");
-    cfg.setProperty(Property.GC_CYCLE_START, "1");
-    cfg.setProperty(Property.MASTER_RECOVERY_DELAY, "1s");
-    cfg.setProperty(Property.TSERV_MAJC_DELAY, "1");
-    cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s");
-    hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
+    WriteAheadLogIT.setupConfig(cfg, hadoopCoreSite);
 
     // setup key file
     try {
@@ -83,21 +72,7 @@ public class WriteAheadLogEncryptedIT extends AccumuloClusterHarness {
   @Test
   public void test() throws Exception {
     try (AccumuloClient c = createAccumuloClient()) {
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-      c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "750K");
-      TestIngest.Opts opts = new TestIngest.Opts();
-      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
-      opts.setTableName(tableName);
-      opts.setClientProperties(getClientProperties());
-      vopts.setClientProperties(getClientProperties());
-
-      TestIngest.ingest(c, opts, new BatchWriterOpts());
-      vopts.setTableName(tableName);
-      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
-      getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
-      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      testWAL(c, getUniqueNames(1)[0]);
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java
index 614a77f..162cfad 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java
@@ -33,6 +33,10 @@ public class WriteAheadLogIT extends AccumuloClusterHarness {
 
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+    setupConfig(cfg, hadoopCoreSite);
+  }
+
+  public static void setupConfig(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
     cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "2M");
     cfg.setProperty(Property.GC_CYCLE_DELAY, "1");
     cfg.setProperty(Property.GC_CYCLE_START, "1");
@@ -50,22 +54,25 @@ public class WriteAheadLogIT extends AccumuloClusterHarness {
   @Test
   public void test() throws Exception {
     try (AccumuloClient c = createAccumuloClient()) {
-      String tableName = getUniqueNames(1)[0];
-      c.tableOperations().create(tableName);
-      c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "750K");
-      TestIngest.Opts opts = new TestIngest.Opts();
-      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
-      opts.setTableName(tableName);
-      opts.setClientProperties(getClientProperties());
-      vopts.setClientProperties(getClientProperties());
-
-      TestIngest.ingest(c, opts, new BatchWriterOpts());
-      vopts.setTableName(tableName);
-      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
-      getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
-      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      testWAL(c, getUniqueNames(1)[0]);
     }
   }
 
+  public static void testWAL(AccumuloClient c, String tableName) throws Exception {
+    c.tableOperations().create(tableName);
+    c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "750K");
+    TestIngest.Opts opts = new TestIngest.Opts();
+    VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+    opts.setTableName(tableName);
+    opts.setClientProperties(getClientProperties());
+    vopts.setClientProperties(getClientProperties());
+
+    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    vopts.setTableName(tableName);
+    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+    getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+    getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+  }
+
 }