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-678] - Malformed UTF-8 characters in JSON Response. Reapply
Date Mon, 07 Mar 2016 16:04:47 GMT
Repository: knox
Updated Branches:
  refs/heads/master 3d37f7b27 -> 26338adc5


KNOX-678] - Malformed UTF-8 characters in JSON Response. Reapply


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

Branch: refs/heads/master
Commit: 26338adc5f49e77c2bae4f3e01e520a8b6ae4c3d
Parents: 3d37f7b
Author: Kevin Minder <kminder@apache.org>
Authored: Mon Mar 7 11:04:38 2016 -0500
Committer: Kevin Minder <kminder@apache.org>
Committed: Mon Mar 7 11:04:38 2016 -0500

----------------------------------------------------------------------
 CHANGES                                         |   1 +
 .../gateway/dispatch/DefaultDispatch.java       |  43 +++-
 .../hadoop/gateway/GatewayBasicFuncTest.java    |   2 +-
 .../hadoop/gateway/GatewayMultiFuncTest.java    | 229 +++++++++++++++++++
 .../applications/readme.txt                     |  18 ++
 .../GatewayMultiFuncTest/services/readme.txt    |  18 ++
 .../services/repeat/0.0.0/rewrite.xml           |  28 +++
 .../services/repeat/0.0.0/service.xml           |  23 ++
 .../test-knox678-utf8-chars-topology.xml        |  54 +++++
 .../gateway/GatewayMultiFuncTest/users.ldif     |  42 ++++
 10 files changed, 452 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index daed19b..2877e83 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ Release Notes - Apache Knox - Version 0.9.0
 ** Improvement
     * [KNOX-677] - Upgrade to latest Groovy
     * [KNOX-675] - Upgrade Knox's Jetty dependency to latest 9.x
+    * [KNOX-678] - Malformed UTF-8 characters in JSON Response
 ** Bug
 
 ------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/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 85ecb08..9f3cfd3 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
@@ -48,7 +48,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -65,6 +67,7 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
       AuditConstants.KNOX_SERVICE_NAME, AuditConstants.KNOX_COMPONENT_NAME);
 
   private Set<String> outboundResponseExcludeHeaders;
+  private Map<String,String> inboundResponseCharsetDefaults;
 
   private int replayBufferSize = -1;
 
@@ -73,6 +76,13 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
     outboundResponseExcludeHeaders = new HashSet<>();
     outboundResponseExcludeHeaders.add(SET_COOKIE);
     outboundResponseExcludeHeaders.add(WWW_AUTHENTICATE);
+
+    String utf8 = "UTF-8";
+    inboundResponseCharsetDefaults = new HashMap<>();
+    inboundResponseCharsetDefaults.put( "text/xml", utf8 );
+    inboundResponseCharsetDefaults.put( "text/json", utf8 );
+    inboundResponseCharsetDefaults.put( "application/xml", utf8 );
+    inboundResponseCharsetDefaults.put( "application/json", utf8 );
   }
 
   @Override
@@ -150,11 +160,8 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
     }
 
     HttpEntity entity = inboundResponse.getEntity();
-    if ( entity != null ) {
-      Header contentType = entity.getContentType();
-      if ( contentType != null ) {
-        outboundResponse.setContentType(contentType.getValue());
-      }
+    if( entity != null ) {
+      outboundResponse.setContentType( getInboundResponseContentType( entity ) );
       //KM[ If this is set here it ends up setting the content length to the content returned
from the server.
       // This length might not match if the the content is rewritten.
       //      long contentLength = entity.getContentLength();
@@ -171,6 +178,23 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
     }
   }
 
+  private String getInboundResponseContentType( HttpEntity entity ) {
+    String name = null;
+    if( entity != null ) {
+      ContentType type = ContentType.get( entity );
+      if( type != null ) {
+        if( type.getCharset() == null ) {
+          String charset = getInboundResponseCharacterEncoding( type.getMimeType() );
+          if( charset != null ) {
+            type = type.withCharset( charset );
+          }
+        }
+        name = type.toString();
+      }
+    }
+    return name;
+  }
+
   protected void closeInboundResponse( HttpResponse response, InputStream stream ) throws
