Allow tools to always be built, but skip its tests for now.  Also fix issue 
with tools ability to have custom properties set in ToolBase or command line 
execution.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/1997b579
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/1997b579
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/1997b579

Branch: refs/heads/usergrid-1268-akka-211
Commit: 1997b579cc780ef169c34d296dec953c91d2c4c5
Parents: 06f77d7
Author: Michael Russo <[email protected]>
Authored: Fri Jun 3 13:29:34 2016 -0700
Committer: Michael Russo <[email protected]>
Committed: Tue Jun 21 14:30:00 2016 -0700

----------------------------------------------------------------------
 stack/pom.xml                                   |  2 --
 stack/tools/pom.xml                             |  1 +
 .../org/apache/usergrid/tools/ToolBase.java     | 28 ++++++++++++++++++--
 .../main/resources/toolsApplicationContext.xml  |  7 +++++
 4 files changed, 34 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/1997b579/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index a94233e..dd35891 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -195,9 +195,7 @@
         <module>core</module>
         <module>services</module>
         <module>rest</module>
-        <!-- Tools should be built separately
         <module>tools</module>
-        -->
         <!--
         <module>websocket</module>
         -->

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1997b579/stack/tools/pom.xml
----------------------------------------------------------------------
diff --git a/stack/tools/pom.xml b/stack/tools/pom.xml
index 2d6e7a2..06691de 100644
--- a/stack/tools/pom.xml
+++ b/stack/tools/pom.xml
@@ -65,6 +65,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+            <skipTests>true</skipTests>
           <systemPropertyVariables>
             <storage-config>${basedir}/src/test/conf</storage-config>
           </systemPropertyVariables>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1997b579/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java 
b/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java
index bd8686e..e82e5f8 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ToolBase.java
@@ -17,6 +17,7 @@
 package org.apache.usergrid.tools;
 
 
+import com.google.inject.Injector;
 import me.prettyprint.hector.testutils.EmbeddedServerHelper;
 import org.apache.commons.cli.*;
 import org.apache.commons.lang.ClassUtils;
@@ -69,6 +70,10 @@ public abstract class ToolBase {
 
     protected CassandraService cass;
 
+    protected Injector injector;
+
+
+
 
     public void startTool( String[] args ) {
         startTool( args, true );
@@ -88,6 +93,15 @@ public abstract class ToolBase {
             return;
         }
 
+        // notification queue listener not needed for tools
+        System.setProperty("usergrid.notifications.listener.run", "false");
+        System.setProperty("usergrid.push.worker_count", "0");
+
+        //job scheduler also not needed for tools
+        System.setProperty("usergrid.scheduler.enabled", "false");
+
+
+
         if ( line.hasOption( "host" ) ) {
             System.setProperty( "cassandra.url", line.getOptionValue( "host" ) 
);
             System.setProperty( "elasticsearch.hosts", line.getOptionValue( 
"eshost" ) );
@@ -178,6 +192,10 @@ public abstract class ToolBase {
         assertNotNull( emf );
         assertTrue( "EntityManagerFactory is instance of EntityManagerFactory",
                 emf instanceof EntityManagerFactory );
+
+        injector = ac.getBean( Injector.class );
+
+
     }
 
 
@@ -256,7 +274,10 @@ public abstract class ToolBase {
             "   cassandra.keyspace.application: {}\n" +
             "   cassandra.lock.keyspace: {}\n" +
             "   cassandra.keyspace.replication: {}\n" +
-            "   cassandra.connections: {}\n",
+            "   cassandra.connections: {}\n" +
+            "   usergrid.notifications.listener.run: {}\n" +
+            "   usergrid.push.worker_count: {}\n" +
+            "   usergrid.scheduler.enabled: {}\n",
             properties.get("cassandra.url"),
             properties.get("cassandra.datacenter.local"),
             properties.get("cassandra.username"),
@@ -265,7 +286,10 @@ public abstract class ToolBase {
             properties.get("cassandra.keyspace.application"),
             properties.get("cassandra.lock.keyspace"),
             properties.get("cassandra.keyspace.replication"),
-            properties.get("cassandra.connections")
+            properties.get("cassandra.connections"),
+            properties.get("usergrid.notifications.listener.run"),
+            properties.get("usergrid.push.worker_count"),
+            properties.get("usergrid.scheduler.enabled")
         );
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1997b579/stack/tools/src/main/resources/toolsApplicationContext.xml
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/resources/toolsApplicationContext.xml 
b/stack/tools/src/main/resources/toolsApplicationContext.xml
index 7e55893..f84501d 100644
--- a/stack/tools/src/main/resources/toolsApplicationContext.xml
+++ b/stack/tools/src/main/resources/toolsApplicationContext.xml
@@ -39,6 +39,8 @@
 
        <bean id="properties"
                
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+        <property name="properties" ref="sysProps"/>
+        <property name="localOverride" value="true"/>
                <property name="singleton" value="true" />
                <property name="ignoreResourceNotFound" value="true" />
                <property name="locations">
@@ -50,6 +52,11 @@
                </property>
        </bean>
 
+    <bean id="sysProps" 
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+        <property name="targetClass"><value>java.lang.System</value></property>
+        <property name="targetMethod"><value>getProperties</value></property>
+    </bean>
+
        <bean id="propertyPlaceholderConfigurer"
                
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                <property name="properties" ref="properties" />

Reply via email to