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/08/01 09:53:41 UTC

[incubator-servicecomb-java-chassis] 05/06: [SCB-777] add IT for BeanParam

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 90d0a71b8bff485458ca8d7c834c4281b818ecbc
Author: yaohaishi <ya...@huawei.com>
AuthorDate: Sun Jul 29 18:32:54 2018 +0800

    [SCB-777] add IT for BeanParam
---
 demo/demo-jaxrs/jaxrs-client/pom.xml               |  4 +
 .../servicecomb/demo/jaxrs/client/JaxrsClient.java | 18 +++--
 .../client/beanParam/BeanParamPojoClient.java      | 57 ++++++++++++++
 .../beanParam/BeanParamRestTemplateClient.java     | 84 +++++++++++++++++++++
 .../client/beanParam/BeanParamTestServiceIntf.java | 27 +++++++
 .../server/beanParam/BeanParamTestService.java     | 73 ++++++++++++++++++
 .../jaxrs/server/beanParam/TestBeanParameter.java  | 87 ++++++++++++++++++++++
 .../beanParam/TestBeanParameterWithUpload.java     | 68 +++++++++++++++++
 8 files changed, 412 insertions(+), 6 deletions(-)

diff --git a/demo/demo-jaxrs/jaxrs-client/pom.xml b/demo/demo-jaxrs/jaxrs-client/pom.xml
index 0ff0c56..947cc33 100644
--- a/demo/demo-jaxrs/jaxrs-client/pom.xml
+++ b/demo/demo-jaxrs/jaxrs-client/pom.xml
@@ -41,6 +41,10 @@
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>provider-springmvc</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>provider-pojo</artifactId>
+    </dependency>
   </dependencies>
 
   <properties>
diff --git a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/JaxrsClient.java b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/JaxrsClient.java
index b123119..a2b129b 100644
--- a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/JaxrsClient.java
+++ b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/JaxrsClient.java
@@ -32,6 +32,8 @@ import org.apache.servicecomb.demo.DemoConst;
 import org.apache.servicecomb.demo.RestObjectMapperWithStringMapper;
 import org.apache.servicecomb.demo.TestMgr;
 import org.apache.servicecomb.demo.compute.Person;
+import org.apache.servicecomb.demo.jaxrs.client.beanParam.BeanParamPojoClient;
+import org.apache.servicecomb.demo.jaxrs.client.beanParam.BeanParamRestTemplateClient;
 import org.apache.servicecomb.demo.validator.Student;
 import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
@@ -71,6 +73,11 @@ public class JaxrsClient {
     testClientTimeOut(templateNew);
     testJaxRSDefaultValues(templateNew);
     MultiErrorCodeServiceClient.runTest();
+
+    BeanParamPojoClient beanParamPojoClient = new BeanParamPojoClient();
+    beanParamPojoClient.testAll();
+    BeanParamRestTemplateClient beanParamRestTemplateClient = new BeanParamRestTemplateClient();
+    beanParamRestTemplateClient.testAll();
   }
 
   private static void testCompute(RestTemplate template) throws Exception {
@@ -90,7 +97,7 @@ public class JaxrsClient {
     }
   }
 
