You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/02/14 17:20:43 UTC

[4/6] git commit: Extending TomcatResource

Extending TomcatResource


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

Branch: refs/pull/53/merge
Commit: 9b4517161f7217bd4702a7d3d497b56163b9d72d
Parents: 524defb
Author: Sungju Jin <su...@softwaregeeks.org>
Authored: Thu Jan 16 22:52:54 2014 +0900
Committer: Sungju Jin <su...@softwaregeeks.org>
Committed: Fri Feb 14 23:46:52 2014 +0900

----------------------------------------------------------------------
 .../java/org/apache/usergrid/rest/ITSetup.java  |  8 +++++--
 .../apache/usergrid/rest/TomcatResource.java    | 25 ++++++++------------
 2 files changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b451716/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
index 626c175..6356225 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
@@ -53,10 +53,14 @@ public class ITSetup extends ExternalResource {
     public ITSetup( CassandraResource cassandraResource ) {
         this.cassandraResource = cassandraResource;
         tomcatResource = TomcatResource.instance;
-
-
+        tomcatResource.setWebAppsPath("src/main/webapp");
     }
 
+    public ITSetup( CassandraResource cassandraResource, String webAppsPath ) {
+        this.cassandraResource = cassandraResource;
+        tomcatResource = TomcatResource.instance;
+        tomcatResource.setWebAppsPath(webAppsPath);
+    }
 
     private boolean setupCalled = false;
     private boolean ready = false;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b451716/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
index 677b384..b5436c7 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
@@ -15,20 +15,14 @@ import com.google.common.io.Files;
 /** @author tnine */
 public class TomcatResource extends ExternalResource {
 
+    public static final TomcatResource instance = new TomcatResource();
     private static Object mutex = new Object();
-
     private static final String CONTEXT = "/";
-
+    private String webAppsPath;
     private int port;
-
-
-
-
     private Tomcat tomcat;
 
     protected TomcatResource(){
-
-
     }
 
     @Override
@@ -51,9 +45,7 @@ public class TomcatResource extends ExternalResource {
             tomcat = new Tomcat();
             tomcat.setBaseDir( dataDir.getAbsolutePath() );
             tomcat.setPort( port );
-            tomcat.addWebapp( CONTEXT, new File( "src/main/webapp" ).getAbsolutePath() );
-
-
+            tomcat.addWebapp( CONTEXT, new File( getWebAppsPath() ).getAbsolutePath() );
             tomcat.start();
         }
     }
@@ -67,8 +59,11 @@ public class TomcatResource extends ExternalResource {
         return port;
     }
 
+    public String getWebAppsPath() {
+        return webAppsPath;
+    }
 
-    public static final TomcatResource instance = new TomcatResource();
-
-
-}
+    public void setWebAppsPath(String webAppsPath) {
+        this.webAppsPath = webAppsPath;
+    }
+}
\ No newline at end of file