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 f73c32f58b72f3ca8bd0fb045546f646f7593ffc
Author: wujimin <[email protected]>
AuthorDate: Wed Oct 31 02:55:24 2018 +0800

    [SCB-1001] move download test case to IT
---
 .../client/CodeFirstRestTemplateSpringmvc.java     |   4 -
 .../demo/springmvc/client/DownloadSchemaIntf.java  |  39 -----
 .../demo/springmvc/server/DownloadSchema.java      | 186 ---------------------
 .../springmvc/server/ProducerTestsAfterBootup.java |   2 +-
 .../src/main/resources/microservice.yaml           |  17 +-
 .../org/apache/servicecomb/it/ConsumerMain.java    |   6 +
 .../servicecomb/it/testcase}/TestDownload.java     |  56 ++++---
 .../servicecomb/it/testcase/base/TestDownload.java | 140 ----------------
 .../servicecomb/it/schema/DownloadSchema.java      |   2 +-
 9 files changed, 47 insertions(+), 405 deletions(-)

diff --git 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
 
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
index a51588f..1c92669 100644
--- 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
+++ 
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstRestTemplateSpringmvc.java
@@ -70,8 +70,6 @@ public class CodeFirstRestTemplateSpringmvc extends 
CodeFirstRestTemplate {
 
   private TestGeneric testGeneric = new TestGeneric();
 
-  private TestDownload testDownload = new TestDownload();
-
   private TestRestTemplate testRestTemplate = new TestRestTemplate();
 
   private TestContentType testContentType = new TestContentType();
@@ -80,8 +78,6 @@ public class CodeFirstRestTemplateSpringmvc extends 
CodeFirstRestTemplate {
 
   @Override
   protected void testOnlyRest(RestTemplate template, String cseUrlPrefix) {
-    testDownload.runRest();
-
     try {
       testUpload(template, cseUrlPrefix);
     } catch (IOException e) {
diff --git 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/DownloadSchemaIntf.java
 
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/DownloadSchemaIntf.java
deleted file mode 100644
index 93e67ee..0000000
--- 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/DownloadSchemaIntf.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.servicecomb.demo.springmvc.client;
-
-import org.apache.servicecomb.foundation.vertx.http.ReadStreamPart;
-
-public interface DownloadSchemaIntf {
-  ReadStreamPart tempFileEntity(String content);
-
-  ReadStreamPart tempFilePart(String content);
-
-  ReadStreamPart file(String content);
-
-  ReadStreamPart chineseAndSpaceFile(String content);
-
-  ReadStreamPart resource(String content);
-
-  ReadStreamPart entityResource(String content);
-
-  ReadStreamPart entityInputStream(String content);
-
-  ReadStreamPart bytes(String content);
-
-  ReadStreamPart netInputStream(String content);
-}
diff --git 
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/DownloadSchema.java
 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/DownloadSchema.java
deleted file mode 100644
index 5631663..0000000
--- 
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/DownloadSchema.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.servicecomb.demo.springmvc.server;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.UUID;
-
-import javax.servlet.http.Part;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.bootstrap.HttpServer;
-import org.apache.http.impl.bootstrap.ServerBootstrap;
-import org.apache.servicecomb.foundation.common.part.FilePart;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-import org.springframework.core.io.ByteArrayResource;
-import org.springframework.core.io.Resource;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-@RestSchema(schemaId = "download")
-@RequestMapping(path = "/download")
-public class DownloadSchema {
-  File tempDir = new File("target/downloadTemp");
-
-  public DownloadSchema() throws IOException {
-    FileUtils.deleteQuietly(tempDir);
-    FileUtils.forceMkdir(tempDir);
-
-    // for download from net stream case
-    HttpServer server = ServerBootstrap
-        .bootstrap()
-        .setListenerPort(9000)
-        .registerHandler("/download/netInputStream", (req, resp, context) -> {
-          String uri = req.getRequestLine().getUri();
-          String query = URI.create(uri).getQuery();
-          int idx = query.indexOf('=');
-          String content = query.substring(idx + 1);
-          content = URLDecoder.decode(content, StandardCharsets.UTF_8.name());
-          resp.setEntity(new StringEntity(content, 
StandardCharsets.UTF_8.name()));
-        })
-        .create();
-    server.start();
-  }
-
-  protected File createTempFile(String content) throws IOException {
-    return createTempFile(null, content);
-  }
-
-  protected File createTempFile(String name, String content) throws 
IOException {
-    if (name == null) {
-      name = "download-" + UUID.randomUUID().toString() + ".txt";
-    }
-    File file = new File(tempDir, name);
-    FileUtils.write(file, content);
-    return file;
-  }
-
-  // customize HttpHeaders.CONTENT_DISPOSITION to be 
"attachment;filename=tempFileEntity.txt"
-  @GetMapping(path = "/tempFileEntity")
-  public ResponseEntity<Part> tempFileEntity(String content) throws 
IOException {
-    File file = createTempFile(content);
-
-    return ResponseEntity
-        .ok()
-        .header(HttpHeaders.CONTENT_DISPOSITION, 
"attachment;filename=tempFileEntity.txt")
-        .body(new FilePart(null, file)
-            .setDeleteAfterFinished(true));
-  }
-
-  // generate HttpHeaders.CONTENT_DISPOSITION to be 
"attachment;filename=tempFilePart.txt" automatically
-  @GetMapping(path = "/tempFilePart")
-  public Part tempFilePart(String content) throws IOException {
-    File file = createTempFile(content);
-
-    return new FilePart(null, file)
-        .setDeleteAfterFinished(true)
-        .setSubmittedFileName("tempFilePart.txt");
-  }
-
-  @GetMapping(path = "/file")
-  public File file(String content) throws IOException {
-    return createTempFile("file.txt", content);
-  }
-
-  @GetMapping(path = "/chineseAndSpaceFile")
-  public Part chineseAndSpaceFile(String content) throws IOException {
-    File file = createTempFile(content);
-    return new FilePart(null, file)
-        .setDeleteAfterFinished(true)
-        .setSubmittedFileName("测 试.test.txt");
-  }
-
-  @GetMapping(path = "/resource")
-  @ApiResponses({
-      @ApiResponse(code = 200, response = File.class, message = ""),
-  })
-  public Resource resource(String content) throws IOException {
-    return new ByteArrayResource(content.getBytes(StandardCharsets.UTF_8)) {
-      @Override
-      public String getFilename() {
-        return "resource.txt";
-      }
-    };
-  }
-
-  @GetMapping(path = "/entityResource")
-  @ApiResponses({
-      @ApiResponse(code = 200, response = File.class, message = ""),
-  })
-  public ResponseEntity<Resource> entityResource(String content) throws 
IOException {
-    return ResponseEntity
-        .ok()
-        .header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_VALUE)
-        .header(HttpHeaders.CONTENT_DISPOSITION, 
"attachment;filename=entityResource.txt")
-        .body(new ByteArrayResource(content.getBytes(StandardCharsets.UTF_8)));
-  }
-
-  @GetMapping(path = "/entityInputStream")
-  @ApiResponses({
-      @ApiResponse(code = 200, response = File.class, message = ""),
-  })
-  public ResponseEntity<InputStream> entityInputStream(String content) throws 
IOException {
-    return ResponseEntity
-        .ok()
-        .header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_VALUE)
-        .header(HttpHeaders.CONTENT_DISPOSITION, 
"attachment;filename=entityInputStream.txt")
-        .body(new 
ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)));
-  }
-
-  @GetMapping(path = "/bytes")
-  @ApiResponses({
-      @ApiResponse(code = 200, response = File.class, message = ""),
-  })
-  public ResponseEntity<byte[]> bytes(String content) throws IOException {
-    return ResponseEntity
-        .ok()
-        .header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_VALUE)
-        .header(HttpHeaders.CONTENT_DISPOSITION, 
"attachment;filename=bytes.txt")
-        .body(content.getBytes(StandardCharsets.UTF_8));
-  }
-
-  @GetMapping(path = "/netInputStream")
-  @ApiResponses({
-      @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=";
-        + URLEncoder.encode(content, StandardCharsets.UTF_8.name()));
-    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-    return ResponseEntity
-        .ok()
-        .header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN_VALUE)
-        .header(HttpHeaders.CONTENT_DISPOSITION, 
"attachment;filename=netInputStream.txt")
-        .body(conn.getInputStream());
-  }
-}
diff --git 
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
index e19296f..6023d1d 100644
--- 
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
+++ 
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ProducerTestsAfterBootup.java
@@ -59,7 +59,7 @@ public class ProducerTestsAfterBootup implements BootListener 
{
   }
 
   public void testRegisteredBasePath() {
-    TestMgr.check(13, RegistryUtils.getMicroservice().getPaths().size());
+    TestMgr.check(12, RegistryUtils.getMicroservice().getPaths().size());
   }
 
   private String getSwaggerContent(Swagger swagger) {
diff --git 
a/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml 
b/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
index fba7554..393dc52 100644
--- a/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
+++ b/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
@@ -14,21 +14,20 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-servicecomb:
-  microserviceVersionFactory: 
org.apache.servicecomb.core.definition.PrivateMicroserviceVersionMetaFactory
 
 APPLICATION_ID: springmvctest
 service_description:
   name: springmvc
   version: 0.0.3
   paths:
-    - path: /test1/testpath
-      property:
-        checksession: false
-    - path: /test2/testpath
-      property:
-        checksession: true
+  - path: /test1/testpath
+    property:
+      checksession: false
+  - path: /test2/testpath
+    property:
+      checksession: true
 servicecomb:
+  microserviceVersionFactory: 
org.apache.servicecomb.core.definition.PrivateMicroserviceVersionMetaFactory
   service:
     registry:
       registerPath: true
@@ -44,7 +43,7 @@ servicecomb:
           interval: 10
         watch: false
       autodiscovery: true
-# can download config center from 
https://cse-bucket.obs.myhwclouds.com/LocalCSE/Local-CSE-1.0.0.zip to test 
dynamic config
+  # can download config center from 
https://cse-bucket.obs.myhwclouds.com/LocalCSE/Local-CSE-1.0.0.zip to test 
dynamic config
   config:
     client:
       serverUri: http://127.0.0.1:30113
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
index f6ebdbc..48da9cd 100644
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/ConsumerMain.java
@@ -28,6 +28,7 @@ import org.apache.servicecomb.it.testcase.TestChangeTransport;
 import org.apache.servicecomb.it.testcase.TestDataTypePrimitive;
 import org.apache.servicecomb.it.testcase.TestDefaultJsonValueJaxrsSchema;
 import org.apache.servicecomb.it.testcase.TestDefaultValue;
+import org.apache.servicecomb.it.testcase.TestDownload;
 import org.apache.servicecomb.it.testcase.TestIgnoreMethod;
 import org.apache.servicecomb.it.testcase.TestIgnoreStaticMethod;
 import org.apache.servicecomb.it.testcase.TestParamCodec;
@@ -99,6 +100,11 @@ public class ConsumerMain {
     // only rest support default value feature
     ITJUnitUtils.runWithRest(TestDefaultValue.class);
 
+    // currently have bug with http2
+    if (!ITJUnitUtils.getProducerName().endsWith("-h2") && 
!ITJUnitUtils.getProducerName().endsWith("-h2c")) {
+      ITJUnitUtils.runWithRest(TestDownload.class);
+    }
+
     ITJUnitUtils.runWithHighwayAndRest(TestTrace.class);
     ITJUnitUtils.run(TestTraceEdge.class);
 
diff --git 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestDownload.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDownload.java
similarity index 68%
rename from 
demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestDownload.java
rename to 
integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDownload.java
index 0436382..9a3947c 100644
--- 
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestDownload.java
+++ 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDownload.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.servicecomb.demo.springmvc.client;
+package org.apache.servicecomb.it.testcase;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
@@ -25,22 +27,19 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.servicecomb.demo.TestMgr;
 import org.apache.servicecomb.foundation.vertx.http.ReadStreamPart;
-import org.apache.servicecomb.provider.pojo.Invoker;
-import org.apache.servicecomb.provider.springmvc.reference.CseRestTemplate;
-import org.springframework.web.client.RestTemplate;
+import org.apache.servicecomb.it.Consumers;
+import org.apache.servicecomb.it.testcase.support.DownloadSchemaIntf;
+import org.junit.Assert;
+import org.junit.Test;
 
 import com.google.common.collect.Iterables;
 
 public class TestDownload {
   private File dir = new File("target/download");
 
-  private DownloadSchemaIntf intf = Invoker.createProxy("springmvc", 
"download", DownloadSchemaIntf.class);
-
-  private RestTemplate restTemplate = new CseRestTemplate();
-
-  private String prefix = "cse://springmvc/download";
+  private static Consumers<DownloadSchemaIntf> consumers = new 
Consumers<>("download",
+      DownloadSchemaIntf.class);
 
   private List<CompletableFuture<?>> futures = new ArrayList<>();
 
@@ -66,6 +65,12 @@ public class TestDownload {
     return checkFuture(future);
   }
 
+  private String getStackTrace(Throwable e) {
+    StringWriter writer = new StringWriter();
+    e.printStackTrace(new PrintWriter(writer));
+    return writer.toString();
+  }
+
   private <T> CompletableFuture<T> checkFuture(CompletableFuture<T> future) {
     Error error = new Error();
     future.whenComplete((result, e) -> {
@@ -78,53 +83,54 @@ public class TestDownload {
         value = new String((byte[]) value);
       }
 
-      TestMgr.check(content, value, error);
+      Assert.assertEquals(getStackTrace(error), content, value);
     });
 
     return future;
   }
 
   private ReadStreamPart templateGet(String methodPath) {
-    return restTemplate
-        .getForObject(prefix + "/" + methodPath + "?content={content}",
+    return consumers.getSCBRestTemplate()
+        .getForObject("/" + methodPath + "?content={content}",
             ReadStreamPart.class,
             content);
   }
 
+  @Test
   @SuppressWarnings("unchecked")
   public void runRest() {
-    futures.add(checkFile(intf.tempFileEntity(content)));
+    futures.add(checkFile(consumers.getIntf().tempFileEntity(content)));
     futures.add(checkFuture(templateGet("tempFileEntity").saveAsBytes()));
 
-    futures.add(checkFile(intf.tempFilePart(content)));
+    futures.add(checkFile(consumers.getIntf().tempFilePart(content)));
     futures.add(checkFuture(templateGet("tempFilePart").saveAsString()));
 
-    futures.add(checkFile(intf.file(content)));
+    futures.add(checkFile(consumers.getIntf().file(content)));
     futures.add(checkFuture(templateGet("file").saveAsString()));
 
     {
-      ReadStreamPart part = intf.chineseAndSpaceFile(content);
-      TestMgr.check("测 试.test.txt", part.getSubmittedFileName());
+      ReadStreamPart part = consumers.getIntf().chineseAndSpaceFile(content);
+      Assert.assertEquals("测 试.test.txt", part.getSubmittedFileName());
       futures.add(checkFile(part));
 
       part = templateGet("chineseAndSpaceFile");
-      TestMgr.check("测 试.test.txt", part.getSubmittedFileName());
+      Assert.assertEquals("测 试.test.txt", part.getSubmittedFileName());
       futures.add(checkFuture(part.saveAsString()));
     }
 
-    futures.add(checkFile(intf.resource(content)));
+    futures.add(checkFile(consumers.getIntf().resource(content)));
     futures.add(checkFuture(templateGet("resource").saveAsString()));
 
-    futures.add(checkFile(intf.entityResource(content)));
+    futures.add(checkFile(consumers.getIntf().entityResource(content)));
     futures.add(checkFuture(templateGet("entityResource").saveAsString()));
 
-    futures.add(checkFile(intf.entityInputStream(content)));
+    futures.add(checkFile(consumers.getIntf().entityInputStream(content)));
     futures.add(checkFuture(templateGet("entityInputStream").saveAsString()));
 
-    futures.add(checkFile(intf.bytes(content)));
+    futures.add(checkFile(consumers.getIntf().bytes(content)));
     futures.add(checkFuture(templateGet("bytes").saveAsString()));
 
-    futures.add(checkFile(intf.netInputStream(content)));
+    futures.add(checkFile(consumers.getIntf().netInputStream(content)));
     futures.add(checkFuture(templateGet("netInputStream").saveAsString()));
 
     try {
@@ -132,7 +138,7 @@ public class TestDownload {
           .allOf(Iterables.toArray((List<CompletableFuture<Object>>) (Object) 
futures, CompletableFuture.class))
           .get();
     } catch (InterruptedException | ExecutionException e1) {
-      TestMgr.failed("test download failed.", e1);
+      Assert.fail("test download failed: " + getStackTrace(e1));
     }
   }
 }
diff --git 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/base/TestDownload.java
 
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/base/TestDownload.java
deleted file mode 100644
index 1c6588d..0000000
--- 
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/base/TestDownload.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.servicecomb.it.testcase.base;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestDownload {
-  //  private static DownloadSchemaIntf intf = Invoker
-  //      .createProxy("it-producer", "download", DownloadSchemaIntf.class);
-
-  static int x;
-
-  @Test
-  public void test1() {
-    x++;
-    System.out.println("test" + x);
-//    intf.tempFileEntity("abc");
-  }
-
-  @Test
-  public void test2() {
-    x++;
-    System.out.println("test2");
-    Assert.assertEquals(x, x + 1);
-  }
-//  private File dir = new File("target/download");
-//
-//
-//  private RestTemplate restTemplate = new CseRestTemplate();
-//
-//  private String prefix = "cse://springmvc/download";
-//
-//  private List<CompletableFuture<?>> futures = new ArrayList<>();
-//
-//  private String content = "file content";
-//
-//  public TestDownload() {
-//    FileUtils.deleteQuietly(dir);
-//  }
-//
-//  private String readFileToString(File file) {
-//    try {
-//      return FileUtils.readFileToString(file);
-//    } catch (IOException e) {
-//      return "read file failed:" + e.getMessage();
-//    }
-//  }
-//
-//  private CompletableFuture<File> checkFile(ReadStreamPart part) {
-//    CompletableFuture<File> future = part.saveToFile("target/download/"
-//        + UUID.randomUUID().toString()
-//        + "-"
-//        + part.getSubmittedFileName());
-//    return checkFuture(future);
-//  }
-//
-//  private <T> CompletableFuture<T> checkFuture(CompletableFuture<T> future) {
-//    Error error = new Error();
-//    future.whenComplete((result, e) -> {
-//      Object value = result;
-//      if (File.class.isInstance(value)) {
-//        File file = (File) value;
-//        value = readFileToString(file);
-//        file.delete();
-//      } else if (byte[].class.isInstance(value)) {
-//        value = new String((byte[]) value);
-//      }
-//
-//      TestMgr.check(content, value, error);
-//    });
-//
-//    return future;
-//  }
-//
-//  private ReadStreamPart templateGet(String methodPath) {
-//    return restTemplate
-//        .getForObject(prefix + "/" + methodPath + "?content={content}",
-//            ReadStreamPart.class,
-//            content);
-//  }
-//
-//  public void runRest() {
-//    futures.add(checkFile(intf.tempFileEntity(content)));
-//    futures.add(checkFuture(templateGet("tempFileEntity").saveAsBytes()));
-//
-//    futures.add(checkFile(intf.tempFilePart(content)));
-//    futures.add(checkFuture(templateGet("tempFilePart").saveAsString()));
-//
-//    futures.add(checkFile(intf.file(content)));
-//    futures.add(checkFuture(templateGet("file").saveAsString()));
-//
-//    {
-//      ReadStreamPart part = intf.chineseAndSpaceFile(content);
-//      TestMgr.check("测 试.test.txt", part.getSubmittedFileName());
-//      futures.add(checkFile(part));
-//
-//      part = templateGet("chineseAndSpaceFile");
-//      TestMgr.check("测 试.test.txt", part.getSubmittedFileName());
-//      futures.add(checkFuture(part.saveAsString()));
-//    }
-//
-//    futures.add(checkFile(intf.resource(content)));
-//    futures.add(checkFuture(templateGet("resource").saveAsString()));
-//
-//    futures.add(checkFile(intf.entityResource(content)));
-//    futures.add(checkFuture(templateGet("entityResource").saveAsString()));
-//
-//    futures.add(checkFile(intf.entityInputStream(content)));
-//    
futures.add(checkFuture(templateGet("entityInputStream").saveAsString()));
-//
-//    futures.add(checkFile(intf.bytes(content)));
-//    futures.add(checkFuture(templateGet("bytes").saveAsString()));
-//
-//    futures.add(checkFile(intf.netInputStream(content)));
-//    futures.add(checkFuture(templateGet("netInputStream").saveAsString()));
-//
-//    try {
-//      CompletableFuture
-//          .allOf(futures.toArray(new CompletableFuture[futures.size()]))
-//          .get();
-//    } catch (InterruptedException | ExecutionException e1) {
-//      TestMgr.failed("test download failed.", e1);
-//    }
-//  }
-}
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 651caac..89a5d1a 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
@@ -49,7 +49,7 @@ import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 
 @RestSchema(schemaId = "download")
-@RequestMapping(path = "/base/v1//download")
+@RequestMapping(path = "/v1/download")
 public class DownloadSchema implements BootListener {
   File tempDir = new File("target/downloadTemp");
 

Reply via email to