update java petstore sample, reenable test for resttemplate-withxml

This commit is contained in:
wing328
2017-08-03 17:09:38 +08:00
parent b4e0854823
commit 7aee5b6ee7
486 changed files with 810 additions and 629 deletions

View File

@@ -833,7 +833,8 @@
<module>samples/client/petstore/java/retrofit2rx</module>
<module>samples/client/petstore/jaxrs-cxf-client</module>
<module>samples/client/petstore/java/resttemplate</module>
<!--<module>samples/client/petstore/java/resttemplate-withXml</module>-->
<module>samples/client/petstore/java/resttemplate-withXml</module>
<module>samples/client/petstore/java/vertx</module>
<module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/kotlin/</module>
<!-- comment out bash as it's failing after switching to CircleCI

View File

@@ -45,6 +45,8 @@ public class ApiClient {
RequestInterceptor auth;
if ("api_key".equals(authName)) {
auth = new ApiKeyAuth("header", "api_key");
} else if ("api_key_query".equals(authName)) {
auth = new ApiKeyAuth("query", "api_key_query");
} else if ("http_basic_test".equals(authName)) {
auth = new HttpBasicAuth();
} else if ("petstore_auth".equals(authName)) {

View File

@@ -127,6 +127,6 @@ public class AdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -115,6 +115,6 @@ public class Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -60,6 +60,6 @@ public class AnimalFarm extends ArrayList<Animal> {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -96,6 +96,6 @@ public class ArrayOfArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -96,6 +96,6 @@ public class ArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -158,6 +158,6 @@ public class ArrayTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -200,6 +200,6 @@ public class Capitalization {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -87,6 +87,6 @@ public class Cat extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -108,6 +108,6 @@ public class Category {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class ClassModel {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -85,6 +85,6 @@ public class Client {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -87,6 +87,6 @@ public class Dog extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -188,6 +188,6 @@ public class EnumArrays {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -262,6 +262,6 @@ public class EnumTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -375,6 +375,6 @@ public class FormatTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -90,6 +90,6 @@ public class HasOnlyReadOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -162,6 +162,6 @@ public class MapTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -145,6 +145,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -109,6 +109,6 @@ public class Model200Response {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -131,6 +131,6 @@ public class ModelApiResponse {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class ModelReturn {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -137,6 +137,6 @@ public class Name {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class NumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -238,6 +238,6 @@ public class Order {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -132,6 +132,6 @@ public class OuterComposite {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -254,6 +254,6 @@ public class Pet {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -99,6 +99,6 @@ public class ReadOnlyFirst {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -85,6 +85,6 @@ public class SpecialModelName {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -108,6 +108,6 @@ public class Tag {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -246,6 +246,6 @@ public class User {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -661,8 +661,9 @@ public class ApiClient {
response = builder.type(contentType).delete(ClientResponse.class, serialize(body, contentType, formParams));
} else if ("PATCH".equals(method)) {
response = builder.type(contentType).header("X-HTTP-Method-Override", "PATCH").post(ClientResponse.class, serialize(body, contentType, formParams));
}
else {
} else if ("HEAD".equals(method)) {
response = builder.head();
} else {
throw new ApiException(500, "unknown method type " + method);
}
return response;

View File

@@ -127,6 +127,6 @@ public class AdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -115,6 +115,6 @@ public class Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -60,6 +60,6 @@ public class AnimalFarm extends ArrayList<Animal> {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -96,6 +96,6 @@ public class ArrayOfArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -96,6 +96,6 @@ public class ArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -158,6 +158,6 @@ public class ArrayTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -200,6 +200,6 @@ public class Capitalization {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -87,6 +87,6 @@ public class Cat extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -108,6 +108,6 @@ public class Category {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class ClassModel {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -85,6 +85,6 @@ public class Client {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -87,6 +87,6 @@ public class Dog extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -188,6 +188,6 @@ public class EnumArrays {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -262,6 +262,6 @@ public class EnumTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -375,6 +375,6 @@ public class FormatTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -90,6 +90,6 @@ public class HasOnlyReadOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -162,6 +162,6 @@ public class MapTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -145,6 +145,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -109,6 +109,6 @@ public class Model200Response {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -131,6 +131,6 @@ public class ModelApiResponse {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class ModelReturn {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -137,6 +137,6 @@ public class Name {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class NumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -238,6 +238,6 @@ public class Order {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -132,6 +132,6 @@ public class OuterComposite {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -254,6 +254,6 @@ public class Pet {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -99,6 +99,6 @@ public class ReadOnlyFirst {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -85,6 +85,6 @@ public class SpecialModelName {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -108,6 +108,6 @@ public class Tag {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -246,6 +246,6 @@ public class User {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -626,7 +626,7 @@ public class ApiClient {
*
* @param <T> Type
* @param path The sub-path of the HTTP URL
* @param method The request method, one of "GET", "POST", "PUT", and "DELETE"
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
* @param queryParams The query parameters
* @param body The request body object
* @param headerParams The header parameters
@@ -687,6 +687,8 @@ public class ApiClient {
response = invocationBuilder.delete();
} else if ("PATCH".equals(method)) {
response = invocationBuilder.method("PATCH", entity);
} else if ("HEAD".equals(method)) {
response = invocationBuilder.head();
} else {
throw new ApiException(500, "unknown method type " + method);
}

View File

@@ -127,6 +127,6 @@ public class AdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -115,6 +115,6 @@ public class Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -60,6 +60,6 @@ public class AnimalFarm extends ArrayList<Animal> {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -96,6 +96,6 @@ public class ArrayOfArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -96,6 +96,6 @@ public class ArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -158,6 +158,6 @@ public class ArrayTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -200,6 +200,6 @@ public class Capitalization {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -87,6 +87,6 @@ public class Cat extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -108,6 +108,6 @@ public class Category {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class ClassModel {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -85,6 +85,6 @@ public class Client {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -87,6 +87,6 @@ public class Dog extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -188,6 +188,6 @@ public class EnumArrays {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -262,6 +262,6 @@ public class EnumTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -375,6 +375,6 @@ public class FormatTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -90,6 +90,6 @@ public class HasOnlyReadOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -162,6 +162,6 @@ public class MapTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -145,6 +145,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -109,6 +109,6 @@ public class Model200Response {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -131,6 +131,6 @@ public class ModelApiResponse {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class ModelReturn {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -137,6 +137,6 @@ public class Name {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -86,6 +86,6 @@ public class NumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -238,6 +238,6 @@ public class Order {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -132,6 +132,6 @@ public class OuterComposite {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -254,6 +254,6 @@ public class Pet {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -99,6 +99,6 @@ public class ReadOnlyFirst {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -85,6 +85,6 @@ public class SpecialModelName {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -108,6 +108,6 @@ public class Tag {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -246,6 +246,6 @@ public class User {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -16,9 +16,19 @@ To test class name in snake case
### Example
```java
// Import classes:
//import io.swagger.client.ApiClient;
//import io.swagger.client.ApiException;
//import io.swagger.client.Configuration;
//import io.swagger.client.auth.*;
//import io.swagger.client.api.FakeClassnameTags123Api;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: api_key_query
ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query");
api_key_query.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key_query.setApiKeyPrefix("Token");
FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api();
Client body = new Client(); // Client | client model
@@ -43,7 +53,7 @@ Name | Type | Description | Notes
### Authorization
No authorization required
[api_key_query](../README.md#api_key_query)
### HTTP request headers

View File

@@ -13,6 +13,7 @@ import javax.ws.rs.core.Response.Status;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
@@ -79,6 +80,7 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query"));
authentications.put("http_basic_test", new HttpBasicAuth());
authentications.put("petstore_auth", new OAuth());
// Prevent the authentications from being modified.
@@ -624,7 +626,7 @@ public class ApiClient {
*
* @param <T> Type
* @param path The sub-path of the HTTP URL
* @param method The request method, one of "GET", "POST", "PUT", and "DELETE"
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE"
* @param queryParams The query parameters
* @param body The request body object
* @param headerParams The header parameters
@@ -684,7 +686,9 @@ public class ApiClient {
} else if ("DELETE".equals(method)) {
response = invocationBuilder.delete();
} else if ("PATCH".equals(method)) {
response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity);
response = invocationBuilder.method("PATCH", entity);
} else if ("HEAD".equals(method)) {
response = invocationBuilder.head();
} else {
throw new ApiException(500, "unknown method type " + method);
}
@@ -735,6 +739,7 @@ public class ApiClient {
clientConfig.register(MultiPartFeature.class);
clientConfig.register(json);
clientConfig.register(JacksonFeature.class);
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
if (debugging) {
clientConfig.register(new LoggingFeature(java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), java.util.logging.Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 1024*50 /* Log payloads up to 50K */));
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);

View File

@@ -70,7 +70,7 @@ public class FakeClassnameTags123Api {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "api_key_query" };
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);

View File

@@ -127,6 +127,6 @@ public class AdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -115,6 +115,6 @@ public class Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -60,6 +60,6 @@ public class AnimalFarm extends ArrayList<Animal> {
}
return o.toString().replace("\n", "\n ");
}
}

Some files were not shown because too many files have changed in this diff Show More