knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From su...@apache.org
Subject knox git commit: KNOX-600 setting all service params as filter params for dispatch
Date Fri, 25 Sep 2015 18:03:40 GMT
Repository: knox
Updated Branches:
  refs/heads/master 470400f12 -> 26361b6e7


KNOX-600 setting all service params as filter params for dispatch


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

Branch: refs/heads/master
Commit: 26361b6e7ad5021746b4f6cfda081ca69b274f4d
Parents: 470400f
Author: Sumit Gupta <sumit@apache.org>
Authored: Fri Sep 25 14:02:44 2015 -0400
Committer: Sumit Gupta <sumit@apache.org>
Committed: Fri Sep 25 14:02:44 2015 -0400

----------------------------------------------------------------------
 .../deploy/impl/DispatchDeploymentContributor.java | 17 +----------------
 .../ServiceDefinitionDeploymentContributor.java    | 10 +++-------
 .../gateway/deploy/DeploymentFactoryFuncTest.java  | 16 ++++++++--------
 3 files changed, 12 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/26361b6e/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java
index 3e1c336..f3070eb 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/DispatchDeploymentContributor.java
@@ -32,13 +32,8 @@ import java.util.Map;
 
 public class DispatchDeploymentContributor extends ProviderDeploymentContributorBase {
   
-  private static final String REPLAY_BUFFER_SIZE_PARAM = "replayBufferSize";
-
   private static final String DISPATCH_IMPL_PARAM = "dispatch-impl";
 
-  // Default global replay buffer size in KB
-  public static final String DEFAULT_REPLAY_BUFFER_SIZE = "8";
-
   @Override
   public String getRole() {
     return "dispatch";
@@ -53,18 +48,8 @@ public class DispatchDeploymentContributor extends ProviderDeploymentContributor
   public void contributeFilter( DeploymentContext context, Provider provider, Service service,
ResourceDescriptor resource, List<FilterParamDescriptor> params ) {
     FilterDescriptor filter = resource.addFilter().name( getName() ).role( getRole() ).impl(
GatewayDispatchFilter.class );
     filter.param().name(DISPATCH_IMPL_PARAM).value(DefaultDispatch.class.getName());
-    FilterParamDescriptor filterParam = filter.param().name( REPLAY_BUFFER_SIZE_PARAM ).value(
DEFAULT_REPLAY_BUFFER_SIZE );
     for ( Map.Entry<String,String> serviceParam : service.getParams().entrySet() )
{
-      if ( REPLAY_BUFFER_SIZE_PARAM.equals( serviceParam.getKey() ) ) {
-        filterParam.value( serviceParam.getValue() );
-      }
-    }
-    if ( params != null ) {
-      for ( FilterParamDescriptor customParam : params ) {
-        if ( REPLAY_BUFFER_SIZE_PARAM.equals( customParam.name() ) ) {
-          filterParam.value( customParam.value() );
-        }
-      }
+      filter.param().name( serviceParam.getKey() ).value( serviceParam.getValue() );
     }
     if( context.getGatewayConfig().isHadoopKerberosSecured() ) {
       filter.param().name("kerberos").value("true");

http://git-wip-us.apache.org/repos/asf/knox/blob/26361b6e/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
index f1b7517..a5585a9 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
@@ -217,13 +217,9 @@ public class ServiceDefinitionDeploymentContributor extends ServiceDeploymentCon
     if (httpClientFactory != null) {
       filter.param().name(HTTP_CLIENT_FACTORY_PARAM).value(httpClientFactory);
     }
-    //TODO: [sumit] make sure we pass all service params to the filter
-//    FilterParamDescriptor filterParam = filter.param().name(REPLAY_BUFFER_SIZE_PARAM).value(DEFAULT_REPLAY_BUFFER_SIZE);
-//    for ( Map.Entry<String, String> serviceParam : service.getParams().entrySet()
) {
-//      if ( REPLAY_BUFFER_SIZE_PARAM.equals(serviceParam.getKey()) ) {
-//        filterParam.value(serviceParam.getValue());
-//      }
-//    }
+    for ( Map.Entry<String, String> serviceParam : service.getParams().entrySet() )
{
+      filter.param().name(serviceParam.getKey()).value(serviceParam.getValue());
+    }
     if ( context.getGatewayConfig().isHadoopKerberosSecured() ) {
       filter.param().name("kerberos").value("true");
     } else {

http://git-wip-us.apache.org/repos/asf/knox/blob/26361b6e/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java
index 4fef2d9..2d60d03 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/deploy/DeploymentFactoryFuncTest.java
@@ -379,8 +379,8 @@ public class DeploymentFactoryFuncTest {
       assertThat(web, hasXPath("/web-app/listener[4]/listener-class", equalTo("org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteServletContextListener")));
    }
 
-  //disable test but keep around to re-purpose for a generic service level parameter test
-  public void testDeploymentWithReplayBufferSize() throws Exception {
+  @Test
+  public void testDeploymentWithServiceParams() throws Exception {
     GatewayConfig config = new GatewayTestConfig();
     File targetDir = new File(System.getProperty("user.dir"), "target");
     File gatewayDir = new File(targetDir, "gateway-home-" + UUID.randomUUID());
@@ -410,8 +410,8 @@ public class DeploymentFactoryFuncTest {
     service.setRole( "HIVE" );
     service.setUrls( Arrays.asList( new String[]{ "http://hive-host:50001/" } ) );
     param = new Param();
-    param.setName( "replayBufferSize" );
-    param.setValue( "17" );
+    param.setName( "someparam" );
+    param.setValue( "somevalue" );
     service.addParam( param );
     topology.addService( service );
 
@@ -428,7 +428,7 @@ public class DeploymentFactoryFuncTest {
     service.setRole( "OOZIE" );
     service.setUrls( Arrays.asList( new String[]{ "http://hbase-host:50003/" } ) );
     param = new Param();
-    param.setName( "replayBufferSize" );
+    param.setName( "otherparam" );
     param.setValue( "65" );
     service.addParam( param );
     topology.addService( service );
@@ -444,9 +444,9 @@ public class DeploymentFactoryFuncTest {
     assertThat( resourceNode, is(not(nullValue())));
     filterNode = node( resourceNode, "filter[role/text()='dispatch']" );
     assertThat( filterNode, is(not(nullValue())));
-    paramNode = node( filterNode, "param[name/text()='replayBufferSize']" );
+    paramNode = node( filterNode, "param[name/text()='someparam']" );
     value = value( paramNode, "value/text()" );
-    assertThat( value, is( "17" ) ) ;
+    assertThat( value, is( "somevalue" ) ) ;
 
     resourceNode = node( doc, "gateway/resource[role/text()='WEBHBASE']" );
     assertThat( resourceNode, is(not(nullValue())));
@@ -460,7 +460,7 @@ public class DeploymentFactoryFuncTest {
     assertThat( resourceNode, is(not(nullValue())));
     filterNode = node( resourceNode, "filter[role/text()='dispatch']" );
     assertThat( filterNode, is(not(nullValue())));
-    paramNode = node( filterNode, "param[name/text()='replayBufferSize']" );
+    paramNode = node( filterNode, "param[name/text()='otherparam']" );
     value = value( paramNode, "value/text()" );
     assertThat( value, is( "65" ) ) ;
 


Mime
View raw message