knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject knox git commit: KNOX-632: Oozie dispatch failing for secure clusters. Fix tests.
Date Mon, 23 Nov 2015 20:44:06 GMT
Repository: knox
Updated Branches:
  refs/heads/master 5a08e3742 -> 751b14a25


KNOX-632: Oozie dispatch failing for secure clusters. Fix tests.


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

Branch: refs/heads/master
Commit: 751b14a25f994370a318bb990d01704bd10dcca6
Parents: 5a08e37
Author: Kevin Minder <kevin.minder@hortonworks.com>
Authored: Mon Nov 23 15:44:02 2015 -0500
Committer: Kevin Minder <kevin.minder@hortonworks.com>
Committed: Mon Nov 23 15:44:02 2015 -0500

----------------------------------------------------------------------
 .../org/apache/hadoop/gateway/dispatch/DefaultDispatch.java    | 2 +-
 .../apache/hadoop/gateway/dispatch/DefaultDispatchTest.java    | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/751b14a2/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
index a71d56a..e17bd36 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/dispatch/DefaultDispatch.java
@@ -193,7 +193,7 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
       }
       GatewayConfig config =
          (GatewayConfig)request.getServletContext().getAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE
);
-      if( config.isHadoopKerberosSecured() ) {
+      if( config != null && config.isHadoopKerberosSecured() ) {
          entity = new PartiallyRepeatableHttpEntity( entity, config.getHttpServerRequestBuffer()
);
       }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/751b14a2/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
b/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
index 2c09a5d..1e66cc1 100644
--- a/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
+++ b/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
@@ -30,6 +30,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.UnknownHostException;
 
+import javax.servlet.ServletContext;
 import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
@@ -91,11 +92,14 @@ public class DefaultDispatchTest {
   public void testCallToSecureClusterWithDelegationToken() throws URISyntaxException, IOException
{
     System.setProperty(GatewayConfig.HADOOP_KERBEROS_SECURED, "true");
     DefaultDispatch defaultDispatch = new DefaultDispatch();
+    ServletContext servletContext = EasyMock.createNiceMock( ServletContext.class );
+    EasyMock.expect( servletContext.getAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE
) ).andReturn( null ).anyTimes();
     ServletInputStream inputStream = EasyMock.createNiceMock( ServletInputStream.class );
     HttpServletRequest inboundRequest = EasyMock.createNiceMock( HttpServletRequest.class
);
     EasyMock.expect(inboundRequest.getQueryString()).andReturn( "delegation=123").anyTimes();
     EasyMock.expect(inboundRequest.getInputStream()).andReturn( inputStream).anyTimes();
-    EasyMock.replay( inboundRequest );
+    EasyMock.expect(inboundRequest.getServletContext()).andReturn( servletContext ).anyTimes();
+    EasyMock.replay( servletContext, inboundRequest );
     HttpEntity httpEntity = defaultDispatch.createRequestEntity(inboundRequest);
     System.setProperty(GatewayConfig.HADOOP_KERBEROS_SECURED, "false");
     assertFalse("buffering in the presence of delegation token", 


Mime
View raw message