accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [2/6] accumulo git commit: ACCUMULO-4121 Fix plugin IT due to rat changes
Date Wed, 03 Feb 2016 21:56:33 GMT
ACCUMULO-4121 Fix plugin IT due to rat changes

* Update and fix the accumulo-maven-plugin and corresponding tests


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/95f5affb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/95f5affb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/95f5affb

Branch: refs/heads/1.7
Commit: 95f5affb8abe64ceeb320fdb53469eeae564955e
Parents: fbd2faf
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Wed Feb 3 16:46:24 2016 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Feb 3 16:46:24 2016 -0500

----------------------------------------------------------------------
 maven-plugin/.gitignore                         |  2 --
 maven-plugin/pom.xml                            |  3 ++-
 maven-plugin/src/it/plugin-test/pom.xml         |  7 +++++++
 .../maven/plugin/AbstractAccumuloMojo.java      | 14 ++++++++++++--
 .../apache/accumulo/maven/plugin/StartMojo.java | 20 +++++++++++++++-----
 .../apache/accumulo/maven/plugin/StopMojo.java  |  6 +++++-
 pom.xml                                         |  2 +-
 7 files changed, 42 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/maven-plugin/.gitignore
----------------------------------------------------------------------
diff --git a/maven-plugin/.gitignore b/maven-plugin/.gitignore
index 0a396d4..e77a822 100644
--- a/maven-plugin/.gitignore
+++ b/maven-plugin/.gitignore
@@ -23,8 +23,6 @@
 /.pydevproject
 /.idea
 /*.iml
-/target/
 /nbproject/
 /nbactions.xml
 /nb-configuration.xml
-

http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml
index 1b9827a..34a55a7 100644
--- a/maven-plugin/pom.xml
+++ b/maven-plugin/pom.xml
@@ -87,8 +87,9 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-invoker-plugin</artifactId>
         <configuration>
-          <noLog>true</noLog>
+          <cloneClean>true</cloneClean>
           <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <debug>true</debug>
           <pomIncludes>
             <pomInclude>*/pom.xml</pomInclude>
           </pomIncludes>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/maven-plugin/src/it/plugin-test/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugin/src/it/plugin-test/pom.xml b/maven-plugin/src/it/plugin-test/pom.xml
index 7654c96..2eb8626 100644
--- a/maven-plugin/src/it/plugin-test/pom.xml
+++ b/maven-plugin/src/it/plugin-test/pom.xml
@@ -113,6 +113,13 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 </project>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
index 5e6a905..2028a2e 100644
--- a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
+++ b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/AbstractAccumuloMojo.java
@@ -24,14 +24,24 @@ import java.util.Arrays;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 
 public abstract class AbstractAccumuloMojo extends AbstractMojo {
 
-  @Component
+  @Parameter(defaultValue = "${project}", readonly = true)
   private MavenProject project;
 
+  @Parameter(defaultValue = "false", alias = "skip", property = "accumulo.skip", required
= true)
+  private boolean skip;
+
+  protected boolean shouldSkip() {
+    if (skip) {
+      getLog().info("Skipping execution of accumulo-maven-plugin");
+    }
+    return skip;
+  }
+
   void configureMiniClasspath(MiniAccumuloConfigImpl macConfig, String miniClasspath) throws
MalformedURLException {
     ArrayList<String> classpathItems = new ArrayList<String>();
     if (miniClasspath == null && project != null) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StartMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StartMojo.java b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StartMojo.java
index 42d4145..16b9dae 100644
--- a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StartMojo.java
+++ b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StartMojo.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.maven.plugin;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -39,33 +40,42 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
 @Mojo(name = "start", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST, requiresDependencyResolution
= ResolutionScope.TEST)
 public class StartMojo extends AbstractAccumuloMojo {
 
-  @Parameter(defaultValue = "${project.build.directory}", property = "outputDir", required
= true)
+  @Parameter(defaultValue = "${project.build.directory}", alias = "outputDirectory", property
= "accumulo.outputDirectory", required = true)
   private File outputDirectory;
 
-  @Parameter(defaultValue = "testInstance", property = "instanceName", required = true)
+  @Parameter(defaultValue = "testInstance", alias = "instanceName", property = "accumulo.instanceName",
required = true)
   private String instanceName;
 
-  @Parameter(defaultValue = "secret", property = "rootPassword", required = true)
+  @Parameter(defaultValue = "secret", alias = "rootPassword", property = "accumulo.rootPassword",
required = true)
   private String rootPassword;
 
+  @Parameter(defaultValue = "0", alias = "zooKeeperPort", property = "accumulo.zooKeeperPort",
required = true)
+  private int zooKeeperPort;
+
   private String miniClasspath;
 
   static Set<MiniAccumuloClusterImpl> runningClusters = Collections.synchronizedSet(new
HashSet<MiniAccumuloClusterImpl>());
 
   @Override
   public void execute() throws MojoExecutionException {
+    if (shouldSkip()) {
+      return;
+    }
+
     File subdir = new File(new File(outputDirectory, "accumulo-maven-plugin"), instanceName);
 
     try {
       subdir = subdir.getCanonicalFile();
       if (subdir.exists())
         FileUtils.forceDelete(subdir);
-      subdir.mkdirs();
+      if (!subdir.mkdirs() && !subdir.isDirectory())
+        throw new IOException(subdir + " cannot be created as a directory");
       MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(subdir, rootPassword);
       cfg.setInstanceName(instanceName);
+      cfg.setZooKeeperPort(zooKeeperPort);
       configureMiniClasspath(cfg, miniClasspath);
       MiniAccumuloClusterImpl mac = new MiniAccumuloClusterImpl(cfg);
-      System.out.println("Starting MiniAccumuloCluster: " + mac.getInstanceName() + " in
" + mac.getConfig().getDir());
+      getLog().info("Starting MiniAccumuloCluster: " + mac.getInstanceName() + " in " + mac.getConfig().getDir());
       mac.start();
       runningClusters.add(mac);
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StopMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StopMojo.java b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StopMojo.java
index 5d51ed6..b03d168 100644
--- a/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StopMojo.java
+++ b/maven-plugin/src/main/java/org/apache/accumulo/maven/plugin/StopMojo.java
@@ -34,8 +34,12 @@ public class StopMojo extends AbstractAccumuloMojo {
 
   @Override
   public void execute() throws MojoExecutionException {
+    if (shouldSkip()) {
+      return;
+    }
+
     for (MiniAccumuloClusterImpl mac : StartMojo.runningClusters) {
-      System.out.println("Stopping MiniAccumuloCluster: " + mac.getInstanceName());
+      getLog().info("Stopping MiniAccumuloCluster: " + mac.getInstanceName());
       try {
         mac.stop();
         for (LogWriter log : mac.getLogWriters())

http://git-wip-us.apache.org/repos/asf/accumulo/blob/95f5affb/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8712b78..663a79d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -749,7 +749,7 @@
         <plugin>
           <groupId>org.apache.rat</groupId>
           <artifactId>apache-rat-plugin</artifactId>
-          <version>0.10</version>
+          <version>0.11</version>
           <configuration>
             <excludes>
               <exclude>nbproject/**</exclude>


Mime
View raw message