You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/10/15 11:03:52 UTC
[incubator-servicecomb-java-chassis] 02/03: [SCB-948] change IT
DownloadSchema to listen random port, so that can reuse test case.
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit 464633a0f59a2a9e563a0370f6ae08914fbfbf4f
Author: wujimin <wu...@huawei.com>
AuthorDate: Wed Oct 10 15:50:35 2018 +0800
[SCB-948] change IT DownloadSchema to listen random port, so that can reuse test case.
---
.../main/java/org/apache/servicecomb/it/schema/DownloadSchema.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DownloadSchema.java b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DownloadSchema.java
index d98a7ab..651caac 100644
--- a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DownloadSchema.java
+++ b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DownloadSchema.java
@@ -62,7 +62,7 @@ public class DownloadSchema implements BootListener {
// for download from net stream case
server = ServerBootstrap
.bootstrap()
- .setListenerPort(9000)
+ .setListenerPort(0)
.registerHandler("/download/netInputStream", (req, resp, context) -> {
String uri = req.getRequestLine().getUri();
String query = URI.create(uri).getQuery();
@@ -183,7 +183,7 @@ public class DownloadSchema implements BootListener {
@ApiResponse(code = 200, response = File.class, message = ""),
})
public ResponseEntity<InputStream> netInputStream(String content) throws IOException {
- URL url = new URL("http://localhost:9000/download/netInputStream?content="
+ URL url = new URL("http://localhost:" + server.getLocalPort() + "/download/netInputStream?content="
+ URLEncoder.encode(content, StandardCharsets.UTF_8.name()));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
ResponseEntity<InputStream> responseEntity = ResponseEntity