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:24:00 UTC

[incubator-servicecomb-java-chassis] 04/06: [SCB-928] add IT for collection format

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 03731efa999d685aa61129d9d2c252339ac6bb4f
Author: yaohaishi <ya...@huawei.com>
AuthorDate: Fri Oct 12 11:11:36 2018 +0800

    [SCB-928] add IT for collection format
---
 .../servicecomb/it/schema/ApiParamJaxrsSchema.java |   7 +
 .../it/schema/ApiParamSpringmvcSchema.java         |  12 +-
 .../servicecomb/it/testcase/TestApiParam.java      |  21 +-
 .../it/testcase/TestDataTypePrimitive.java         | 240 ++++++++++++++++++---
 .../servicecomb/it/schema/DataTypeJaxrsSchema.java |  41 ++++
 .../it/schema/DataTypeSpringmvcSchema.java         |  36 +++-
 6 files changed, 325 insertions(+), 32 deletions(-)

diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamJaxrsSchema.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamJaxrsSchema.java
index f5b8143..fe83aa5 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamJaxrsSchema.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamJaxrsSchema.java
@@ -43,6 +43,13 @@ public class ApiParamJaxrsSchema {
   }
 
   @POST
+  @Path("/queryArr")
+  public void queryArr(@ApiParam(value = "desc of queryArr param")
+  @QueryParam("input") String[] input) {
+
+  }
+
+  @POST
   @Path("/header")
   public void header(@ApiParam(value = "desc of header param") @HeaderParam("input") int input) {
 
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamSpringmvcSchema.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamSpringmvcSchema.java
index 8cd6e54..b52f9f4 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamSpringmvcSchema.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/ApiParamSpringmvcSchema.java
@@ -47,8 +47,18 @@ public class ApiParamSpringmvcSchema {
       readOnly = true,
       allowEmptyValue = true,
       name = "inputEx",
+      example = "10") int input) {
+
+  }
+
+  @PostMapping(path = "/queryArr")
+  public void queryArr(@ApiParam(value = "desc of queryArr param",
+      required = true,
+      readOnly = true,
+      allowEmptyValue = true,
+      name = "inputEx",
       example = "10",
-      collectionFormat = "fmt") int input) {
+      collectionFormat = "csv") int[] inputArr) {
 
   }
 
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestApiParam.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestApiParam.java
index f3e120c..08dd414 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestApiParam.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestApiParam.java
@@ -65,6 +65,13 @@ public class TestApiParam {
   }
 
   @Test
+  public void jaxrsQueryArray() {
+    check("apiParamJaxrs", "queryArr", "query");
+
+    Assert.assertEquals("multi", ((QueryParameter) parameter).getCollectionFormat());
+  }
+
+  @Test
   public void jaxrsHeader() {
     check("apiParamJaxrs", "header");
   }
@@ -98,7 +105,19 @@ public class TestApiParam {
     Assert.assertTrue(parameter.getAllowEmptyValue());
     Assert.assertEquals("inputEx", parameter.getName());
     Assert.assertEquals(10L, ((QueryParameter) parameter).getExample());
-    Assert.assertEquals("fmt", ((QueryParameter) parameter).getCollectionFormat());
+    Assert.assertNull(((QueryParameter) parameter).getCollectionFormat());
+  }
+
+  @Test
+  public void springmvcQueryArray() {
+    check("apiParamSpringmvc", "queryArr", "query");
+
+    Assert.assertTrue(parameter.getRequired());
+    Assert.assertTrue(parameter.isReadOnly());
+    Assert.assertTrue(parameter.getAllowEmptyValue());
+    Assert.assertEquals("inputEx", parameter.getName());
+    Assert.assertEquals("10", ((QueryParameter) parameter).getExample());
+    Assert.assertEquals("csv", ((QueryParameter) parameter).getCollectionFormat());
   }
 
   @Test