-  private static void testValidator(RestTemplate template) throws Exception {
+  private static void testValidator(RestTemplate template) {
     String microserviceName = "jaxrs";
     for (String transport : DemoConst.transports) {
       CseContext.getInstance().getConsumerProviderManager().setTransport(microserviceName, transport);
@@ -119,8 +126,8 @@ public class JaxrsClient {
       //default values
       HttpHeaders headers = new HttpHeaders();
       headers.setContentType(org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED);
-      MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
-      HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);
+      MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
+      HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
       String result = template.postForObject(cseUrlPrefix + "/form", request, String.class);
       TestMgr.check("Hello 20bobo", result);
 
@@ -175,7 +182,7 @@ public class JaxrsClient {
       //input values
       headers = new HttpHeaders();
       headers.setContentType(org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED);
-      Map<String, String> params = new HashMap<String, String>();
+      Map<String, String> params = new HashMap<>();
       params.put("a", "30");
       params.put("b", "sam");
       HttpEntity<Map<String, String>> requestPara = new HttpEntity<>(params, headers);
@@ -196,7 +203,6 @@ public class JaxrsClient {
       result = template.getForObject(cseUrlPrefix + "/query2?a=3&b=4&c=5&d=30&e=2", String.class);
       TestMgr.check("Hello 345302", result);
     }
-
   }
 
 
@@ -361,7 +367,7 @@ public class JaxrsClient {
     TestMgr.check("hello test 15", result);
   }
 
-  private static void testClientTimeOut(RestTemplate template) throws Exception {
+  private static void testClientTimeOut(RestTemplate template) {
     String microserviceName = "jaxrs";
     for (String transport : DemoConst.transports) {
       if (transport.equals(Const.ANY_TRANSPORT)) {
diff --git a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamPojoClient.java b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamPojoClient.java
new file mode 100644
index 0000000..fe15bda
--- /dev/null
+++ b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamPojoClient.java
@@ -0,0 +1,57 @@
+/*
+ * 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.jaxrs.client.beanParam;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.provider.pojo.Invoker;
+
+public class BeanParamPojoClient {
+  BeanParamTestServiceIntf beanParamTestServiceIntf;
+
+  public BeanParamPojoClient() {
+    beanParamTestServiceIntf = Invoker.createProxy("jaxrs", "beanParamTest", BeanParamTestServiceIntf.class);
+  }
+
+  public void testAll() {
+    testBeanParam();
+    testUpload();
+  }
+
+  public void testBeanParam() {
+    String result = beanParamTestServiceIntf.beanParameterTest("querySwaggerValue", 10, 2, "pathSwaggerValue", "extra");
+    TestMgr.check(
+        "invocationContextConsistency=true|testBeanParameter=TestBeanParameter{queryStr='querySwaggerValue', headerInt=2, "
+            + "pathStr='pathSwaggerValue', cookieLong=10}|extraQuery=extra",
+        result);
+  }
+
+  public void testUpload() {
+    BufferedInputStream bufferedInputStream0 = new BufferedInputStream(new ByteArrayInputStream("up0".getBytes()));
+    BufferedInputStream bufferedInputStream1 = new BufferedInputStream(new ByteArrayInputStream("up1".getBytes()));
+    BufferedInputStream bufferedInputStream2 = new BufferedInputStream(new ByteArrayInputStream("up2".getBytes()));
+
+    String result = beanParamTestServiceIntf.beanParameterTestUpload(
+        bufferedInputStream0, "queryTest", bufferedInputStream1, bufferedInputStream2, "ex");
+    TestMgr.check(
+        "testBeanParameter=TestBeanParameterWithUpload{queryStr='queryTest'}|extraQuery=ex|up0=up0|up1=up1|up2=up2",
+        result);
+  }
+}
diff --git a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamRestTemplateClient.java b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamRestTemplateClient.java
new file mode 100644
index 0000000..82422d9
--- /dev/null
+++ b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamRestTemplateClient.java
@@ -0,0 +1,84 @@
+/*
+ * 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.jaxrs.client.beanParam;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.provider.springmvc.reference.CseHttpEntity;
+import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
+
+public class BeanParamRestTemplateClient {
+  RestTemplate restTemplate;
+
+  public BeanParamRestTemplateClient() {
+    restTemplate = RestTemplateBuilder.create();
+  }
+
+
+  public void testAll() {
+    testBeanParam();
+    testUpload();
+  }
+
+  public void testBeanParam() {
+    HttpHeaders headers = new HttpHeaders();
+    headers.add("Cookie", "cookieSwaggerLong=11");
+    headers.add("headerSwaggerInt", "2");
+    HttpEntity<Object> requestEntity1 = new CseHttpEntity<>(headers);
+    ResponseEntity<String> result = restTemplate.exchange(
+        "cse://jaxrs/beanParamTest/pathSwaggerValue/simple?querySwaggerStr=querySwaggerValue&extraQuery=extra",
+        HttpMethod.GET,
+        requestEntity1,
+        String.class);
+    TestMgr.check(
+        "invocationContextConsistency=true|testBeanParameter=TestBeanParameter{queryStr='querySwaggerValue', headerInt=2, "
+            + "pathStr='pathSwaggerValue', cookieLong=11}|extraQuery=extra",
+        result.getBody());
+  }
+
+  public void testUpload() {
+    BufferedInputStream bufferedInputStream0 = new BufferedInputStream(new ByteArrayInputStream("up0".getBytes()));
+    BufferedInputStream bufferedInputStream1 = new BufferedInputStream(new ByteArrayInputStream("up1".getBytes()));
+    BufferedInputStream bufferedInputStream2 = new BufferedInputStream(new ByteArrayInputStream("up2".getBytes()));
+
+    HashMap<String, Object> formData = new HashMap<>();
+    formData.put("up0", bufferedInputStream0);
+    formData.put("up1", bufferedInputStream1);
+    formData.put("up2", bufferedInputStream2);
+    HttpHeaders headers = new HttpHeaders();
+    headers.setContentType(MediaType.MULTIPART_FORM_DATA);
+    HttpEntity<Map<String, Object>> entity = new HttpEntity<>(formData, headers);
+
+    String result = restTemplate.postForObject("cse://jaxrs/beanParamTest/upload?query=fromTemplate&extraQuery=ex",
+        entity,
+        String.class);
+    TestMgr.check(
+        "testBeanParameter=TestBeanParameterWithUpload{queryStr='fromTemplate'}|extraQuery=ex|up0=up0|up1=up1|up2=up2",
+        result);
+  }
+}
diff --git a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamTestServiceIntf.java b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamTestServiceIntf.java
new file mode 100644
index 0000000..1d8c602
--- /dev/null
+++ b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/beanParam/BeanParamTestServiceIntf.java
@@ -0,0 +1,27 @@
+/*
+ * 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.jaxrs.client.beanParam;
+
+import java.io.InputStream;
+
+public interface BeanParamTestServiceIntf {
+  String beanParameterTest(String querySwaggerStr, long cookieSwaggerLong, Integer headerSwaggerInt,
+      String pathSwaggerStr, String extraQuery);
+
+  String beanParameterTestUpload(InputStream up0, String query, InputStream up1, InputStream up2, String extraQuery);
+}
diff --git a/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/BeanParamTestService.java b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/BeanParamTestService.java
new file mode 100644
index 0000000..1e2a040
--- /dev/null
+++ b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/BeanParamTestService.java
@@ -0,0 +1,73 @@
+/*
+ * 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.jaxrs.server.beanParam;
+
+import java.io.IOException;
+import java.util.Scanner;
+
+import javax.servlet.http.Part;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
+import org.apache.servicecomb.swagger.invocation.context.InvocationContext;
+
+@RestSchema(schemaId = "beanParamTest")
+@Path("/beanParamTest")
+public class BeanParamTestService {
+  @Path("/{pathSwaggerStr}/simple")
+  @GET
+  public String beanParameterTest(InvocationContext invocationContext, @BeanParam TestBeanParameter testBeanParameter,
+      @QueryParam("extraQuery") String extraQuery) {
+    return String.format("invocationContextConsistency=%b|testBeanParameter=%s|extraQuery=%s",
+        ContextUtils.getInvocationContext() == invocationContext,
+        testBeanParameter.toString(),
+        extraQuery);
+  }
+
+  @Path("/upload")
+  @Consumes(MediaType.MULTIPART_FORM_DATA)
+  @POST
+  public String beanParameterTestUpload(@FormParam("up0") Part up0,
+      @BeanParam TestBeanParameterWithUpload testBeanParameter,
+      @QueryParam("extraQuery") String extraQuery) throws IOException {
+    return String.format("testBeanParameter=%s|extraQuery=%s|up0=%s|up1=%s|up2=%s",
+        testBeanParameter.toString(),
+        extraQuery,
+        getUploadContent(up0),
+        getUploadContent(testBeanParameter.getUp1()),
+        getUploadContent(testBeanParameter.getUp2()));
+  }
+
+  public String getUploadContent(Part upload) throws IOException {
+    StringBuilder result = new StringBuilder();
+    try (Scanner scanner = new Scanner(upload.getInputStream())) {
+      while (scanner.hasNext()) {
+        result.append(scanner.next());
+      }
+    }
+    return result.toString();
+  }
+}
diff --git a/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/TestBeanParameter.java b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/TestBeanParameter.java
new file mode 100644
index 0000000..9e8c319
--- /dev/null
+++ b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/TestBeanParameter.java
@@ -0,0 +1,87 @@
+/*
+ * 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.jaxrs.server.beanParam;
+
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+public class TestBeanParameter {
+  @DefaultValue("defaultQueryValue")
+  @QueryParam("querySwaggerStr")
+  private String queryStr;
+
+  private Integer headerInt;
+
+  private String pathStr;
+
+  @CookieParam("cookieSwaggerLong")
+  private long cookieLong;
+
+  public String getQueryStr() {
+    return queryStr;
+  }
+
+  public TestBeanParameter setQueryStr(String queryStr) {
+    this.queryStr = queryStr;
+    return this;
+  }
+
+  public Integer getHeaderInt() {
+    return headerInt;
+  }
+
+  @DefaultValue("12")
+  @HeaderParam("headerSwaggerInt")
+  public TestBeanParameter setHeaderInt(Integer headerInt) {
+    this.headerInt = headerInt;
+    return this;
+  }
+
+  public String getPathStr() {
+    return pathStr;
+  }
+
+  @PathParam("pathSwaggerStr")
+  public TestBeanParameter setPathStr(String pathStr) {
+    this.pathStr = pathStr;
+    return this;
+  }
+
+  public long getCookieLong() {
+    return cookieLong;
+  }
+
+  public TestBeanParameter setCookieLong(long cookieLong) {
+    this.cookieLong = cookieLong;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder("TestBeanParameter{");
+    sb.append("queryStr='").append(queryStr).append('\'');
+    sb.append(", headerInt=").append(headerInt);
+    sb.append(", pathStr='").append(pathStr).append('\'');
+    sb.append(", cookieLong=").append(cookieLong);
+    sb.append('}');
+    return sb.toString();
+  }
+}
diff --git a/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/TestBeanParameterWithUpload.java b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/TestBeanParameterWithUpload.java
new file mode 100644
index 0000000..fdef568
--- /dev/null
+++ b/demo/demo-jaxrs/jaxrs-server/src/main/java/org/apache/servicecomb/demo/jaxrs/server/beanParam/TestBeanParameterWithUpload.java
@@ -0,0 +1,68 @@
+/*
+ * 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.jaxrs.server.beanParam;
+
+import javax.servlet.http.Part;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.QueryParam;
+
+public class TestBeanParameterWithUpload {
+  @QueryParam("query")
+  private String queryStr;
+
+  @FormParam("up1")
+  private Part up1;
+
+  private Part up2;
+
+  public String getQueryStr() {
+    return queryStr;
+  }
+
+  public TestBeanParameterWithUpload setQueryStr(String queryStr) {
+    this.queryStr = queryStr;
+    return this;
+  }
+
+  public Part getUp1() {
+    return up1;
+  }
+
+  public TestBeanParameterWithUpload setUp1(Part up1) {
+    this.up1 = up1;
+    return this;
+  }
+
+  public Part getUp2() {
+    return up2;
+  }
+
+  @FormParam("up2")
+  public TestBeanParameterWithUpload setUp2(Part up2) {
+    this.up2 = up2;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder("TestBeanParameterWithUpload{");
+    sb.append("queryStr='").append(queryStr).append('\'');
+    sb.append('}');
+    return sb.toString();
+  }
+}