This is an automated email from the ASF dual-hosted git repository.

srdo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new ab8de9a  STORM-3330: Fix integration test
ab8de9a is described below

commit ab8de9ac252032f62e68b9eb8d269c5ed42b5d07
Author: Stig Rohde Døssing <[email protected]>
AuthorDate: Tue Feb 26 22:59:44 2019 +0100

    STORM-3330: Fix integration test
---
 .../test/java/org/apache/storm/st/wrapper/TopoWrap.java    | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java 
b/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java
index 5f0641e..c68f5ec 100644
--- a/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java
+++ b/integration-test/src/test/java/org/apache/storm/st/wrapper/TopoWrap.java
@@ -23,8 +23,10 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import com.google.common.collect.ImmutableMap;
 import java.io.File;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.text.NumberFormat;
 import java.util.ArrayList;
@@ -252,11 +254,15 @@ public class TopoWrap {
         }
 
         public ExecutorURL(String componentId, String host, int logViewerPort, 
int executorPort, String topoId) throws MalformedURLException {
-            String sep = "%2F"; //hex of "/"
             String viewUrlStr = String.format("http://%s:%s/api/v1/log?file=";, 
host, logViewerPort);
-            String downloadUrlStr = 
String.format("http://%s:%s/api/v1/download?file=%%2F";, host, logViewerPort);
-            viewUrl = new URL(String.format("%s/%s%s%d%sworker.log", 
viewUrlStr, topoId, sep, executorPort, sep));
-            downloadUrl = new URL(String.format("%s/%s%s%d%sworker.log", 
downloadUrlStr, topoId, sep, executorPort, sep));
+            String downloadUrlStr = 
String.format("http://%s:%s/api/v1/download?file=";, host, logViewerPort);
+            try {
+                String workerLogQueryParam = URLEncoder.encode(topoId + "/" + 
executorPort + "/worker.log", StandardCharsets.UTF_8.name());
+                viewUrl = new URL(viewUrlStr + workerLogQueryParam);
+                downloadUrl = new URL(downloadUrlStr + workerLogQueryParam);
+            } catch (UnsupportedEncodingException e) {
+                throw Utils.wrapInRuntime(e);
+            }
             this.componentId = componentId;
         }
 

Reply via email to