accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject accumulo git commit: ACCUMULO-2828 accumulo-maven-plugin improvements
Date Mon, 06 Apr 2015 20:02:50 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master b132e03fe -> 670b721b9


ACCUMULO-2828 accumulo-maven-plugin improvements

* Add zooKeeperPort configuration option
* Add skip configuration option
* Fix incorrect use of property option on @Parameter
* Explicitly name properties with alias option on @Parameter
* Use maven log instead of System.out


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

Branch: refs/heads/master
Commit: 670b721b9103e5be4a3017631e4a2e5983aee63f
Parents: b132e03
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Mon Apr 6 15:58:06 2015 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Mon Apr 6 15:58:06 2015 -0400

----------------------------------------------------------------------
 .../accumulo/maven/plugin/AbstractAccumuloMojo.java | 10 ++++++++++
 .../org/apache/accumulo/maven/plugin/StartMojo.java | 16 ++++++++++++----
 .../org/apache/accumulo/maven/plugin/StopMojo.java  |  6 +++++-
 3 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/670b721b/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 46fdfbc..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
@@ -32,6 +32,16 @@ public abstract class AbstractAccumuloMojo extends AbstractMojo {
   @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/670b721b/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 2eb41e0..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
@@ -40,21 +40,28 @@ 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 {
@@ -65,9 +72,10 @@ public class StartMojo extends AbstractAccumuloMojo {
         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/670b721b/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())


Mime
View raw message