http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterTest.java b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterTest.java deleted file mode 100644 index b92eede..0000000 --- a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterTest.java +++ /dev/null @@ -1,565 +0,0 @@ -/* - * 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.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; - -import org.apache.accumulo.core.client.BatchWriter; -import org.apache.accumulo.core.client.BatchWriterConfig; -import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.MultiTableBatchWriter; -import org.apache.accumulo.core.client.MutationsRejectedException; -import org.apache.accumulo.core.client.Scanner; -import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.client.TableOfflineException; -import org.apache.accumulo.core.client.ZooKeeperInstance; -import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.client.impl.MultiTableBatchWriterImpl; -import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.Mutation; -import org.apache.accumulo.core.data.Range; -import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; -import org.apache.accumulo.minicluster.MiniAccumuloCluster; -import org.apache.accumulo.minicluster.MiniAccumuloConfig; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import com.google.common.collect.Maps; - -public class MultiTableBatchWriterTest { - public static TemporaryFolder folder = new TemporaryFolder(); - public static MiniAccumuloCluster cluster; - private static final PasswordToken password = new PasswordToken("secret"); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - folder.create(); - MiniAccumuloConfig cfg = new MiniAccumuloConfig(folder.newFolder("miniAccumulo"), new String(password.getPassword())); - cluster = new MiniAccumuloCluster(cfg); - cluster.start(); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - cluster.stop(); - folder.delete(); - } - - @Test - public void testTableRenameDataValidation() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS); - - try { - final String table1 = "testTableRenameDataValidation_table1", table2 = "testTableRenameDataValidation_table2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - - BatchWriter bw1 = mtbw.getBatchWriter(table1); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - - bw1.addMutation(m1); - - tops.rename(table1, table2); - tops.create(table1); - - BatchWriter bw2 = mtbw.getBatchWriter(table1); - - Mutation m2 = new Mutation("bar"); - m2.put("col1", "", "val1"); - - bw1.addMutation(m2); - bw2.addMutation(m2); - - mtbw.close(); - - Map<Entry<String,String>,String> table1Expectations = new HashMap<Entry<String,String>,String>(); - table1Expectations.put(Maps.immutableEntry("bar", "col1"), "val1"); - - Map<Entry<String,String>,String> table2Expectations = new HashMap<Entry<String,String>,String>(); - table2Expectations.put(Maps.immutableEntry("foo", "col1"), "val1"); - table2Expectations.put(Maps.immutableEntry("bar", "col1"), "val1"); - - Scanner s = connector.createScanner(table1, new Authorizations()); - s.setRange(new Range()); - Map<Entry<String,String>,String> actual = new HashMap<Entry<String,String>,String>(); - for (Entry<Key,Value> entry : s) { - actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString()); - } - - Assert.assertEquals("Differing results for " + table1, table1Expectations, actual); - - s = connector.createScanner(table2, new Authorizations()); - s.setRange(new Range()); - actual = new HashMap<Entry<String,String>,String>(); - for (Entry<Key,Value> entry : s) { - actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString()); - } - - Assert.assertEquals("Differing results for " + table2, table2Expectations, actual); - - } finally { - if (null != mtbw) { - mtbw.close(); - } - } - } - - @Test - public void testTableRenameSameWriters() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS); - - try { - final String table1 = "testTableRenameSameWriters_table1", table2 = "testTableRenameSameWriters_table2"; - final String newTable1 = "testTableRenameSameWriters_newTable1", newTable2 = "testTableRenameSameWriters_newTable2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - tops.rename(table1, newTable1); - tops.rename(table2, newTable2); - - Mutation m2 = new Mutation("bar"); - m2.put("col1", "", "val1"); - m2.put("col2", "", "val2"); - - bw1.addMutation(m2); - bw2.addMutation(m2); - - mtbw.close(); - - Map<Entry<String,String>,String> expectations = new HashMap<Entry<String,String>,String>(); - expectations.put(Maps.immutableEntry("foo", "col1"), "val1"); - expectations.put(Maps.immutableEntry("foo", "col2"), "val2"); - expectations.put(Maps.immutableEntry("bar", "col1"), "val1"); - expectations.put(Maps.immutableEntry("bar", "col2"), "val2"); - - for (String table : Arrays.asList(newTable1, newTable2)) { - Scanner s = connector.createScanner(table, new Authorizations()); - s.setRange(new Range()); - Map<Entry<String,String>,String> actual = new HashMap<Entry<String,String>,String>(); - for (Entry<Key,Value> entry : s) { - actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString()); - } - - Assert.assertEquals("Differing results for " + table, expectations, actual); - } - } finally { - if (null != mtbw) { - mtbw.close(); - } - } - } - - @Test - public void testTableRenameNewWriters() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS); - - try { - final String table1 = "testTableRenameNewWriters_table1", table2 = "testTableRenameNewWriters_table2"; - final String newTable1 = "testTableRenameNewWriters_newTable1", newTable2 = "testTableRenameNewWriters_newTable2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - tops.rename(table1, newTable1); - - // MTBW is still caching this name to the correct table, but we should invalidate its cache - // after seeing the rename - try { - bw1 = mtbw.getBatchWriter(table1); - Assert.fail("Should not be able to find this table"); - } catch (TableNotFoundException e) { - // pass - } - - tops.rename(table2, newTable2); - - try { - bw2 = mtbw.getBatchWriter(table2); - Assert.fail("Should not be able to find this table"); - } catch (TableNotFoundException e) { - // pass - } - - bw1 = mtbw.getBatchWriter(newTable1); - bw2 = mtbw.getBatchWriter(newTable2); - - Mutation m2 = new Mutation("bar"); - m2.put("col1", "", "val1"); - m2.put("col2", "", "val2"); - - bw1.addMutation(m2); - bw2.addMutation(m2); - - mtbw.close(); - - Map<Entry<String,String>,String> expectations = new HashMap<Entry<String,String>,String>(); - expectations.put(Maps.immutableEntry("foo", "col1"), "val1"); - expectations.put(Maps.immutableEntry("foo", "col2"), "val2"); - expectations.put(Maps.immutableEntry("bar", "col1"), "val1"); - expectations.put(Maps.immutableEntry("bar", "col2"), "val2"); - - for (String table : Arrays.asList(newTable1, newTable2)) { - Scanner s = connector.createScanner(table, new Authorizations()); - s.setRange(new Range()); - Map<Entry<String,String>,String> actual = new HashMap<Entry<String,String>,String>(); - for (Entry<Key,Value> entry : s) { - actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString()); - } - - Assert.assertEquals("Differing results for " + table, expectations, actual); - } - } finally { - if (null != mtbw) { - mtbw.close(); - } - } - } - - @Test - public void testTableRenameNewWritersNoCaching() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 0, TimeUnit.SECONDS); - - try { - final String table1 = "testTableRenameNewWritersNoCaching_table1", table2 = "testTableRenameNewWritersNoCaching_table2"; - final String newTable1 = "testTableRenameNewWritersNoCaching_newTable1", newTable2 = "testTableRenameNewWritersNoCaching_newTable2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - tops.rename(table1, newTable1); - tops.rename(table2, newTable2); - - try { - bw1 = mtbw.getBatchWriter(table1); - Assert.fail("Should not have gotten batchwriter for " + table1); - } catch (TableNotFoundException e) { - // Pass - } - - try { - bw2 = mtbw.getBatchWriter(table2); - } catch (TableNotFoundException e) { - // Pass - } - } finally { - if (null != mtbw) { - mtbw.close(); - } - } - } - - @Test - public void testTableDelete() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS); - boolean mutationsRejected = false; - - try { - final String table1 = "testTableDelete_table1", table2 = "testTableDelete_table2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - tops.delete(table1); - tops.delete(table2); - - Mutation m2 = new Mutation("bar"); - m2.put("col1", "", "val1"); - m2.put("col2", "", "val2"); - - try { - bw1.addMutation(m2); - bw2.addMutation(m2); - } catch (MutationsRejectedException e) { - // Pass - Mutations might flush immediately - mutationsRejected = true; - } - - } finally { - if (null != mtbw) { - try { - // Mutations might have flushed before the table offline occurred - mtbw.close(); - } catch (MutationsRejectedException e) { - // Pass - mutationsRejected = true; - } - } - } - - Assert.assertTrue("Expected mutations to be rejected.", mutationsRejected); - } - - @Test - public void testOfflineTable() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS); - boolean mutationsRejected = false; - - try { - final String table1 = "testOfflineTable_table1", table2 = "testOfflineTable_table2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - tops.offline(table1, true); - tops.offline(table2, true); - - Mutation m2 = new Mutation("bar"); - m2.put("col1", "", "val1"); - m2.put("col2", "", "val2"); - - try { - bw1.addMutation(m2); - bw2.addMutation(m2); - } catch (MutationsRejectedException e) { - // Pass -- Mutations might flush immediately and fail because of offline table - mutationsRejected = true; - } - } finally { - if (null != mtbw) { - try { - mtbw.close(); - } catch (MutationsRejectedException e) { - // Pass - mutationsRejected = true; - } - } - } - - Assert.assertTrue("Expected mutations to be rejected.", mutationsRejected); - } - - @Test - public void testOfflineTableWithCache() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 60, TimeUnit.SECONDS); - boolean mutationsRejected = false; - - try { - final String table1 = "testOfflineTableWithCache_table1", table2 = "testOfflineTableWithCache_table2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - tops.offline(table1); - - try { - bw1 = mtbw.getBatchWriter(table1); - } catch (TableOfflineException e) { - // pass - mutationsRejected = true; - } - - tops.offline(table2); - - try { - bw2 = mtbw.getBatchWriter(table2); - } catch (TableOfflineException e) { - // pass - mutationsRejected = true; - } - } finally { - if (null != mtbw) { - try { - // Mutations might have flushed before the table offline occurred - mtbw.close(); - } catch (MutationsRejectedException e) { - // Pass - mutationsRejected = true; - } - } - } - - Assert.assertTrue("Expected mutations to be rejected.", mutationsRejected); - } - - @Test - public void testOfflineTableWithoutCache() throws Exception { - ZooKeeperInstance instance = new ZooKeeperInstance(new ClientConfiguration().withInstance(cluster.getInstanceName()).withZkHosts(cluster.getZooKeepers())); - Connector connector = instance.getConnector("root", password); - - BatchWriterConfig config = new BatchWriterConfig(); - - Credentials creds = new Credentials("root", password); - MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 0, TimeUnit.SECONDS); - boolean mutationsRejected = false; - - try { - final String table1 = "testOfflineTableWithoutCache_table1", table2 = "testOfflineTableWithoutCache_table2"; - - TableOperations tops = connector.tableOperations(); - tops.create(table1); - tops.create(table2); - - BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2); - - Mutation m1 = new Mutation("foo"); - m1.put("col1", "", "val1"); - m1.put("col2", "", "val2"); - - bw1.addMutation(m1); - bw2.addMutation(m1); - - // Mutations might or might not flush before tables goes offline - tops.offline(table1); - tops.offline(table2); - - try { - bw1 = mtbw.getBatchWriter(table1); - Assert.fail(table1 + " should be offline"); - } catch (TableOfflineException e) { - // pass - mutationsRejected = true; - } - - try { - bw2 = mtbw.getBatchWriter(table2); - Assert.fail(table1 + " should be offline"); - } catch (TableOfflineException e) { - // pass - mutationsRejected = true; - } - } finally { - if (null != mtbw) { - try { - // Mutations might have flushed before the table offline occurred - mtbw.close(); - } catch (MutationsRejectedException e) { - // Pass - mutationsRejected = true; - } - } - } - - Assert.assertTrue("Expected mutations to be rejected.", mutationsRejected); - } -}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/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 4f0c14c..21b56b7 100644 --- a/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java +++ b/test/src/test/java/org/apache/accumulo/test/ShellServerIT.java @@ -147,6 +147,7 @@ public class ShellServerIT extends SimpleMacIT { public static void setUpBeforeClass() throws Exception { // history file is updated in $HOME System.setProperty("HOME", getFolder().getAbsolutePath()); + System.setProperty("hadoop.tmp.dir", System.getProperty("user.dir") + "/target/hadoop-tmp"); // start the shell output = new TestOutputStream(); @@ -768,11 +769,11 @@ public class ShellServerIT extends SimpleMacIT { @Test(timeout = 30 * 1000) public void testPertableClasspath() throws Exception { - File fooFilterJar = File.createTempFile("FooFilter", ".jar"); + File fooFilterJar = File.createTempFile("FooFilter", ".jar", getFolder()); FileUtils.copyURLToFile(this.getClass().getResource("/FooFilter.jar"), fooFilterJar); fooFilterJar.deleteOnExit(); - File fooConstraintJar = File.createTempFile("FooConstraint", ".jar"); + File fooConstraintJar = File.createTempFile("FooConstraint", ".jar", getFolder()); FileUtils.copyURLToFile(this.getClass().getResource("/FooConstraint.jar"), fooConstraintJar); fooConstraintJar.deleteOnExit(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/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 54585fe..a7abcb1 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 @@ -64,7 +64,7 @@ public class ConfigurableMacIT extends AbstractMacIT { return getCluster().getConnector("root", ROOT_PASSWORD); } - public Process exec(Class<? extends Object> clazz, String... args) throws IOException { + public Process exec(Class<?> clazz, String... args) throws IOException { return getCluster().exec(clazz, args); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/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 16b425f..dcf72c8 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 @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -89,7 +90,7 @@ public class ExamplesIT extends ConfigurableMacIT { cfg.setDefaultMemory(cfg.getDefaultMemory() * 2, MemoryUnit.BYTE); } - @Test(timeout = 10 * 60 * 1000) + @Test(timeout = 15 * 60 * 1000) public void test() throws Exception { Connector c = getConnector(); String instance = c.getInstance().getInstanceName(); @@ -104,13 +105,12 @@ public class ExamplesIT extends ConfigurableMacIT { String dir = cluster.getConfig().getDir().getAbsolutePath(); FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); - Process trace = cluster.exec(TraceServer.class); + Process trace = exec(TraceServer.class); while (!c.tableOperations().exists("trace")) UtilWaitThread.sleep(500); log.info("trace example"); - Process p = cluster.exec(TracingExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-C", "-D", "-c"); - assertEquals(0, p.waitFor()); + Process p = goodExec(TracingExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-C", "-D", "-c"); for (LogWriter writer : cluster.getLogWriters()) { writer.flush(); } @@ -119,8 +119,7 @@ public class ExamplesIT extends ConfigurableMacIT { Matcher matcher = pattern.matcher(result); int count = 0; while (matcher.find()) { - p = cluster.exec(TraceDumpExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--traceid", matcher.group(1)); - assertEquals(0, p.waitFor()); + p = goodExec(TraceDumpExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--traceid", matcher.group(1)); count++; } assertTrue(count > 0); @@ -130,13 +129,10 @@ public class ExamplesIT extends ConfigurableMacIT { log.info("testing dirlist example (a little)"); c.securityOperations().changeUserAuthorizations(user, new Authorizations(auths.split(","))); - assertEquals( - 0, - cluster.exec(Ingest.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--dirTable", "dirTable", "--indexTable", "indexTable", - "--dataTable", "dataTable", "--vis", visibility, "--chunkSize", 10000 + "", cluster.getConfig().getDir().getAbsolutePath()).waitFor()); - p = cluster.exec(QueryUtil.class, "-i", instance, "-z", keepers, "-p", passwd, "-u", user, "-t", "indexTable", "--auths", auths, "--search", "--path", + goodExec(Ingest.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--dirTable", "dirTable", "--indexTable", "indexTable", "--dataTable", + "dataTable", "--vis", visibility, "--chunkSize", 10000 + "", cluster.getConfig().getDir().getAbsolutePath()); + p = goodExec(QueryUtil.class, "-i", instance, "-z", keepers, "-p", passwd, "-u", user, "-t", "indexTable", "--auths", auths, "--search", "--path", "accumulo-site.xml"); - assertEquals(0, p.waitFor()); for (LogWriter writer : cluster.getLogWriters()) { writer.flush(); } @@ -163,25 +159,19 @@ public class ExamplesIT extends ConfigurableMacIT { log.info("Testing bloom filters are fast for missing data"); c.tableOperations().create("bloom_test"); c.tableOperations().setProperty("bloom_test", Property.TABLE_BLOOM_ENABLED.getKey(), "true"); - assertEquals( - 0, - cluster.exec(RandomBatchWriter.class, "--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", ROOT_PASSWORD, "--num", "100000", "--min", "0", - "--max", "1000000000", "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", "bloom_test").waitFor()); + goodExec(RandomBatchWriter.class, "--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", ROOT_PASSWORD, "--num", "100000", "--min", "0", "--max", + "1000000000", "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", "bloom_test"); c.tableOperations().flush("bloom_test", null, null, true); long diff = 0, diff2 = 0; // try the speed test a couple times in case the system is loaded with other tests for (int i = 0; i < 2; i++) { long now = System.currentTimeMillis(); - assertEquals( - 0, - cluster.exec(RandomBatchScanner.class, "--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", ROOT_PASSWORD, "--num", "10000", "--min", "0", - "--max", "1000000000", "--size", "50", "--scanThreads", "4", "-t", "bloom_test").waitFor()); + goodExec(RandomBatchScanner.class, "--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", ROOT_PASSWORD, "--num", "10000", "--min", "0", + "--max", "1000000000", "--size", "50", "--scanThreads", "4", "-t", "bloom_test"); diff = System.currentTimeMillis() - now; now = System.currentTimeMillis(); - assertEquals( - 1, - cluster.exec(RandomBatchScanner.class, "--seed", "8", "-i", instance, "-z", keepers, "-u", user, "-p", ROOT_PASSWORD, "--num", "10000", "--min", "0", - "--max", "1000000000", "--size", "50", "--scanThreads", "4", "-t", "bloom_test").waitFor()); + expectExec(1, RandomBatchScanner.class, "--seed", "8", "-i", instance, "-z", keepers, "-u", user, "-p", ROOT_PASSWORD, "--num", "10000", "--min", "0", + "--max", "1000000000", "--size", "50", "--scanThreads", "4", "-t", "bloom_test"); diff2 = System.currentTimeMillis() - now; if (diff2 < diff) break; @@ -206,13 +196,10 @@ public class ExamplesIT extends ConfigurableMacIT { assertTrue(thisFile); // create a reverse index c.tableOperations().create("doc2Term"); - assertEquals(0, cluster.exec(Reverse.class, "-i", instance, "-z", keepers, "--shardTable", "shard", "--doc2Term", "doc2Term", "-u", "root", "-p", passwd) - .waitFor()); + goodExec(Reverse.class, "-i", instance, "-z", keepers, "--shardTable", "shard", "--doc2Term", "doc2Term", "-u", "root", "-p", passwd); // run some queries - assertEquals( - 0, - cluster.exec(ContinuousQuery.class, "-i", instance, "-z", keepers, "--shardTable", "shard", "--doc2Term", "doc2Term", "-u", "root", "-p", passwd, - "--terms", "5", "--count", "1000").waitFor()); + goodExec(ContinuousQuery.class, "-i", instance, "-z", keepers, "--shardTable", "shard", "--doc2Term", "doc2Term", "-u", "root", "-p", passwd, "--terms", + "5", "--count", "1000"); log.info("Testing MaxMutation constraint"); c.tableOperations().create("test_ingest"); @@ -227,23 +214,21 @@ public class ExamplesIT extends ConfigurableMacIT { } log.info("Starting bulk ingest example"); - assertEquals(0, cluster.exec(GenerateTestData.class, "--start-row", "0", "--count", "10000", "--output", dir + "/tmp/input/data").waitFor()); - assertEquals(0, cluster.exec(SetupTable.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "bulkTable").waitFor()); - assertEquals( - 0, - cluster.exec(BulkIngestExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "bulkTable", "--inputDir", - dir + "/tmp/input", "--workDir", dir + "/tmp").waitFor()); + goodExec(GenerateTestData.class, "--start-row", "0", "--count", "10000", "--output", dir + "/tmp/input/data"); + goodExec(SetupTable.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "bulkTable"); + goodExec(BulkIngestExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "bulkTable", "--inputDir", dir + "/tmp/input", + "--workDir", dir + "/tmp"); log.info("Running TeraSortIngest example"); - exec(TeraSortIngest.class, new String[] {"--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", "sorted", "-i", instance, - "-z", keepers, "-u", user, "-p", passwd, "--splits", "4"}); + goodExec(TeraSortIngest.class, "--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", "sorted", "-i", instance, "-z", + keepers, "-u", user, "-p", passwd, "--splits", "4"); log.info("Running Regex example"); - exec(RegexExample.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "sorted", "--rowRegex", ".*999.*", "--output", - dir + "/tmp/nines"}); + goodExec(RegexExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "sorted", "--rowRegex", ".*999.*", "--output", dir + + "/tmp/nines"); log.info("Running RowHash example"); - exec(RowHash.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "sorted", "--column", "c:"}); + goodExec(RowHash.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "sorted", "--column", "c:"); log.info("Running TableToFile example"); - exec(TableToFile.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "sorted", "--output", dir + "/tmp/tableFile"}); + goodExec(TableToFile.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "sorted", "--output", dir + "/tmp/tableFile"); log.info("Running word count example"); c.tableOperations().create("wordCount"); @@ -252,39 +237,48 @@ public class ExamplesIT extends ConfigurableMacIT { SummingCombiner.setEncodingType(is, SummingCombiner.Type.STRING); c.tableOperations().attachIterator("wordCount", is); fs.copyFromLocalFile(new Path(new Path(System.getProperty("user.dir")).getParent(), "README"), new Path(dir + "/tmp/wc/README")); - exec(WordCount.class, new String[] {"-i", instance, "-u", user, "-p", passwd, "-z", keepers, "--input", dir + "/tmp/wc", "-t", "wordCount"}); + goodExec(WordCount.class, "-i", instance, "-u", user, "-p", passwd, "-z", keepers, "--input", dir + "/tmp/wc", "-t", "wordCount"); log.info("Inserting data with a batch writer"); - exec(InsertWithBatchWriter.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "helloBatch"}); + goodExec(InsertWithBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "helloBatch"); log.info("Reading data"); - exec(ReadData.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "helloBatch"}); + goodExec(ReadData.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "helloBatch"); log.info("Running isolated scans"); - exec(InterferenceTest.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "itest1", "--iterations", "100000", "--isolated"}); + goodExec(InterferenceTest.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "itest1", "--iterations", "100000", "--isolated"); log.info("Running scans without isolation"); - exec(InterferenceTest.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "itest2", "--iterations", "100000",}); + goodExec(InterferenceTest.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "itest2", "--iterations", "100000"); log.info("Performing some row operations"); - exec(RowOperations.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd,}); + goodExec(RowOperations.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd); log.info("Using the batch writer"); c.tableOperations().create("test"); - exec(SequentialBatchWriter.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "test", "--start", "0", "--num", "100000", - "--size", "50", "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}); + goodExec(SequentialBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", "test", "--start", "0", "--num", "100000", "--size", + "50", "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility); log.info("Reading and writing some data"); - exec(ReadWriteExample.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", "test2", "--createtable", - "-c", "--debug"}); + goodExec(ReadWriteExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", "test2", "--createtable", "-c", + "--debug"); log.info("Deleting some data"); - exec(ReadWriteExample.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", "test2", "-d", "--debug"}); + goodExec(ReadWriteExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", "test2", "-d", "--debug"); log.info("Writing some data with the batch writer"); c.tableOperations().create("test3"); - exec(RandomBatchWriter.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "test3", "--num", "100000", "--min", "0", - "--max", "99999", "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}); + goodExec(RandomBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "test3", "--num", "100000", "--min", "0", "--max", + "100000", "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility); log.info("Reading some data with the batch scanner"); - exec(RandomBatchScanner.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "test3", "--num", "10000", "--min", "0", - "--max", "99999", "--size", "100", "--scanThreads", "4", "--auths", auths}); + goodExec(RandomBatchScanner.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "test3", "--num", "10000", "--min", "0", "--max", + "100000", "--size", "100", "--scanThreads", "4", "--auths", auths); log.info("Running an example table operation (Flush)"); - exec(Flush.class, new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "test3",}); - assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor()); + goodExec(Flush.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", "test3"); + goodExec(Admin.class, "stopAll"); } + private Process goodExec(Class<?> theClass, String... args) throws InterruptedException, IOException { + return expectExec(0, theClass, args); + } + + private Process expectExec(int exitCode, Class<?> theClass, String... args) throws InterruptedException, IOException { + Process p = null; + assertEquals(exitCode, (p = cluster.exec(theClass, Collections.singletonList(MapReduceIT.hadoopTmpDirArg), args)).waitFor()); + return p; + } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java index 8644440..08a6f51 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java @@ -23,9 +23,9 @@ import java.io.IOException; import java.io.InputStream; import java.util.Collection; import java.util.HashMap; -import java.util.SortedSet; import java.util.Map.Entry; import java.util.Set; +import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -50,34 +50,34 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; public class FunctionalTestUtils { - + static void checkRFiles(Connector c, String tableName, int minTablets, int maxTablets, int minRFiles, int maxRFiles) throws Exception { Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY); String tableId = c.tableOperations().tableIdMap().get(tableName); scanner.setRange(new Range(new Text(tableId + ";"), true, new Text(tableId + "<"), true)); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME); MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); - + HashMap<Text,Integer> tabletFileCounts = new HashMap<Text,Integer>(); - + for (Entry<Key,Value> entry : scanner) { - + Text row = entry.getKey().getRow(); - + Integer count = tabletFileCounts.get(row); if (count == null) count = 0; if (entry.getKey().getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) { count = count + 1; } - + tabletFileCounts.put(row, count); } - + if (tabletFileCounts.size() < minTablets || tabletFileCounts.size() > maxTablets) { throw new Exception("Did not find expected number of tablets " + tabletFileCounts.size()); } - + Set<Entry<Text,Integer>> es = tabletFileCounts.entrySet(); for (Entry<Text,Integer> entry : es) { if (entry.getValue() > maxRFiles || entry.getValue() < minRFiles) { @@ -85,28 +85,28 @@ public class FunctionalTestUtils { } } } - + static public void bulkImport(Connector c, FileSystem fs, String table, String dir) throws Exception { String failDir = dir + "_failures"; Path failPath = new Path(failDir); fs.delete(failPath, true); fs.mkdirs(failPath); - + c.tableOperations().importDirectory(table, dir, failDir, false); - + if (fs.listStatus(failPath).length > 0) { throw new Exception("Some files failed to bulk import"); } - + } - + static public void checkSplits(Connector c, String table, int min, int max) throws Exception { Collection<Text> splits = c.tableOperations().listSplits(table); if (splits.size() < min || splits.size() > max) { throw new Exception("# of table splits points out of range, #splits=" + splits.size() + " table=" + table + " min=" + min + " max=" + max); } } - + static public void createRFiles(final Connector c, FileSystem fs, String path, int rows, int splits, int threads) throws Exception { fs.delete(new Path(path), true); ExecutorService threadPool = Executors.newFixedThreadPool(threads); @@ -135,7 +135,7 @@ public class FunctionalTestUtils { threadPool.awaitTermination(1, TimeUnit.HOURS); assertFalse(fail.get()); } - + static public String readAll(InputStream is) throws IOException { byte[] buffer = new byte[4096]; StringBuffer result = new StringBuffer(); @@ -147,27 +147,28 @@ public class FunctionalTestUtils { } return result.toString(); } - - static String readAll(MiniAccumuloCluster c, Class<? extends Object> klass, Process p) throws Exception { + + static String readAll(MiniAccumuloCluster c, Class<?> klass, Process p) throws Exception { for (LogWriter writer : c.getLogWriters()) writer.flush(); return readAll(new FileInputStream(c.getConfig().getLogDir() + "/" + klass.getSimpleName() + "_" + p.hashCode() + ".out")); } - + static Mutation nm(String row, String cf, String cq, Value value) { Mutation m = new Mutation(new Text(row)); m.put(new Text(cf), new Text(cq), value); return m; } - + static Mutation nm(String row, String cf, String cq, String value) { return nm(row, cf, cq, new Value(value.getBytes())); } - public static SortedSet<Text> splits(String [] splits) { + + public static SortedSet<Text> splits(String[] splits) { SortedSet<Text> result = new TreeSet<Text>(); for (String split : splits) result.add(new Text(split)); return result; } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java index 0867e73..bb3a9e5 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/MapReduceIT.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.util.Collections; import java.util.Map.Entry; import org.apache.accumulo.core.client.AccumuloException; @@ -43,6 +44,7 @@ import org.codehaus.plexus.util.Base64; import org.junit.Test; public class MapReduceIT extends ConfigurableMacIT { + public static final String hadoopTmpDirArg = "-Dhadoop.tmp.dir=" + System.getProperty("user.dir") + "/target/hadoop-tmp"; static final String tablename = "mapredf"; static final String input_cf = "cf-HASHTYPE"; @@ -66,8 +68,8 @@ public class MapReduceIT extends ConfigurableMacIT { bw.addMutation(m); } bw.close(); - Process hash = cluster.exec(RowHash.class, "-i", c.getInstance().getInstanceName(), "-z", c.getInstance().getZooKeepers(), "-u", "root", "-p", - ROOT_PASSWORD, "-t", tablename, "--column", input_cfcq); + Process hash = cluster.exec(RowHash.class, Collections.singletonList(hadoopTmpDirArg), "-i", c.getInstance().getInstanceName(), "-z", c.getInstance() + .getZooKeepers(), "-u", "root", "-p", ROOT_PASSWORD, "-t", tablename, "--column", input_cfcq); assertEquals(0, hash.waitFor()); Scanner s = c.createScanner(tablename, Authorizations.EMPTY); @@ -81,5 +83,4 @@ public class MapReduceIT extends ConfigurableMacIT { } } - } http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/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 10db515..8293fe8 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 @@ -22,6 +22,7 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.minicluster.MiniAccumuloCluster; import org.apache.accumulo.minicluster.MiniAccumuloConfig; import org.apache.accumulo.minicluster.MiniAccumuloInstance; @@ -41,6 +42,8 @@ public class SimpleMacIT extends AbstractMacIT { if (getInstanceOneConnector() == null && cluster == null) { folder = createSharedTestDir(SimpleMacIT.class.getName()); MiniAccumuloConfig cfg = new MiniAccumuloConfig(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")); cluster = new MiniAccumuloCluster(cfg); cluster.start(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/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 ba5f44b..9b089a1 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 @@ -18,17 +18,27 @@ package org.apache.accumulo.test.functional; import static org.junit.Assert.assertEquals; +import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import org.junit.BeforeClass; import org.junit.Test; public class ZooCacheIT extends ConfigurableMacIT { + private static String pathName = "/zcTest-42"; + private static File testDir; + + @BeforeClass + public static void createTestDirectory() { + testDir = createSharedTestDir(ZooCacheIT.class.getName() + pathName); + } + @Test(timeout = 2 * 60 * 1000) public void test() throws Exception { - assertEquals(0, exec(CacheTestClean.class, "/zcTest-42", "/tmp/zcTest-42").waitFor()); + assertEquals(0, exec(CacheTestClean.class, pathName, testDir.getAbsolutePath()).waitFor()); final AtomicReference<Exception> ref = new AtomicReference<Exception>(); List<Thread> threads = new ArrayList<Thread>(); for (int i = 0; i < 3; i++) { @@ -36,7 +46,7 @@ public class ZooCacheIT extends ConfigurableMacIT { @Override public void run() { try { - CacheTestReader.main(new String[] {"/zcTest-42", "/tmp/zcTest-42", getConnector().getInstance().getZooKeepers()}); + CacheTestReader.main(new String[] {pathName, testDir.getAbsolutePath(), getConnector().getInstance().getZooKeepers()}); } catch (Exception ex) { ref.set(ex); } @@ -45,7 +55,7 @@ public class ZooCacheIT extends ConfigurableMacIT { reader.start(); threads.add(reader); } - assertEquals(0, exec(CacheTestWriter.class, "/zcTest-42", "/tmp/zcTest-42", "3", "50").waitFor()); + assertEquals(0, exec(CacheTestWriter.class, pathName, testDir.getAbsolutePath(), "3", "50").waitFor()); for (Thread t : threads) { t.join(); if (ref.get() != null) http://git-wip-us.apache.org/repos/asf/accumulo/blob/c1fbeac5/test/src/test/java/org/apache/accumulo/test/util/CertUtilsTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/util/CertUtilsTest.java b/test/src/test/java/org/apache/accumulo/test/util/CertUtilsTest.java index bb2a933..eea9ac2 100644 --- a/test/src/test/java/org/apache/accumulo/test/util/CertUtilsTest.java +++ b/test/src/test/java/org/apache/accumulo/test/util/CertUtilsTest.java @@ -37,7 +37,7 @@ public class CertUtilsTest { private static final String RDN_STRING = "o=Apache Accumulo,cn=CertUtilsTest"; @Rule - public TemporaryFolder folder = new TemporaryFolder(); + public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target")); private CertUtils getUtils() { return new CertUtils(KEYSTORE_TYPE, RDN_STRING, "RSA", 2048, "sha1WithRSAEncryption");