Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 899A4200B72 for ; Fri, 26 Aug 2016 20:24:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 883D7160AB6; Fri, 26 Aug 2016 18:24:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 88E9B160A94 for ; Fri, 26 Aug 2016 20:24:19 +0200 (CEST) Received: (qmail 94143 invoked by uid 500); 26 Aug 2016 18:24:18 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 94126 invoked by uid 99); 26 Aug 2016 18:24:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2016 18:24:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9EE7EDFD7B; Fri, 26 Aug 2016 18:24:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Fri, 26 Aug 2016 18:24:18 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/3] accumulo git commit: ACCUMULO-3948 Prevent test jar from being deployed archived-at: Fri, 26 Aug 2016 18:24:20 -0000 Repository: accumulo Updated Branches: refs/heads/1.8 d7c50d1fd -> b08c4b911 refs/heads/master fd46656d9 -> ee1062f2b ACCUMULO-3948 Prevent test jar from being deployed Use maven-assembly-plugin to create test jar instead of maven-jar-plugin, which attaches the jar for deployment. Moves creation of the plugin to earlier phase of the build (ACCUMULO-4058). Prefer the use of the maven build directory over the system temp directory for temporary files. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b08c4b91 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b08c4b91 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b08c4b91 Branch: refs/heads/1.8 Commit: b08c4b9116f201148af22f69e7c3022c0c597e4b Parents: d7c50d1 Author: Christopher Tubbs Authored: Fri Aug 26 14:20:45 2016 -0400 Committer: Christopher Tubbs Committed: Fri Aug 26 14:20:45 2016 -0400 ---------------------------------------------------------------------- test/pom.xml | 40 ++++++------- .../org/apache/accumulo/test/ShellServerIT.java | 14 +++-- .../test/functional/ScannerContextIT.java | 59 +++++++------------- test/src/main/test-jars/Iterators.xml | 36 ++++++++++++ 4 files changed, 84 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b08c4b91/test/pom.xml ---------------------------------------------------------------------- diff --git a/test/pom.xml b/test/pom.xml index 92aeeaf..422543a 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -239,26 +239,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - create-iterator-test-jar - - test-jar - - pre-integration-test - - TestIterators - - - org/apache/accumulo/test/functional/ValueReversingIterator.class - - - - - @@ -282,6 +262,26 @@ + + org.apache.maven.plugins + maven-assembly-plugin + + + create-iterator-test-jar + + single + + package + + false + TestJar + + src/main/test-jars/Iterators.xml + + + + + http://git-wip-us.apache.org/repos/asf/accumulo/blob/b08c4b91/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java index 8db0185..6746198 100644 --- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java @@ -64,8 +64,8 @@ import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.format.Formatter; import org.apache.accumulo.core.util.format.FormatterConfig; -import org.apache.accumulo.harness.SharedMiniClusterBase; import org.apache.accumulo.harness.MiniClusterConfigurationCallback; +import org.apache.accumulo.harness.SharedMiniClusterBase; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.accumulo.shell.Shell; import org.apache.accumulo.test.functional.SlowIterator; @@ -1790,22 +1790,24 @@ public class ShellServerIT extends SharedMiniClusterBase { } private static final String FAKE_CONTEXT = "FAKE"; - private static final String FAKE_CONTEXT_CLASSPATH = "file:///tmp/ShellServerIT-iterators.jar"; + private static final String FAKE_CONTEXT_CLASSPATH = "file://" + System.getProperty("user.dir") + "/target/" + ShellServerIT.class.getSimpleName() + + "-fake-iterators.jar"; private static final String REAL_CONTEXT = "REAL"; - private static final String REAL_CONTEXT_CLASSPATH = "file:///tmp/TestIterators-tests.jar"; + private static final String REAL_CONTEXT_CLASSPATH = "file://" + System.getProperty("user.dir") + "/target/" + ShellServerIT.class.getSimpleName() + + "-real-iterators.jar"; private void setupRealContextPath() throws Exception { - // Copy the TestIterators jar to tmp + // Copy the test iterators jar to tmp Path baseDir = new Path(System.getProperty("user.dir")); Path targetDir = new Path(baseDir, "target"); - Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); + Path jarPath = new Path(targetDir, "TestJar-Iterators.jar"); Path dstPath = new Path(REAL_CONTEXT_CLASSPATH); FileSystem fs = SharedMiniClusterBase.getCluster().getFileSystem(); fs.copyFromLocalFile(jarPath, dstPath); } private void setupFakeContextPath() throws Exception { - // Copy the TestIterators jar to tmp + // Copy the test iterators jar to tmp Path baseDir = new Path(System.getProperty("user.dir")); Path targetDir = new Path(baseDir, "target"); Path classesDir = new Path(targetDir, "classes"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/b08c4b91/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java index 91c066f..579881e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.IOException; import java.util.Collections; import java.util.Iterator; import java.util.Map.Entry; @@ -52,7 +53,7 @@ public class ScannerContextIT extends AccumuloClusterHarness { private static final String CONTEXT = ScannerContextIT.class.getSimpleName(); private static final String CONTEXT_PROPERTY = Property.VFS_CONTEXT_CLASSPATH_PROPERTY + CONTEXT; - private static final String CONTEXT_DIR = "file:///tmp"; + private static final String CONTEXT_DIR = "file://" + System.getProperty("user.dir") + "/target"; private static final String CONTEXT_CLASSPATH = CONTEXT_DIR + "/Test.jar"; private static int ITERATIONS = 10; private static final long WAIT = 7000; @@ -71,20 +72,24 @@ public class ScannerContextIT extends AccumuloClusterHarness { fs = FileSystem.get(CachedConfiguration.getInstance()); } - @Test - public void test() throws Exception { - // Copy the TestIterators jar to tmp + private Path copyTestIteratorsJarToTmp() throws IOException { + // Copy the test iterators jar to tmp Path baseDir = new Path(System.getProperty("user.dir")); Path targetDir = new Path(baseDir, "target"); - Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); + Path jarPath = new Path(targetDir, "TestJar-Iterators.jar"); Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); fs.copyFromLocalFile(jarPath, dstPath); // Sleep to ensure jar change gets picked up UtilWaitThread.sleep(WAIT); + return dstPath; + } + @Test + public void test() throws Exception { + Path dstPath = copyTestIteratorsJarToTmp(); try { Connector c = getConnector(); - // Set the classloader context property on the table to point to the TestIterators jar file. + // Set the classloader context property on the table to point to the test iterators jar file. c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); // Insert rows with the word "Test" in the value. @@ -101,7 +106,7 @@ public class ScannerContextIT extends AccumuloClusterHarness { scanCheck(c, tableName, null, null, "Test"); batchCheck(c, tableName, null, null, "Test"); - // This iterator is in the TestIterators jar file + // This iterator is in the test iterators jar file IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator"); // Check that ValueReversingIterator is not already on the classpath by not setting the context. This should fail. @@ -129,22 +134,14 @@ public class ScannerContextIT extends AccumuloClusterHarness { @Test public void testScanContextOverridesTableContext() throws Exception { - // Copy the TestIterators jar to tmp - Path baseDir = new Path(System.getProperty("user.dir")); - Path targetDir = new Path(baseDir, "target"); - Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); - Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); - fs.copyFromLocalFile(jarPath, dstPath); - // Sleep to ensure jar change gets picked up - UtilWaitThread.sleep(WAIT); - + Path dstPath = copyTestIteratorsJarToTmp(); try { Connector c = getConnector(); // Create two contexts FOO and ScanContextIT. The FOO context will point to a classpath - // that contains nothing. The ScanContextIT context will point to the TestIterators.jar + // that contains nothing. The ScanContextIT context will point to the test iterators jar String tableContext = "FOO"; String tableContextProperty = Property.VFS_CONTEXT_CLASSPATH_PROPERTY + tableContext; - String tableContextDir = "file:///tmp"; + String tableContextDir = "file://" + System.getProperty("user.dir") + "/target"; String tableContextClasspath = tableContextDir + "/TestFoo.jar"; // Define both contexts c.instanceOperations().setProperty(tableContextProperty, tableContextClasspath); @@ -163,7 +160,7 @@ public class ScannerContextIT extends AccumuloClusterHarness { bw.close(); scanCheck(c, tableName, null, null, "Test"); batchCheck(c, tableName, null, null, "Test"); - // This iterator is in the TestIterators jar file + // This iterator is in the test iterators jar file IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator"); // Check that ValueReversingIterator is not already on the classpath by not setting the context. This should fail. @@ -192,18 +189,10 @@ public class ScannerContextIT extends AccumuloClusterHarness { @Test public void testOneScannerDoesntInterfereWithAnother() throws Exception { - // Copy the TestIterators jar to tmp - Path baseDir = new Path(System.getProperty("user.dir")); - Path targetDir = new Path(baseDir, "target"); - Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); - Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); - fs.copyFromLocalFile(jarPath, dstPath); - // Sleep to ensure jar change gets picked up - UtilWaitThread.sleep(WAIT); - + Path dstPath = copyTestIteratorsJarToTmp(); try { Connector c = getConnector(); - // Set the classloader context property on the table to point to the TestIterators jar file. + // Set the classloader context property on the table to point to the test iterators jar file. c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); // Insert rows with the word "Test" in the value. @@ -247,18 +236,10 @@ public class ScannerContextIT extends AccumuloClusterHarness { @Test public void testClearContext() throws Exception { - // Copy the TestIterators jar to tmp - Path baseDir = new Path(System.getProperty("user.dir")); - Path targetDir = new Path(baseDir, "target"); - Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); - Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); - fs.copyFromLocalFile(jarPath, dstPath); - // Sleep to ensure jar change gets picked up - UtilWaitThread.sleep(WAIT); - + Path dstPath = copyTestIteratorsJarToTmp(); try { Connector c = getConnector(); - // Set the classloader context property on the table to point to the TestIterators jar file. + // Set the classloader context property on the table to point to the test iterators jar file. c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); // Insert rows with the word "Test" in the value. http://git-wip-us.apache.org/repos/asf/accumulo/blob/b08c4b91/test/src/main/test-jars/Iterators.xml ---------------------------------------------------------------------- diff --git a/test/src/main/test-jars/Iterators.xml b/test/src/main/test-jars/Iterators.xml new file mode 100644 index 0000000..f074720 --- /dev/null +++ b/test/src/main/test-jars/Iterators.xml @@ -0,0 +1,36 @@ + + + + Iterators + + jar + + false + + + ${project.build.directory}/test-classes + ./ + 0755 + 0644 + + **/ValueReversingIterator.class + + + +