ACCUMULO-2307 purging -ssl directories
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b1f0336d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b1f0336d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b1f0336d Branch: refs/heads/master Commit: b1f0336dd26d0eb7c2dd0b3635e8556f451418c5 Parents: 1e7f883 Author: John Vines <[email protected]> Authored: Fri Jan 31 19:32:55 2014 -0500 Committer: John Vines <[email protected]> Committed: Fri Jan 31 21:30:44 2014 -0500 ---------------------------------------------------------------------- .../accumulo/minicluster/impl/MiniAccumuloConfigImpl.java | 8 +++++--- .../org/apache/accumulo/test/functional/AbstractMacIT.java | 8 ++++---- .../java/org/apache/accumulo/test/functional/BulkIT.java | 7 ++++--- .../apache/accumulo/test/functional/ConfigurableMacIT.java | 2 +- .../java/org/apache/accumulo/test/functional/ExamplesIT.java | 8 ++++---- .../org/apache/accumulo/test/functional/SimpleMacIT.java | 2 +- .../test/java/org/apache/accumulo/test/functional/SslIT.java | 4 ++-- 7 files changed, 21 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java index feb7020..f1b23e4 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java @@ -85,8 +85,10 @@ public class MiniAccumuloConfigImpl { if (this.getDir().exists() && !this.getDir().isDirectory()) throw new IllegalArgumentException("Must pass in directory, " + this.getDir() + " is a file"); - if (this.getDir().exists() && this.getDir().list().length != 0) - throw new IllegalArgumentException("Directory " + this.getDir() + " is not empty"); + String[] dirList; + if (this.getDir().exists() && (dirList = this.getDir().list()).length != 0) + if (!(dirList.length == 1 && dirList[0].equals("ssl"))) + throw new IllegalArgumentException("Directory " + this.getDir() + " is not empty"); if (!initialized) { libDir = new File(dir, "lib"); @@ -371,7 +373,7 @@ public class MiniAccumuloConfigImpl { public File getClientConfFile() { return new File(getConfDir(), "client.conf"); } - + /** * sets system properties set for service processes * http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java index aab3edb..96a7cc9 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java @@ -85,20 +85,20 @@ public abstract class AbstractMacIT { return names; } - protected static void configureForEnvironment(MiniAccumuloConfigImpl cfg, Class<?> testClass, File folder) { + protected static void configureForEnvironment(MiniAccumuloConfigImpl cfg, Class<?> testClass) { if ("true".equals(System.getProperty("org.apache.accumulo.test.functional.useSslForIT"))) { - configureForSsl(cfg, folder); + configureForSsl(cfg); } } - protected static void configureForSsl(MiniAccumuloConfigImpl cfg, File folder) { + protected static void configureForSsl(MiniAccumuloConfigImpl cfg) { Map<String,String> siteConfig = cfg.getSiteConfig(); if ("true".equals(siteConfig.get(Property.INSTANCE_RPC_SSL_ENABLED.getKey()))) { // already enabled; don't mess with it return; } - File sslDir = new File(folder, "ssl"); + File sslDir = new File(cfg.getDir(), "ssl"); sslDir.mkdirs(); File rootKeystoreFile = new File(sslDir, "root-" + cfg.getInstanceName() + ".jks"); File localKeystoreFile = new File(sslDir, "local-" + cfg.getInstanceName() + ".jks"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java index 2fc0477..595957e 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/BulkIT.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.test.functional; +import java.io.File; import java.io.IOException; import org.apache.accumulo.core.client.AccumuloException; @@ -39,14 +40,14 @@ public class BulkIT extends SimpleMacIT { @Test(timeout = 4 * 60 * 1000) public void test() throws Exception { - runTest(getConnector(), getTableNames(1)[0], this.getClass().getName()); + runTest(getConnector(), getTableNames(1)[0], this.getClass().getName(), getFolder()); } - static void runTest(Connector c, String tableName, String filePrefix) throws AccumuloException, AccumuloSecurityException, TableExistsException, IOException, TableNotFoundException, + static void runTest(Connector c, String tableName, String filePrefix, File workingDirectory) throws AccumuloException, AccumuloSecurityException, TableExistsException, IOException, TableNotFoundException, MutationsRejectedException { c.tableOperations().create(tableName); FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); - String base = "target/accumulo-maven-plugin"; + String base = workingDirectory.getAbsolutePath(); fs.delete(new Path(base + "/testrf"), true); fs.mkdirs(new Path(base + "/testBulkFail")); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/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 7899bf9..0de01c9 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 @@ -46,7 +46,7 @@ public class ConfigurableMacIT extends AbstractMacIT { cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath()); configure(cfg); cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.TRUE.toString()); - configureForEnvironment(cfg, getClass(), createSharedTestDir(this.getClass().getName() + "-ssl")); + configureForEnvironment(cfg, getClass()); cluster = new MiniAccumuloClusterImpl(cfg); cluster.start(); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java index 8d0cb48..7b953dc 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java @@ -110,7 +110,7 @@ public class ExamplesIT extends AbstractMacIT { cfg.setDefaultMemory(cfg.getDefaultMemory() * 2, MemoryUnit.BYTE); cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.TRUE.toString()); - configureForEnvironment(cfg, ExamplesIT.class, createSharedTestDir(ExamplesIT.class.getName() + "-ssl")); + configureForEnvironment(cfg, ExamplesIT.class); cluster = new MiniAccumuloClusterImpl(cfg); cluster.start(); @@ -193,7 +193,7 @@ public class ExamplesIT extends AbstractMacIT { assertEquals(0, count); } - @Test(timeout = 50 * 1000) + @Test(timeout = 90 * 1000) public void testBloomFilters() throws Exception { c.tableOperations().create("bloom_test"); c.tableOperations().setProperty("bloom_test", Property.TABLE_BLOOM_ENABLED.getKey(), "true"); @@ -307,7 +307,7 @@ public class ExamplesIT extends AbstractMacIT { goodExec(RowOperations.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd); } - @Test(timeout = 15 * 1000) + @Test(timeout = 30 * 1000) public void testBatchWriter() throws Exception { c.tableOperations().create("test"); goodExec(SequentialBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "test", "--start", "0", "--num", "100000", "--size", @@ -324,7 +324,7 @@ public class ExamplesIT extends AbstractMacIT { } - @Test(timeout = 50 * 1000) + @Test(timeout = 90 * 1000) public void testRandomBatchesAndFlush() throws Exception { String test3 = "test3"; c.tableOperations().create(test3); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java index 0bfc991..da265cb 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java @@ -44,7 +44,7 @@ public class SimpleMacIT extends AbstractMacIT { MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(folder, ROOT_PASSWORD); cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath()); cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.TRUE.toString()); - configureForEnvironment(cfg, SimpleMacIT.class, createSharedTestDir(SimpleMacIT.class.getName() + "-ssl")); + configureForEnvironment(cfg, SimpleMacIT.class); cluster = new MiniAccumuloClusterImpl(cfg); cluster.start(); Runtime.getRuntime().addShutdownHook(new Thread() { http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1f0336d/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 d2de97f..447f8ef 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 @@ -30,7 +30,7 @@ public class SslIT extends ConfigurableMacIT { @Override public void configure(MiniAccumuloConfigImpl cfg) { super.configure(cfg); - configureForSsl(cfg, createSharedTestDir(this.getClass().getName() + "-ssl")); + configureForSsl(cfg); } @Test(timeout = 60 * 1000) @@ -51,7 +51,7 @@ public class SslIT extends ConfigurableMacIT { @Test(timeout = 5 * 60 * 1000) public void bulk() throws Exception { - BulkIT.runTest(getConnector(), getTableNames(1)[0], this.getClass().getName()); + BulkIT.runTest(getConnector(), getTableNames(1)[0], this.getClass().getName(), cluster.getConfig().getDir()); } @Test(timeout = 60 * 1000)
