You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2015/01/27 14:44:40 UTC

knox git commit: KNOX-485 - make the data/deployments directory configurable (Andreina J via lmccay)

Repository: knox
Updated Branches:
  refs/heads/v0.5.1 8cb0f5c01 -> 0b45978ef


KNOX-485 - make the data/deployments directory configurable (Andreina J via lmccay)

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/0b45978e
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/0b45978e
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/0b45978e

Branch: refs/heads/v0.5.1
Commit: 0b45978ef5e5c1318e4de9e1308cecc894e3f97d
Parents: 8cb0f5c
Author: Larry McCay <lm...@hortonworks.com>
Authored: Tue Jan 27 08:44:23 2015 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Tue Jan 27 08:44:23 2015 -0500

----------------------------------------------------------------------
 .../gateway/config/impl/GatewayConfigImpl.java    |  2 +-
 .../hadoop/gateway/GatewayGlobalConfigTest.java   | 18 ++++++++++++++++++
 .../resources/conf-demo/conf/gateway-default.xml  |  5 +++++
 .../resources/conf-demo/conf/gateway-site.xml     |  5 +++++
 4 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/0b45978e/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
index 35739b1..bd4284e 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
@@ -274,7 +274,7 @@ public class GatewayConfigImpl extends Configuration implements GatewayConfig {
 
   @Override
   public String getGatewayDeploymentDir() {
-    return getGatewayDataDir() + File.separator + "deployments";
+    return get(DEPLOYMENT_DIR, getGatewayDataDir() + File.separator + DEFAULT_DEPLOYMENT_DIR);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/knox/blob/0b45978e/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayGlobalConfigTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayGlobalConfigTest.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayGlobalConfigTest.java
index 279198c..4534165 100644
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayGlobalConfigTest.java
+++ b/gateway-server/src/test/java/org/apache/hadoop/gateway/GatewayGlobalConfigTest.java
@@ -84,4 +84,22 @@ public class GatewayGlobalConfigTest {
     GatewayConfig config = new GatewayConfigImpl();
     assertThat( config.getDefaultAppRedirectPath(), is( "/gateway/sandbox" ) );
   }
+
+  @Test
+  public void testForUpdatedDeploymentDir() {
+    String homeDirName = getHomeDirName("conf-demo/conf/gateway-site.xml");
+    System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
+    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
+    GatewayConfig config = new GatewayConfigImpl();
+    assertTrue(("/test").equalsIgnoreCase(config.getGatewayDeploymentDir()));
+  }
+
+  @Test
+  public void testDefaultDeploymentDir() {
+    String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
+    System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
+    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
+    GatewayConfig config = new GatewayConfigImpl();
+    assertThat(config.getGatewayDeploymentDir(), is(homeDirName + File.separator + "deployments"));
+  }
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/0b45978e/gateway-server/src/test/resources/conf-demo/conf/gateway-default.xml
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/resources/conf-demo/conf/gateway-default.xml b/gateway-server/src/test/resources/conf-demo/conf/gateway-default.xml
index 80a4c96..0adf47f 100644
--- a/gateway-server/src/test/resources/conf-demo/conf/gateway-default.xml
+++ b/gateway-server/src/test/resources/conf-demo/conf/gateway-default.xml
@@ -48,4 +48,9 @@ limitations under the License.
         <value>SSLv3</value>
         <description>Excluded SSL protocols.</description>
     </property>
+    <property>
+        <name>gateway.deployment.dir</name>
+        <value>/test</value>
+        <description>The path that contains deployments.</description>
+    </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/knox/blob/0b45978e/gateway-server/src/test/resources/conf-demo/conf/gateway-site.xml
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/resources/conf-demo/conf/gateway-site.xml b/gateway-server/src/test/resources/conf-demo/conf/gateway-site.xml
index 518e737..0635bde 100644
--- a/gateway-server/src/test/resources/conf-demo/conf/gateway-site.xml
+++ b/gateway-server/src/test/resources/conf-demo/conf/gateway-site.xml
@@ -54,5 +54,10 @@ limitations under the License.
         <value>shiro.ini</value>
         <description>The location of the Shiro configuration file.</description>
     </property>
+    <property>
+        <name>gateway.deployment.dir</name>
+        <value>/test</value>
+        <description>The path that contains deployments.</description>
+    </property>
 
 </configuration>