knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject git commit: KNOX-345: WebHDFS and Oozie not specifying dispatch provider and end up with HiveDispatchProvider
Date Fri, 04 Apr 2014 21:13:05 GMT
Repository: knox
Updated Branches:
  refs/heads/v0.4.0 cde0cc024 -> c6b15b51d


KNOX-345: WebHDFS and Oozie not specifying dispatch provider and end up with HiveDispatchProvider


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

Branch: refs/heads/v0.4.0
Commit: c6b15b51d125913c2d5ddfaa0560623a57d0da41
Parents: cde0cc0
Author: Kevin Minder <kevin.minder@hortonworks.com>
Authored: Fri Apr 4 17:12:57 2014 -0400
Committer: Kevin Minder <kevin.minder@hortonworks.com>
Committed: Fri Apr 4 17:12:57 2014 -0400

----------------------------------------------------------------------
 .../oozie/OozieDeploymentContributor.java       |  2 +-
 .../oozie/OozieDeploymentContributorTest.java   | 81 ++++++++++++--------
 .../hdfs/WebHdfsDeploymentContributor.java      | 10 +--
 3 files changed, 55 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/c6b15b51/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
b/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
index 1ad19cd..63f3c70 100644
--- a/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
+++ b/gateway-service-oozie/src/main/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributor.java
@@ -111,7 +111,7 @@ public class OozieDeploymentContributor extends ServiceDeploymentContributorBase
     filterParamDescriptor.name(REPLAY_BUFFER_SIZE_PARAM);
     filterParamDescriptor.value(OOZIW_REPLAY_BUFFER_SIZE);
     filterParams.add(filterParamDescriptor);
-    context.contributeFilter(service, resource, "dispatch", null, filterParams);
+    context.contributeFilter(service, resource, "dispatch", "http-client", filterParams);
   }
 
   UrlRewriteRulesDescriptor loadRulesFromTemplate() throws IOException {

http://git-wip-us.apache.org/repos/asf/knox/blob/c6b15b51/gateway-service-oozie/src/test/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributorTest.java
----------------------------------------------------------------------
diff --git a/gateway-service-oozie/src/test/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributorTest.java
b/gateway-service-oozie/src/test/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributorTest.java
index 8b64e9a..fad79f0 100644
--- a/gateway-service-oozie/src/test/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributorTest.java
+++ b/gateway-service-oozie/src/test/java/org/apache/hadoop/gateway/oozie/OozieDeploymentContributorTest.java
@@ -23,10 +23,8 @@ import org.apache.hadoop.gateway.filter.rewrite.api.UrlRewriteRulesDescriptor;
 import org.apache.hadoop.gateway.filter.rewrite.impl.UrlRewriteRulesDescriptorImpl;
 import org.apache.hadoop.gateway.topology.Service;
 import org.easymock.EasyMock;
-import org.jboss.shrinkwrap.api.Node;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import java.io.IOException;
@@ -35,7 +33,6 @@ import java.util.Iterator;
 import java.util.ServiceLoader;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.notNullValue;
 import static org.junit.Assert.fail;
 
@@ -80,34 +77,54 @@ public class OozieDeploymentContributorTest {
     assertThat( oozieRules.getFilter( "OOZIE/oozie/configuration" ), notNullValue() );
   }
 
-  @Ignore
-  @Test
-  public void testDeployment() throws Exception {
-    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-acrhive" );
-
-    UrlRewriteRulesDescriptorImpl rules = new UrlRewriteRulesDescriptorImpl();
-
-    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
-    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rules ).anyTimes();
-    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
-
-    Service service = EasyMock.createNiceMock( Service.class );
-    EasyMock.expect( service.getRole() ).andReturn( "OOZIE" ).anyTimes();
-    EasyMock.expect( service.getName() ).andReturn( null ).anyTimes();
-    EasyMock.expect( service.getUrl() ).andReturn( "http://test-host:777" ).anyTimes();
-
-    EasyMock.replay( context, service );
-
-    OozieDeploymentContributor contributor = new OozieDeploymentContributor();
-    assertThat( contributor.getRole(), is( "OOZIE" ) );
-    assertThat( contributor.getName(), is( "oozie" ) );
-
-    contributor.initializeContribution( context );
-    contributor.contributeService( context, service );
-    contributor.finalizeContribution( context );
-
-    Node node = webArchive.get( "TODO" );
-    assertThat( node, notNullValue() );
-  }
+//  @Test
+//  public void testDeployment() throws Exception {
+//    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, "test-archive" );
+//
+//    UrlRewriteRulesDescriptorImpl rewriteRules = new UrlRewriteRulesDescriptorImpl();
+//
+//    Map<String,String> serviceParams = new HashMap<String, String>();
+//    Service service = new Service();
+//    service.setRole( "OOZIE" );
+//    service.setName( "oozie" );
+//    service.setUrl( "http://test-host:42/test-path" );
+//    service.setParams( serviceParams );
+//
+//    Topology topology = new Topology();
+//    topology.setName( "test-topology" );
+//    topology.addService( service );
+//
+//    GatewayDescriptor gateway = EasyMock.createNiceMock( GatewayDescriptor.class );
+//    DeploymentContext context = EasyMock.createNiceMock( DeploymentContext.class );
+//    EasyMock.expect( context.getWebArchive() ).andReturn( webArchive ).anyTimes();
+//    EasyMock.expect( context.getDescriptor( "rewrite" ) ).andReturn( rewriteRules ).anyTimes();
+//    EasyMock.expect( context.getWebAppDescriptor() ).andReturn( Descriptors.create( WebAppDescriptor.class
) ).anyTimes();
+//    EasyMock.expect( context.getTopology() ).andReturn( topology ).anyTimes();
+//    EasyMock.expect( context.getGatewayDescriptor() ).andReturn( gateway ).anyTimes();
+//    Capture<Service> capturedService = new Capture<Service>();
+//    Capture<ResourceDescriptor> capturedResource = new Capture<ResourceDescriptor>();
+//    Capture<String> capturedRole = new Capture<String>();
+//    Capture<String> capturedName = new Capture<String>();
+//    Capture<List<FilterParamDescriptor>> capturedParams = new Capture<List<FilterParamDescriptor>>();
+//    context.contributeFilter( capture(capturedService) , capture(capturedResource), capture(capturedRole),
capture(capturedName), capture(capturedParams) );
+//    EasyMock.expectLastCall().anyTimes();
+//    EasyMock.replay( gateway, context );
+//
+//    OozieDeploymentContributor contributor = new OozieDeploymentContributor();
+//
+//    assertThat( contributor.getRole(), CoreMatchers.is( "OOZIE" ) );
+//    assertThat( contributor.getName(), CoreMatchers.is( "oozie" ) );
+//
+//    // Just make sure it doesn't blow up.
+//    contributor.initializeContribution( context );
+//
+//    contributor.contributeService( context, service );
+//
+//    // Just make sure it doesn't blow up.
+//    contributor.finalizeContribution( context );
+//
+//    assertThat( capturedRole.getValue(), is( "dispatch" ) );
+//    assertThat( capturedName.getValue(), is( "http-client" ) );
+//  }
 
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/c6b15b51/gateway-service-webhdfs/src/main/java/org/apache/hadoop/gateway/hdfs/WebHdfsDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-service-webhdfs/src/main/java/org/apache/hadoop/gateway/hdfs/WebHdfsDeploymentContributor.java
b/gateway-service-webhdfs/src/main/java/org/apache/hadoop/gateway/hdfs/WebHdfsDeploymentContributor.java
index 95f90eb..15322bc 100644
--- a/gateway-service-webhdfs/src/main/java/org/apache/hadoop/gateway/hdfs/WebHdfsDeploymentContributor.java
+++ b/gateway-service-webhdfs/src/main/java/org/apache/hadoop/gateway/hdfs/WebHdfsDeploymentContributor.java
@@ -78,7 +78,7 @@ public class WebHdfsDeploymentContributor extends ServiceDeploymentContributorBa
     addRewriteFilter( context, service, rootResource, params );
     addIdentityAssertionFilter( context, service, rootResource );
     addAuthorizationFilter( context, service, rootResource );