IOException {
     try {
       stream.close();
@@ -272,4 +296,13 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
   public Set<String> getOutboundResponseExcludeHeaders() {
     return outboundResponseExcludeHeaders;
   }
+
+  protected String getInboundResponseCharacterEncoding( String mimeType ) {
+    String charset = null;
+    if( mimeType != null ) {
+      charset = inboundResponseCharsetDefaults.get( mimeType.trim().toLowerCase() );
+    }
+    return charset;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/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 5dff1f8..27e4b72 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
@@ -2274,7 +2274,7 @@ public class GatewayBasicFuncTest {
     LOG_EXIT();
   }
 
-  @Test( timeout = MEDIUM_TIMEOUT )
+  @Test//( timeout = MEDIUM_TIMEOUT )
   public void testYarnRmApplication() throws Exception {
     LOG_ENTER();
     getYarnRmApp( ContentType.JSON, true );

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayMultiFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayMultiFuncTest.java
b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayMultiFuncTest.java
new file mode 100644
index 0000000..47fe9bd
--- /dev/null
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayMultiFuncTest.java
@@ -0,0 +1,229 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.gateway;
+
+import java.io.File;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import com.jayway.restassured.RestAssured;
+import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.protocol.shared.transport.TcpTransport;
+import org.apache.hadoop.gateway.security.ldap.SimpleLdapDirectoryServer;
+import org.apache.hadoop.gateway.services.DefaultGatewayServices;
+import org.apache.hadoop.gateway.services.GatewayServices;
+import org.apache.hadoop.gateway.services.ServiceLifecycleException;
+import org.apache.hadoop.gateway.services.topology.TopologyService;
+import org.apache.hadoop.test.TestUtils;
+import org.apache.hadoop.test.category.ReleaseTest;
+import org.apache.hadoop.test.mock.MockServer;
+import org.apache.http.HttpStatus;
+import org.apache.log4j.Appender;
+import org.hamcrest.MatcherAssert;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static com.jayway.restassured.RestAssured.given;
+import static com.jayway.restassured.config.ConnectionConfig.connectionConfig;
+import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.apache.hadoop.test.TestUtils.LOG_ENTER;
+import static org.apache.hadoop.test.TestUtils.LOG_EXIT;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+@Category(ReleaseTest.class)
+public class GatewayMultiFuncTest {
+
+  private static Logger LOG = LoggerFactory.getLogger( GatewayMultiFuncTest.class );
+  private static Class DAT = GatewayMultiFuncTest.class;
+
+  private static Enumeration<Appender> appenders;
+  private static GatewayTestConfig config;
+  private static DefaultGatewayServices services;
+  private static GatewayServer gateway;
+  private static int gatewayPort;
+  private static String gatewayUrl;
+  private static String clusterUrl;
+  private static SimpleLdapDirectoryServer ldap;
+  private static TcpTransport ldapTransport;
+  private static int ldapPort;
+  private static Properties params;
+  private static TopologyService topos;
+  private static MockServer mockWebHdfs;
+
+  @BeforeClass
+  public static void setupSuite() throws Exception {
+    LOG_ENTER();
+    RestAssured.config = newConfig().connectionConfig(connectionConfig().closeIdleConnectionsAfterEachResponse());
+    //appenders = NoOpAppender.setUp();
+    setupLdap();
+    setupGateway();
+    LOG_EXIT();
+  }
+
+  @AfterClass
+  public static void cleanupSuite() throws Exception {
+    LOG_ENTER();
+    gateway.stop();
+    ldap.stop( true );
+    FileUtils.deleteQuietly( new File( config.getGatewayHomeDir() ) );
+    //NoOpAppender.tearDown( appenders );
+    LOG_EXIT();
+  }
+
+  @After
+  public void cleanupTest() throws Exception {
+    FileUtils.cleanDirectory( new File( config.getGatewayTopologyDir() ) );
+    FileUtils.cleanDirectory( new File( config.getGatewayDeploymentDir() ) );
+  }
+
+  public static void setupLdap() throws Exception {
+    URL usersUrl = TestUtils.getResourceUrl( DAT, "users.ldif" );
+    ldapPort = TestUtils.findFreePort();
+    ldapTransport = new TcpTransport( ldapPort );
+    ldap = new SimpleLdapDirectoryServer( "dc=hadoop,dc=apache,dc=org", new File( usersUrl.toURI()
), ldapTransport );
+    ldap.start();
+    LOG.info( "LDAP port = " + ldapTransport.getPort() );
+  }
+
+  public static void setupGateway() throws Exception {
+
+    File targetDir = new File( System.getProperty( "user.dir" ), "target" );
+    File gatewayDir = new File( targetDir, "gateway-home-" + UUID.randomUUID() );
+    gatewayDir.mkdirs();
+
+    config = new GatewayTestConfig();
+    config.setGatewayHomeDir( gatewayDir.getAbsolutePath() );
+
+    URL svcsFileUrl = TestUtils.getResourceUrl( DAT, "services/readme.txt" );
+    File svcsFile = new File( svcsFileUrl.getFile() );
+    File svcsDir = svcsFile.getParentFile();
+    config.setGatewayServicesDir( svcsDir.getAbsolutePath() );
+
+    URL appsFileUrl = TestUtils.getResourceUrl( DAT, "applications/readme.txt" );
+    File appsFile = new File( appsFileUrl.getFile() );
+    File appsDir = appsFile.getParentFile();
+    config.setGatewayApplicationsDir( appsDir.getAbsolutePath() );
+
+    File topoDir = new File( config.getGatewayTopologyDir() );
+    topoDir.mkdirs();
+
+    File deployDir = new File( config.getGatewayDeploymentDir() );
+    deployDir.mkdirs();
+
+    setupMockServers();
+    startGatewayServer();
+  }
+
+  public static void setupMockServers() throws Exception {
+    mockWebHdfs = new MockServer( "WEBHDFS", true );
+  }
+
+  public static void startGatewayServer() throws Exception {
+    services = new DefaultGatewayServices();
+    Map<String,String> options = new HashMap<String,String>();
+    options.put( "persist-master", "false" );
+    options.put( "master", "password" );
+    try {
+      services.init( config, options );
+    } catch ( ServiceLifecycleException e ) {
+      e.printStackTrace(); // I18N not required.
+    }
+    topos = services.getService(GatewayServices.TOPOLOGY_SERVICE);
+
+    gateway = GatewayServer.startGateway( config, services );
+    MatcherAssert.assertThat( "Failed to start gateway.", gateway, notNullValue() );
+
+    gatewayPort = gateway.getAddresses()[0].getPort();
+    gatewayUrl = "http://localhost:" + gatewayPort + "/" + config.getGatewayPath();
+    clusterUrl = gatewayUrl + "/test-topology";
+
+    LOG.info( "Gateway port = " + gateway.getAddresses()[ 0 ].getPort() );
+
+    params = new Properties();
+    params.put( "LDAP_URL", "ldap://localhost:" + ldapTransport.getPort() );
+    params.put( "WEBHDFS_URL", "http://localhost:" + mockWebHdfs.getPort() );
+  }
+
+  @Test( timeout = TestUtils.MEDIUM_TIMEOUT )
+  public void testDefaultJsonMimeTypeHandlingKnox678() throws Exception {
+    LOG_ENTER();
+
+    MockServer mock = new MockServer( "REPEAT", true );
+
+    params.put( "MOCK_SERVER_PORT", mock.getPort() );
+
+    String topoStr = TestUtils.merge( DAT, "topologies/test-knox678-utf8-chars-topology.xml",
params );
+    File topoFile = new File( config.getGatewayTopologyDir(), "topology.xml" );
+    FileUtils.writeStringToFile( topoFile, topoStr );
+
+    topos.reloadTopologies();
+
+    String uname = "guest";
+    String pword = uname + "-password";
+
+    mock.expect().respond().contentType( "application/json" ).content( "{\"msg\":\"H\u00eallo\"}",
Charset.forName( "UTF8" ) );
+    given()
+        //.log().all()
+        .auth().preemptive().basic( uname, pword )
+        .expect()
+        //.log().all()
+        .statusCode( HttpStatus.SC_OK )
+        .body( "msg", is( "H\u00eallo" ) )
+        .when().get( gatewayUrl + "/topology/repeat" );
+    assertThat( mock.isEmpty(), is(true) );
+
+    mock.expect().respond().contentType( "application/json" ).content( "{\"msg\":\"H\u00eallo\"}",
Charset.forName( "UTF8" ) );
+    given()
+        //.log().all()
+        .auth().preemptive().basic( uname, pword )
+        .expect()
+        //.log().all()
+        .statusCode( HttpStatus.SC_OK )
+        .body( "msg", is( "H\u00eallo" ) )
+        .when().get( gatewayUrl + "/topology/repeat" );
+    assertThat( mock.isEmpty(), is(true) );
+
+    mock.expect().respond().contentType( "application/octet-stream" ).content( "H\u00eallo".getBytes()
);
+    byte[] body = given()
+        //.log().all()
+        .auth().preemptive().basic( uname, pword )
+        .expect()
+        //.log().all()
+        .statusCode( HttpStatus.SC_OK )
+        //.contentType( "application/octet-stream" )
+        .when().get( gatewayUrl + "/topology/repeat" ).andReturn().asByteArray();
+    assertThat( body, is(equalTo("H\u00eallo".getBytes())) );
+    assertThat( mock.isEmpty(), is(true) );
+
+    LOG_EXIT();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/applications/readme.txt
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/applications/readme.txt
b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/applications/readme.txt
new file mode 100644
index 0000000..cd2eef8
--- /dev/null
+++ b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/applications/readme.txt
@@ -0,0 +1,18 @@
+##########################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+This file is here to help the tests find the parent directory.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/readme.txt
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/readme.txt
b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/readme.txt
new file mode 100644
index 0000000..cd2eef8
--- /dev/null
+++ b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/readme.txt
@@ -0,0 +1,18 @@
+##########################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+This file is here to help the tests find the parent directory.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/rewrite.xml
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/rewrite.xml
b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/rewrite.xml
new file mode 100644
index 0000000..93c877a
--- /dev/null
+++ b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/rewrite.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<rules>
+
+    <rule dir="IN" name="REPEAT/default/root/inbound" pattern="*://*:*/**/repeat/?{**}">
+      <rewrite template="{$serviceUrl[REPEAT]}/?{**}"/>
+    </rule>
+
+    <rule dir="IN" name="REPEAT/default/path/inbound" pattern="*://*:*/**/repeat/{path=**}?{**}">
+      <rewrite template="{$serviceUrl[REPEAT]}/{path=**}?{**}"/>
+    </rule>
+
+</rules>

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/service.xml
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/service.xml
b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/service.xml
new file mode 100644
index 0000000..49daa4c
--- /dev/null
+++ b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/services/repeat/0.0.0/service.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<service role="REPEAT" name="default" version="0.0.0">
+    <routes>
+        <route path="/repeat/?**"/>
+        <route path="/repeat/**?**"/>
+    </routes>
+</service>

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/topologies/test-knox678-utf8-chars-topology.xml
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/topologies/test-knox678-utf8-chars-topology.xml
b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/topologies/test-knox678-utf8-chars-topology.xml
new file mode 100644
index 0000000..fbbab48
--- /dev/null
+++ b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/topologies/test-knox678-utf8-chars-topology.xml
@@ -0,0 +1,54 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<topology>
+    <gateway>
+        <provider>
+            <role>authentication</role>
+            <name>ShiroProvider</name>
+            <enabled>true</enabled>
+            <param>
+                <name>main.ldapRealm</name>
+                <value>org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm</value>
+            </param>
+            <param>
+                <name>main.ldapRealm.userDnTemplate</name>
+                <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
+            </param>
+            <param>
+                <name>main.ldapRealm.contextFactory.url</name>
+                <value>$LDAP_URL</value>
+            </param>
+            <param>
+                <name>main.ldapRealm.contextFactory.authenticationMechanism</name>
+                <value>simple</value>
+            </param>
+            <param>
+                <name>urls./**</name>
+                <value>authcBasic</value>
+            </param>
+        </provider>
+        <provider>
+            <role>identity-assertion</role>
+            <name>Default</name>
+            <enabled>true</enabled>
+        </provider>
+    </gateway>
+    <service>
+        <role>REPEAT</role>
+        <url>http://localhost:${MOCK_SERVER_PORT}/repeat-context</url>
+    </service>
+</topology>

http://git-wip-us.apache.org/repos/asf/knox/blob/26338adc/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/users.ldif
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/users.ldif
b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/users.ldif
new file mode 100644
index 0000000..b982cb3
--- /dev/null
+++ b/gateway-test/src/test/resources/org/apache/hadoop/gateway/GatewayMultiFuncTest/users.ldif
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+version: 1
+
+dn: dc=hadoop,dc=apache,dc=org
+objectclass: organization
+objectclass: dcObject
+o: Hadoop
+dc: hadoop
+
+# entry for a sample people container
+# please replace with site specific values
+dn: ou=people,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:organizationalUnit
+ou: people
+
+# entry for a sample end user
+# please replace with site specific values
+dn: uid=guest,ou=people,dc=hadoop,dc=apache,dc=org
+objectclass:top
+objectclass:person
+objectclass:organizationalPerson
+objectclass:inetOrgPerson
+cn: Guest
+sn: User
+uid: guest
+userPassword:guest-password
\ No newline at end of file


Mime
View raw message