Repository: knox Updated Branches: refs/heads/master 6135abd39 -> 60900b955
KNOX-1024 - Add Kafka test to GatewayBasicFuncTest Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/60900b95 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/60900b95 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/60900b95 Branch: refs/heads/master Commit: 60900b9553f2b90029b3b9840fd437bc173bf951 Parents: 6135abd Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Tue Sep 5 11:56:15 2017 +0100 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Tue Sep 5 11:56:15 2017 +0100 ---------------------------------------------------------------------- .../hadoop/gateway/GatewayBasicFuncTest.java | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/60900b95/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java ---------------------------------------------------------------------- diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java index 499ba06..576721d 100644 --- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java +++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayBasicFuncTest.java @@ -163,6 +163,7 @@ public class GatewayBasicFuncTest { driver.setupService( "STORM", "http://" + TEST_HOST + ":8477", "/cluster/storm", USE_MOCK_SERVICES ); driver.setupService( "STORM-LOGVIEWER", "http://" + TEST_HOST + ":8477", "/cluster/storm", USE_MOCK_SERVICES ); driver.setupService( "SOLR", "http://" + TEST_HOST + ":8983", "/cluster/solr", USE_MOCK_SERVICES ); + driver.setupService( "KAFKA", "http://" + TEST_HOST + ":8477", "/cluster/kafka", USE_MOCK_SERVICES ); driver.setupGateway( config, "cluster", createTopology(), USE_GATEWAY ); LOG_EXIT(); } @@ -268,6 +269,9 @@ public class GatewayBasicFuncTest { .addTag("role").addText("SOLR") .addTag("url").addText(driver.getRealUrl("SOLR")).gotoParent() .addTag("service") + .addTag("role").addText("KAFKA") + .addTag("url").addText(driver.getRealUrl("KAFKA")).gotoParent() + .addTag("service") .addTag("role").addText("SERVICE-TEST") .gotoRoot(); // System.out.println( "GATEWAY=" + xml.toString() ); @@ -3741,6 +3745,31 @@ public class GatewayBasicFuncTest { LOG_EXIT(); } + @Test( timeout = TestUtils.MEDIUM_TIMEOUT ) + public void testKafka() throws IOException { + LOG_ENTER(); + String username = "hdfs"; + String password = "hdfs-password"; + + driver.getMock( "KAFKA" ) + .expect() + .method( "GET" ) + .pathInfo( "/topics" ) + .respond() + .status( HttpStatus.SC_OK ); + + given() + .auth().preemptive().basic( username, password ) + .header("X-XSRF-Header", "jksdhfkhdsf") + .queryParam( "op", "GET" ) + .expect() + .statusCode( HttpStatus.SC_OK ) + .when().get( driver.getUrl( "KAFKA" ) + "/topics" ); + + driver.assertComplete(); + LOG_EXIT(); + } + void setupResource(String serviceRole, String path){ driver.getMock(serviceRole) .expect().method("GET")