-    addDispatchFilter( context, service, rootResource, "dispatch", null );
+    addDispatchFilter( context, service, rootResource, "dispatch", "http-client" );
 
     ResourceDescriptor fileResource = context.getGatewayDescriptor().addResource();
     fileResource.role( service.getRole() );
@@ -93,7 +93,7 @@ public class WebHdfsDeploymentContributor extends ServiceDeploymentContributorBa
     addRewriteFilter( context, service, fileResource, params );
     addIdentityAssertionFilter( context, service, fileResource );
     addAuthorizationFilter( context, service, fileResource );
-    addDispatchFilter( context, service, fileResource, "dispatch", null );
+    addDispatchFilter( context, service, fileResource, "dispatch", "http-client" );
 
     ResourceDescriptor homeResource = context.getGatewayDescriptor().addResource();
     homeResource.role( service.getRole() );
@@ -106,7 +106,7 @@ public class WebHdfsDeploymentContributor extends ServiceDeploymentContributorBa
     addRewriteFilter( context, service, homeResource, params );
     addIdentityAssertionFilter( context, service, homeResource );
     addAuthorizationFilter( context, service, homeResource );
-    addDispatchFilter( context, service, homeResource, "dispatch", null );
+    addDispatchFilter( context, service, homeResource, "dispatch", "http-client" );
 
     ResourceDescriptor homeFileResource = context.getGatewayDescriptor().addResource();
     homeFileResource.role( service.getRole() );
@@ -121,7 +121,7 @@ public class WebHdfsDeploymentContributor extends ServiceDeploymentContributorBa
     addRewriteFilter( context, service, homeFileResource, params );
     addIdentityAssertionFilter( context, service, homeFileResource );
     addAuthorizationFilter( context, service, homeFileResource );
-    addDispatchFilter( context, service, homeFileResource, "dispatch", null );
+    addDispatchFilter( context, service, homeFileResource, "dispatch", "http-client" );
   }
 
   public void contributeDataNodeResource( DeploymentContext context, Service service ) throws
URISyntaxException {
@@ -137,7 +137,7 @@ public class WebHdfsDeploymentContributor extends ServiceDeploymentContributorBa
     params.add( fileResource.createFilterParam().
         name( UrlRewriteServletFilter.REQUEST_URL_RULE_PARAM ).value( getQualifiedName()
+ "/inbound/datanode" ) );
     addRewriteFilter( context, service, fileResource, params );
-    addDispatchFilter( context, service, fileResource, "dispatch", null );
+    addDispatchFilter( context, service, fileResource, "dispatch", "http-client" );
   }
 
   String getQualifiedName() {


Mime
View raw message