Repository: accumulo Updated Branches: refs/heads/master 1eb647812 -> 4c9fd4dec
ACCUMULO-3660 Fix IT -ssl directory creation Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/4c9fd4de Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/4c9fd4de Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/4c9fd4de Branch: refs/heads/master Commit: 4c9fd4decb83aab5913c53e5a7bee15dac293ed7 Parents: 1eb6478 Author: Christopher Tubbs <ctubb...@apache.org> Authored: Thu Mar 12 20:02:47 2015 -0400 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Thu Mar 12 20:02:47 2015 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/harness/AccumuloIT.java | 18 +++++++++++------- .../accumulo/harness/MiniClusterHarness.java | 5 +++-- .../test/functional/ConfigurableMacIT.java | 5 +++-- .../accumulo/test/functional/MonitorSslIT.java | 4 +++- .../apache/accumulo/test/functional/SslIT.java | 2 +- .../accumulo/test/functional/ZooCacheIT.java | 6 +++++- .../test/replication/CyclicReplicationIT.java | 2 +- 7 files changed, 27 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java b/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java index 144938e..d9d2e6a 100644 --- a/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java +++ b/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java @@ -19,7 +19,6 @@ package org.apache.accumulo.harness; import static org.junit.Assert.assertTrue; import java.io.File; -import java.util.Random; import org.apache.commons.io.FileUtils; import org.junit.Rule; @@ -44,12 +43,17 @@ public class AccumuloIT { return names; } - public static File createSharedTestDir(String name) { - File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests"); - assertTrue(baseDir.mkdirs() || baseDir.isDirectory()); - if (name != null) - baseDir = new File(baseDir, name); - File testDir = new File(baseDir, System.currentTimeMillis() + "_" + new Random().nextInt(Short.MAX_VALUE)); + /** + * Creates a directory for holding generated ssl files with the same name as the provided directory, but with the suffix "-ssl" appended. + * + * @param dir + * the original directory, which the new directory will be created next to; it should exist + * @return the new directory, after it is created as a new empty directory; old contents, if any, are removed first + */ + public static File createSslDir(File dir) { + String suffix = "-ssl"; + assertTrue(dir.exists() && dir.isDirectory()); + File testDir = new File(dir.getParentFile(), dir.getName() + suffix); FileUtils.deleteQuietly(testDir); assertTrue(testDir.mkdir()); return testDir; http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java b/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java index d8540cd..75e809c 100644 --- a/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java +++ b/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java @@ -118,7 +118,8 @@ public class MiniClusterHarness { rootPasswd = UUID.randomUUID().toString(); } - MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(AccumuloClusterIT.createTestDir(testClassName + "_" + testMethodName), rootPasswd); + File baseDir = AccumuloClusterIT.createTestDir(testClassName + "_" + testMethodName); + MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(baseDir, rootPasswd); // Enable native maps by default cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath()); @@ -127,7 +128,7 @@ public class MiniClusterHarness { Configuration coreSite = new Configuration(false); // Setup SSL and credential providers if the properties request such - configureForEnvironment(cfg, getClass(), AccumuloClusterIT.createSharedTestDir(this.getClass().getName() + "-ssl"), coreSite, kdc); + configureForEnvironment(cfg, getClass(), AccumuloClusterIT.createSslDir(baseDir), coreSite, kdc); // Invoke the callback for tests to configure MAC before it starts configCallback.configureMiniCluster(cfg, coreSite); http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java index 90f02b5..8c207c0 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java @@ -121,13 +121,14 @@ public class ConfigurableMacIT extends AccumuloIT { private void createMiniAccumulo() throws Exception { // createTestDir will give us a empty directory, we don't need to clean it up ourselves - MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(createTestDir(this.getClass().getName() + "_" + this.testName.getMethodName()), ROOT_PASSWORD); + File baseDir = createTestDir(this.getClass().getName() + "_" + this.testName.getMethodName()); + MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(baseDir, ROOT_PASSWORD); cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath()); cfg.setProperty(Property.GC_FILE_ARCHIVE, Boolean.TRUE.toString()); Configuration coreSite = new Configuration(false); configure(cfg, coreSite); cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.TRUE.toString()); - configureForEnvironment(cfg, getClass(), createSharedTestDir(this.getClass().getName() + "-ssl")); + configureForEnvironment(cfg, getClass(), createSslDir(baseDir)); cluster = new MiniAccumuloClusterImpl(cfg); if (coreSite.size() > 0) { File csFile = new File(cluster.getConfig().getConfDir(), "core-site.xml"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/test/src/test/java/org/apache/accumulo/test/functional/MonitorSslIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MonitorSslIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MonitorSslIT.java index 9f2d9ea..9dd27a3 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/MonitorSslIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/MonitorSslIT.java @@ -18,6 +18,7 @@ package org.apache.accumulo.test.functional; import static org.junit.Assert.assertTrue; +import java.io.File; import java.net.URL; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; @@ -85,7 +86,8 @@ public class MonitorSslIT extends ConfigurableMacIT { @Override public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { super.configure(cfg, hadoopCoreSite); - configureForSsl(cfg, createSharedTestDir(this.getClass().getName() + "-ssl")); + File baseDir = createTestDir(this.getClass().getName() + "_" + this.testName.getMethodName()); + configureForSsl(cfg, createSslDir(baseDir)); Map<String,String> siteConfig = cfg.getSiteConfig(); siteConfig.put(Property.MONITOR_SSL_KEYSTORE.getKey(), siteConfig.get(Property.RPC_SSL_KEYSTORE_PATH.getKey())); siteConfig.put(Property.MONITOR_SSL_KEYSTOREPASS.getKey(), siteConfig.get(Property.RPC_SSL_KEYSTORE_PASSWORD.getKey())); http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/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 daa6bb3..51cfad8 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 @@ -38,7 +38,7 @@ public class SslIT extends ConfigurableMacIT { @Override public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { super.configure(cfg, hadoopCoreSite); - configureForSsl(cfg, createSharedTestDir(this.getClass().getName() + "-ssl")); + configureForSsl(cfg, createSslDir(createTestDir(this.getClass().getName() + "_" + this.testName.getMethodName()))); } @Test http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/test/src/test/java/org/apache/accumulo/test/functional/ZooCacheIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ZooCacheIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ZooCacheIT.java index 47bc8be..1f424c4 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ZooCacheIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ZooCacheIT.java @@ -17,12 +17,14 @@ package org.apache.accumulo.test.functional; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import org.apache.commons.io.FileUtils; import org.junit.BeforeClass; import org.junit.Test; @@ -38,7 +40,9 @@ public class ZooCacheIT extends ConfigurableMacIT { @BeforeClass public static void createTestDirectory() { - testDir = createSharedTestDir(ZooCacheIT.class.getName() + pathName); + testDir = new File(createTestDir(ZooCacheIT.class.getName()), pathName); + FileUtils.deleteQuietly(testDir); + assertTrue(testDir.mkdir()); } @Test http://git-wip-us.apache.org/repos/asf/accumulo/blob/4c9fd4de/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java index 4ecb944..7099d5b 100644 --- a/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java +++ b/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java @@ -158,7 +158,7 @@ public class CyclicReplicationIT { master1Cfg.setInstanceName("master1"); // Set up SSL if needed - ConfigurableMacIT.configureForEnvironment(master1Cfg, this.getClass(), ConfigurableMacIT.createSharedTestDir(this.getClass().getName() + "-ssl")); + ConfigurableMacIT.configureForEnvironment(master1Cfg, this.getClass(), ConfigurableMacIT.createSslDir(master1Dir)); master1Cfg.setProperty(Property.REPLICATION_NAME, master1Cfg.getInstanceName()); master1Cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M");