diff --git a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
index bf0d693..54c6285 100644
--- a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
+++ b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestDataTypePrimitive.java
@@ -115,6 +115,19 @@ public class TestDataTypePrimitive {
 
     // enum
     Color enumBody(Color color);
+
+    // query array
+    String queryArr(String[] queryArr);
+
+    String queryArrCSV(String[] queryArr);
+
+    String queryArrSSV(String[] queryArr);
+
+    String queryArrTSV(String[] queryArr);
+
+    String queryArrPIPES(String[] queryArr);
+
+    String queryArrMULTI(String[] queryArr);
   }
 
   private static Consumers<DataTypePojoIntf> consumersPojo = new Consumers<>("dataTypePojo", DataTypePojoIntf.class);
@@ -156,7 +169,6 @@ public class TestDataTypePrimitive {
         0.0);
   }
 
-
   @Test
   public void string_pojo_rt() {
     String expect = "serviceComb";
@@ -329,7 +341,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("input", "10");
 
-    HttpEntity<?> entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<Integer> response = consumers.getSCBRestTemplate()
         .exchange("/intHeader",
             HttpMethod.GET,
@@ -342,8 +354,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("input", "10.2");
 
-    @SuppressWarnings("rawtypes")
-    HttpEntity entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<Double> response = consumers.getSCBRestTemplate()
         .exchange("/doubleHeader",
             HttpMethod.GET,
@@ -362,7 +373,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("input", expect);
 
-    HttpEntity<?> entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<String> response = consumers.getSCBRestTemplate()
         .exchange("/stringHeader",
             HttpMethod.GET,
@@ -401,7 +412,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("Cookie", "input=10");
 
-    HttpEntity<?> entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<Integer> response = consumers.getSCBRestTemplate()
         .exchange("/intCookie",
             HttpMethod.GET,
@@ -414,8 +425,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("Cookie", "input=10.2");
 
-    @SuppressWarnings("rawtypes")
-    HttpEntity entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<Double> response = consumers.getSCBRestTemplate()
         .exchange("/doubleCookie",
             HttpMethod.GET,
@@ -434,7 +444,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("Cookie", "input=" + expect);
 
-    HttpEntity<?> entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<String> response = consumers.getSCBRestTemplate()
         .exchange("/stringCookie",
             HttpMethod.GET,
@@ -463,10 +473,10 @@ public class TestDataTypePrimitive {
   public void intForm_jaxrs_rt() {
     Map<String, Integer> map = new HashMap<>();
     map.put("input", 10);
-    HttpEntity<Map<String, Integer>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, Integer>> formEntity = new HttpEntity<>(map);
 
     assertEquals(10,
-        (int) consumersJaxrs.getSCBRestTemplate().postForEntity("/intForm", formEntiry, int.class).getBody());
+        (int) consumersJaxrs.getSCBRestTemplate().postForEntity("/intForm", formEntity, int.class).getBody());
     //just use map is ok
     assertEquals(10,
         (int) consumersJaxrs.getSCBRestTemplate().postForEntity("/intForm", map, int.class).getBody());
@@ -476,10 +486,10 @@ public class TestDataTypePrimitive {
   public void doubleForm_jaxrs_rt() {
     Map<String, Double> map = new HashMap<>();
     map.put("input", 10.2);
-    HttpEntity<Map<String, Double>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, Double>> formEntity = new HttpEntity<>(map);
 
     assertEquals(10.2,
-        consumersJaxrs.getSCBRestTemplate().postForEntity("/doubleForm", formEntiry, double.class).getBody(),
+        consumersJaxrs.getSCBRestTemplate().postForEntity("/doubleForm", formEntity, double.class).getBody(),
         0.0);
     //just use map is ok
     assertEquals(10.2,
@@ -491,11 +501,11 @@ public class TestDataTypePrimitive {
     String expect = "serviceComb";
     Map<String, String> map = new HashMap<>();
     map.put("input", expect);
-    HttpEntity<Map<String, String>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, String>> formEntity = new HttpEntity<>(map);
 
     assertEquals(expect,
         consumersJaxrs.getSCBRestTemplate()
-            .postForEntity("/stringForm", formEntiry, String.class)
+            .postForEntity("/stringForm", formEntity, String.class)
             .getBody());
 
     //you can use another method to invoke it
@@ -742,20 +752,20 @@ public class TestDataTypePrimitive {
   public void intForm_springmvc_rt() {
     Map<String, Integer> map = new HashMap<>();
     map.put("input", 10);
-    HttpEntity<Map<String, Integer>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, Integer>> formEntity = new HttpEntity<>(map);
 
     assertEquals(10,
-        (int) consumersSpringmvc.getSCBRestTemplate().postForEntity("/intForm", formEntiry, int.class).getBody());
+        (int) consumersSpringmvc.getSCBRestTemplate().postForEntity("/intForm", formEntity, int.class).getBody());
   }
 
   @Test
   public void doubleForm_springmvc_rt() {
     Map<String, Double> map = new HashMap<>();
     map.put("input", 10.2);
-    HttpEntity<Map<String, Double>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, Double>> formEntity = new HttpEntity<>(map);
 
     assertEquals(10.2,
-        consumersSpringmvc.getSCBRestTemplate().postForEntity("/doubleForm", formEntiry, double.class)
+        consumersSpringmvc.getSCBRestTemplate().postForEntity("/doubleForm", formEntity, double.class)
             .getBody(), 0.0);
   }
 
@@ -764,10 +774,10 @@ public class TestDataTypePrimitive {
     String expect = "serviceComb";
     Map<String, String> map = new HashMap<>();
     map.put("input", expect);
-    HttpEntity<Map<String, String>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, String>> formEntity = new HttpEntity<>(map);
 
     assertEquals(expect,
-        consumersSpringmvc.getSCBRestTemplate().postForEntity("/stringForm", formEntiry, String.class)
+        consumersSpringmvc.getSCBRestTemplate().postForEntity("/stringForm", formEntity, String.class)
             .getBody());
 
     assertEquals(expect,
@@ -906,8 +916,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("input", "10.2f");
 
-    @SuppressWarnings("rawtypes")
-    HttpEntity entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<Float> response = consumers.getSCBRestTemplate()
         .exchange("/floatHeader",
             HttpMethod.GET,
@@ -930,8 +939,7 @@ public class TestDataTypePrimitive {
     HttpHeaders headers = new HttpHeaders();
     headers.add("Cookie", "input=10.2f");
 
-    @SuppressWarnings("rawtypes")
-    HttpEntity entity = new HttpEntity<>(null, headers);
+    HttpEntity<?> entity = new HttpEntity<>(headers);
     ResponseEntity<Float> response = consumers.getSCBRestTemplate()
         .exchange("/floatCookie",
             HttpMethod.GET,
@@ -949,10 +957,10 @@ public class TestDataTypePrimitive {
   public void floatForm_jaxrs_rt() {
     Map<String, Float> map = new HashMap<>();
     map.put("input", 10.2f);
-    HttpEntity<Map<String, Float>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, Float>> formEntity = new HttpEntity<>(map);
 
     assertEquals(10.2f,
-        consumersJaxrs.getSCBRestTemplate().postForEntity("/floatForm", formEntiry, float.class).getBody(),
+        consumersJaxrs.getSCBRestTemplate().postForEntity("/floatForm", formEntity, float.class).getBody(),
         0.0f);
     //just use map is ok
     assertEquals(10.2f,
@@ -1032,10 +1040,10 @@ public class TestDataTypePrimitive {
   public void floatForm_springmvc_rt() {
     Map<String, Float> map = new HashMap<>();
     map.put("input", 10.2f);
-    HttpEntity<Map<String, Float>> formEntiry = new HttpEntity<>(map);
+    HttpEntity<Map<String, Float>> formEntity = new HttpEntity<>(map);
 
     assertEquals(10.2f,
-        consumersSpringmvc.getSCBRestTemplate().postForEntity("/floatForm", formEntiry, float.class)
+        consumersSpringmvc.getSCBRestTemplate().postForEntity("/floatForm", formEntity, float.class)
             .getBody(), 0.0f);
   }
 
@@ -1072,4 +1080,178 @@ public class TestDataTypePrimitive {
     assertEquals(Color.BLUE,
         consumersSpringmvc.getSCBRestTemplate().postForObject("/enumBody", Color.BLUE, Color.class));
   }
+
+  // query array
+  @Test
+  public void queryArr_springmvc_intf() {
+    // default
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getIntf().queryArr(new String[] {"a", "b", "c"}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getIntf().queryArr(new String[] {"a", "", " ", "b", "c"}));
+    // CSV
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getIntf().queryArrCSV(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersSpringmvc.getIntf().queryArrCSV(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getIntf().queryArrCSV(new String[] {"a", "", " ", "b", "c"}));
+    // SSV
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getIntf().queryArrSSV(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersSpringmvc.getIntf().queryArrSSV(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    // TSV
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getIntf().queryArrTSV(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersSpringmvc.getIntf().queryArrTSV(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getIntf().queryArrTSV(new String[] {"a", "", " ", "b", "c"}));
+    // PIPES
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getIntf().queryArrPIPES(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersSpringmvc.getIntf()
+            .queryArrPIPES(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getIntf().queryArrPIPES(new String[] {"a", "", " ", "b", "c"}));
+    // MULTI
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getIntf().queryArrMULTI(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersSpringmvc.getIntf()
+            .queryArrMULTI(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getIntf().queryArrMULTI(new String[] {"a", "", " ", "b", "c"}));
+  }
+
+  @Test
+  public void queryArr_springmvc_rt() {
+    // default
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArr?queryArr=a&queryArr=b&queryArr=c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArr?queryArr=a&queryArr=&queryArr= &queryArr=b&queryArr=c", String.class));
+    // csv
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrCSV?queryArr=a,b,c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrCSV?queryArr=a,, ,b,c", String.class));
+    // ssv
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrSSV?queryArr=a b c", String.class));
+    // tsv
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrTSV?queryArr=a\tb\tc", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrTSV?queryArr=a\t\t \tb\tc", String.class));
+    // pipes
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrPIPES?queryArr=a|b|c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrPIPES?queryArr=a|| |b|c", String.class));
+    // multi
+    assertEquals("[a, b, c]3",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrMULTI?queryArr=a&queryArr=b&queryArr=c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersSpringmvc.getSCBRestTemplate()
+            .getForObject("/queryArrMULTI?queryArr=a&queryArr=&queryArr= &queryArr=b&queryArr=c", String.class));
+  }
+
+  @Test
+  public void queryArr_jaxrs_intf() {
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getIntf().queryArr(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersJaxrs.getIntf().queryArr(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getIntf().queryArr(new String[] {"a", "", " ", "b", "c"}));
+
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getIntf().queryArrCSV(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersJaxrs.getIntf().queryArrCSV(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getIntf().queryArrCSV(new String[] {"a", "", " ", "b", "c"}));
+
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getIntf().queryArrSSV(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersJaxrs.getIntf().queryArrSSV(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getIntf().queryArrTSV(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersJaxrs.getIntf().queryArrTSV(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getIntf().queryArrTSV(new String[] {"a", "", " ", "b", "c"}));
+
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getIntf().queryArrPIPES(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersJaxrs.getIntf().queryArrPIPES(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getIntf().queryArrPIPES(new String[] {"a", "", " ", "b", "c"}));
+
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getIntf().queryArrMULTI(new String[] {"a", "b", "c"}));
+    assertEquals("[a, b, , c]4",
+        consumersJaxrs.getIntf().queryArrMULTI(new String[] {null, "a", null, null, "b", null, "", null, "c", null}));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getIntf().queryArrMULTI(new String[] {"a", "", " ", "b", "c"}));
+  }
+
+  @Test
+  public void queryArr_jaxrs_rt() {
+    // default
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArr?queryArr=a&queryArr=b&queryArr=c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArr?queryArr=a&queryArr=&queryArr= &queryArr=b&queryArr=c", String.class));
+    // csv
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrCSV?queryArr=a,b,c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrCSV?queryArr=a,, ,b,c", String.class));
+    // ssv
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrSSV?queryArr=a b c", String.class));
+    // tsv
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrTSV?queryArr=a\tb\tc", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrTSV?queryArr=a\t\t \tb\tc", String.class));
+    // pipes
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrPIPES?queryArr=a|b|c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrPIPES?queryArr=a|| |b|c", String.class));
+    // multi
+    assertEquals("[a, b, c]3",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrMULTI?queryArr=a&queryArr=b&queryArr=c", String.class));
+    assertEquals("[a, ,  , b, c]5",
+        consumersJaxrs.getSCBRestTemplate()
+            .getForObject("/queryArrMULTI?queryArr=a&queryArr=&queryArr= &queryArr=b&queryArr=c", String.class));
+  }
 }
diff --git a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeJaxrsSchema.java b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeJaxrsSchema.java
index e36aca3..032a94b 100644
--- a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeJaxrsSchema.java
+++ b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeJaxrsSchema.java
@@ -16,6 +16,8 @@
  */
 package org.apache.servicecomb.it.schema;
 
+import java.util.Arrays;
+
 import javax.ws.rs.CookieParam;
 import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
@@ -28,6 +30,8 @@ import javax.ws.rs.QueryParam;
 import org.apache.servicecomb.foundation.test.scaffolding.model.Color;
 import org.apache.servicecomb.provider.rest.common.RestSchema;
 
+import io.swagger.annotations.ApiParam;
+
 @RestSchema(schemaId = "dataTypeJaxrs")
 @Path("/v1/dataTypeJaxrs")
 public class DataTypeJaxrsSchema {
@@ -207,4 +211,41 @@ public class DataTypeJaxrsSchema {
   public Color enumBody(Color color) {
     return color;
   }
+
+  // query array
+  @Path("queryArr")
+  @GET
+  public String queryArr(@QueryParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @Path("queryArrCSV")
+  @GET
+  public String queryArrCSV(@ApiParam(collectionFormat = "csv") @QueryParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @Path("queryArrSSV")
+  @GET
+  public String queryArrSSV(@ApiParam(collectionFormat = "ssv") @QueryParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @Path("queryArrTSV")
+  @GET
+  public String queryArrTSV(@ApiParam(collectionFormat = "tsv") @QueryParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @Path("queryArrPIPES")
+  @GET
+  public String queryArrPIPES(@ApiParam(collectionFormat = "pipes") @QueryParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @Path("queryArrMULTI")
+  @GET
+  public String queryArrMULTI(@ApiParam(collectionFormat = "multi") @QueryParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
 }
diff --git a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeSpringmvcSchema.java b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeSpringmvcSchema.java
index af72afb..7c800b0 100644
--- a/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeSpringmvcSchema.java
+++ b/integration-tests/it-producer/src/main/java/org/apache/servicecomb/it/schema/DataTypeSpringmvcSchema.java
@@ -16,6 +16,8 @@
  */
 package org.apache.servicecomb.it.schema;
 
+import java.util.Arrays;
+
 import org.apache.servicecomb.foundation.test.scaffolding.model.Color;
 import org.apache.servicecomb.provider.rest.common.RestSchema;
 import org.springframework.web.bind.annotation.CookieValue;
@@ -28,6 +30,8 @@ import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import io.swagger.annotations.ApiParam;
+
 @RestSchema(schemaId = "dataTypeSpringmvc")
 @RequestMapping(path = "/v1/dataTypeSpringmvc")
 public class DataTypeSpringmvcSchema {
@@ -98,7 +102,6 @@ public class DataTypeSpringmvcSchema {
     return input;
   }
 
-
   @GetMapping(path = "stringConcat")
   public String stringConcat(String str1, String str2) {
     return str1 + str2;
@@ -180,4 +183,35 @@ public class DataTypeSpringmvcSchema {
   public Color enumBody(@RequestBody Color color) {
     return color;
   }
+
+  // query array
+  @GetMapping("queryArr")
+  public String queryArr(@RequestParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @GetMapping("queryArrCSV")
+  public String queryArrCSV(@ApiParam(collectionFormat = "csv") @RequestParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @GetMapping("queryArrSSV")
+  public String queryArrSSV(@ApiParam(collectionFormat = "ssv") @RequestParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @GetMapping("queryArrTSV")
+  public String queryArrTSV(@ApiParam(collectionFormat = "tsv") @RequestParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @GetMapping("queryArrPIPES")
+  public String queryArrPIPES(@ApiParam(collectionFormat = "pipes") @RequestParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
+
+  @GetMapping("queryArrMULTI")
+  public String queryArrMULTI(@ApiParam(collectionFormat = "multi") @RequestParam("queryArr") String[] queryArr) {
+    return Arrays.toString(queryArr) + queryArr.length;
+  }
 }