mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-02 21:50:55 +00:00
* [Java][jersey2] Fix logging for jersey2 + java6 (#6715). * Fix formatting according to comments.
This commit is contained in:
parent
75c0180c71
commit
4241b11d97
@ -15,7 +15,6 @@ import org.glassfish.jersey.client.ClientConfig;
|
|||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
||||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||||
import org.glassfish.jersey.logging.LoggingFeature;
|
|
||||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.MultiPart;
|
import org.glassfish.jersey.media.multipart.MultiPart;
|
||||||
@ -27,9 +26,11 @@ import java.io.InputStream;
|
|||||||
{{^supportJava6}}
|
{{^supportJava6}}
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import org.glassfish.jersey.logging.LoggingFeature;
|
||||||
{{/supportJava6}}
|
{{/supportJava6}}
|
||||||
{{#supportJava6}}
|
{{#supportJava6}}
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.glassfish.jersey.filter.LoggingFilter;
|
||||||
{{/supportJava6}}
|
{{/supportJava6}}
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -771,10 +772,15 @@ public class ApiClient {
|
|||||||
clientConfig.register(JacksonFeature.class);
|
clientConfig.register(JacksonFeature.class);
|
||||||
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
||||||
if (debugging) {
|
if (debugging) {
|
||||||
|
{{^supportJava6}}
|
||||||
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.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);
|
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
||||||
// Set logger to ALL
|
// Set logger to ALL
|
||||||
java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL);
|
java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL);
|
||||||
|
{{/supportJava6}}
|
||||||
|
{{#supportJava6}}
|
||||||
|
clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
|
||||||
|
{{/supportJava6}}
|
||||||
}
|
}
|
||||||
performAdditionalClientConfiguration(clientConfig);
|
performAdditionalClientConfiguration(clientConfig);
|
||||||
return ClientBuilder.newClient(clientConfig);
|
return ClientBuilder.newClient(clientConfig);
|
||||||
|
@ -107,11 +107,14 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.15"
|
swagger_annotations_version = "1.5.15"
|
||||||
jackson_version = "2.8.9"
|
jackson_version = "2.8.9"
|
||||||
jersey_version = "2.25.1"
|
|
||||||
{{#supportJava6}}
|
{{#supportJava6}}
|
||||||
|
jersey_version = "2.6"
|
||||||
commons_io_version=2.5
|
commons_io_version=2.5
|
||||||
commons_lang3_version=3.6
|
commons_lang3_version=3.6
|
||||||
{{/supportJava6}}
|
{{/supportJava6}}
|
||||||
|
{{^supportJava6}}
|
||||||
|
jersey_version = "2.25.1"
|
||||||
|
{{/supportJava6}}
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
|
|||||||
resolvers += Resolver.mavenLocal,
|
resolvers += Resolver.mavenLocal,
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"io.swagger" % "swagger-annotations" % "1.5.15",
|
"io.swagger" % "swagger-annotations" % "1.5.15",
|
||||||
"org.glassfish.jersey.core" % "jersey-client" % "2.25.1",
|
"org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}},
|
||||||
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1",
|
"org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}},
|
||||||
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1",
|
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}},
|
||||||
"com.fasterxml.jackson.core" % "jackson-core" % "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
"com.fasterxml.jackson.core" % "jackson-core" % "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
||||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
"com.fasterxml.jackson.core" % "jackson-annotations" % "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
||||||
"com.fasterxml.jackson.core" % "jackson-databind" % "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
"com.fasterxml.jackson.core" % "jackson-databind" % "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" % "compile",
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.0-SNAPSHOT
|
2.3.1-SNAPSHOT
|
@ -1,4 +1,4 @@
|
|||||||
# swagger-petstore-jersey2
|
# swagger-petstore-jersey2-java6
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ Add this dependency to your project's POM:
|
|||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-petstore-jersey2</artifactId>
|
<artifactId>swagger-petstore-jersey2-java6</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -38,7 +38,7 @@ Add this dependency to your project's POM:
|
|||||||
Add this dependency to your project's build file:
|
Add this dependency to your project's build file:
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
compile "io.swagger:swagger-petstore-jersey2:1.0.0"
|
compile "io.swagger:swagger-petstore-jersey2-java6:1.0.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Others
|
### Others
|
||||||
@ -49,7 +49,7 @@ At first generate the JAR by executing:
|
|||||||
|
|
||||||
Then manually install the following JARs:
|
Then manually install the following JARs:
|
||||||
|
|
||||||
* target/swagger-petstore-jersey2-1.0.0.jar
|
* target/swagger-petstore-jersey2-java6-1.0.0.jar
|
||||||
* target/lib/*.jar
|
* target/lib/*.jar
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
@ -61,22 +61,22 @@ Please follow the [installation](#installation) instruction and execute the foll
|
|||||||
import io.swagger.client.*;
|
import io.swagger.client.*;
|
||||||
import io.swagger.client.auth.*;
|
import io.swagger.client.auth.*;
|
||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
import io.swagger.client.api.FakeApi;
|
import io.swagger.client.api.AnotherFakeApi;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class FakeApiExample {
|
public class AnotherFakeApiExample {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
FakeApi apiInstance = new FakeApi();
|
AnotherFakeApi apiInstance = new AnotherFakeApi();
|
||||||
Client body = new Client(); // Client | client model
|
Client body = new Client(); // Client | client model
|
||||||
try {
|
try {
|
||||||
Client result = apiInstance.testClientModel(body);
|
Client result = apiInstance.testSpecialTags(body);
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
System.err.println("Exception when calling FakeApi#testClientModel");
|
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,13 +86,21 @@ public class FakeApiExample {
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*AnotherFakeApi* | [**testSpecialTags**](docs/AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
|
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||||
|
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||||
|
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||||
|
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||||
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||||
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||||
|
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||||
|
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||||
|
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||||
@ -101,9 +109,9 @@ Class | Method | HTTP request | Description
|
|||||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||||
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||||
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||||
@ -123,10 +131,10 @@ Class | Method | HTTP request | Description
|
|||||||
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [ArrayTest](docs/ArrayTest.md)
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
- [Cat](docs/Cat.md)
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
|
- [ClassModel](docs/ClassModel.md)
|
||||||
- [Client](docs/Client.md)
|
- [Client](docs/Client.md)
|
||||||
- [Dog](docs/Dog.md)
|
|
||||||
- [EnumArrays](docs/EnumArrays.md)
|
- [EnumArrays](docs/EnumArrays.md)
|
||||||
- [EnumClass](docs/EnumClass.md)
|
- [EnumClass](docs/EnumClass.md)
|
||||||
- [EnumTest](docs/EnumTest.md)
|
- [EnumTest](docs/EnumTest.md)
|
||||||
@ -140,11 +148,15 @@ Class | Method | HTTP request | Description
|
|||||||
- [Name](docs/Name.md)
|
- [Name](docs/Name.md)
|
||||||
- [NumberOnly](docs/NumberOnly.md)
|
- [NumberOnly](docs/NumberOnly.md)
|
||||||
- [Order](docs/Order.md)
|
- [Order](docs/Order.md)
|
||||||
|
- [OuterComposite](docs/OuterComposite.md)
|
||||||
|
- [OuterEnum](docs/OuterEnum.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
|
- [Cat](docs/Cat.md)
|
||||||
|
- [Dog](docs/Dog.md)
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Authorization
|
## Documentation for Authorization
|
||||||
@ -156,6 +168,12 @@ Authentication schemes defined for the API:
|
|||||||
- **API key parameter name**: api_key
|
- **API key parameter name**: api_key
|
||||||
- **Location**: HTTP header
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
### http_basic_test
|
### http_basic_test
|
||||||
|
|
||||||
- **Type**: HTTP basic authentication
|
- **Type**: HTTP basic authentication
|
||||||
|
@ -95,7 +95,7 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.15"
|
swagger_annotations_version = "1.5.15"
|
||||||
jackson_version = "2.8.9"
|
jackson_version = "2.8.9"
|
||||||
jersey_version = "2.25.1"
|
jersey_version = "2.6"
|
||||||
commons_io_version=2.5
|
commons_io_version=2.5
|
||||||
commons_lang3_version=3.6
|
commons_lang3_version=3.6
|
||||||
junit_version = "4.12"
|
junit_version = "4.12"
|
||||||
|
@ -10,9 +10,9 @@ lazy val root = (project in file(".")).
|
|||||||
resolvers += Resolver.mavenLocal,
|
resolvers += Resolver.mavenLocal,
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"io.swagger" % "swagger-annotations" % "1.5.15",
|
"io.swagger" % "swagger-annotations" % "1.5.15",
|
||||||
"org.glassfish.jersey.core" % "jersey-client" % "2.25.1",
|
"org.glassfish.jersey.core" % "jersey-client" % "2.6",
|
||||||
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1",
|
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.6",
|
||||||
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1",
|
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.6",
|
||||||
"com.fasterxml.jackson.core" % "jackson-core" % "2.6.4" % "compile",
|
"com.fasterxml.jackson.core" % "jackson-core" % "2.6.4" % "compile",
|
||||||
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.6.4" % "compile",
|
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.6.4" % "compile",
|
||||||
"com.fasterxml.jackson.core" % "jackson-databind" % "2.6.4" % "compile",
|
"com.fasterxml.jackson.core" % "jackson-databind" % "2.6.4" % "compile",
|
||||||
|
@ -15,7 +15,6 @@ import org.glassfish.jersey.client.ClientConfig;
|
|||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
||||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||||
import org.glassfish.jersey.logging.LoggingFeature;
|
|
||||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.MultiPart;
|
import org.glassfish.jersey.media.multipart.MultiPart;
|
||||||
@ -25,6 +24,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.glassfish.jersey.filter.LoggingFilter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -761,10 +761,7 @@ public class ApiClient {
|
|||||||
clientConfig.register(JacksonFeature.class);
|
clientConfig.register(JacksonFeature.class);
|
||||||
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
||||||
if (debugging) {
|
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.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
|
||||||
clientConfig.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY, LoggingFeature.Verbosity.PAYLOAD_ANY);
|
|
||||||
// Set logger to ALL
|
|
||||||
java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL);
|
|
||||||
}
|
}
|
||||||
performAdditionalClientConfiguration(clientConfig);
|
performAdditionalClientConfiguration(clientConfig);
|
||||||
return ClientBuilder.newClient(clientConfig);
|
return ClientBuilder.newClient(clientConfig);
|
||||||
|
@ -8,29 +8,19 @@
|
|||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
|
||||||
* Licensed 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 io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.model.Client;
|
|
||||||
import org.joda.time.LocalDate;
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import io.swagger.client.model.Client;
|
||||||
|
import org.threeten.bp.LocalDate;
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
|
import io.swagger.client.model.OuterComposite;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -40,15 +30,80 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* API tests for FakeApi
|
* API tests for FakeApi
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class FakeApiTest {
|
public class FakeApiTest {
|
||||||
|
|
||||||
private final FakeApi api = new FakeApi();
|
private final FakeApi api = new FakeApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer boolean types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterBooleanSerializeTest() throws ApiException {
|
||||||
|
Boolean body = null;
|
||||||
|
Boolean response = api.fakeOuterBooleanSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of object with outer number type
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterCompositeSerializeTest() throws ApiException {
|
||||||
|
OuterComposite body = null;
|
||||||
|
OuterComposite response = api.fakeOuterCompositeSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer number types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterNumberSerializeTest() throws ApiException {
|
||||||
|
BigDecimal body = null;
|
||||||
|
BigDecimal response = api.fakeOuterNumberSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer string types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterStringSerializeTest() throws ApiException {
|
||||||
|
String body = null;
|
||||||
|
String response = api.fakeOuterStringSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To test \"client\" model
|
* To test \"client\" model
|
||||||
*
|
*
|
||||||
*
|
* To test \"client\" model
|
||||||
*
|
*
|
||||||
* @throws ApiException
|
* @throws ApiException
|
||||||
* if the Api call fails
|
* if the Api call fails
|
||||||
@ -56,7 +111,7 @@ public class FakeApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testClientModelTest() throws ApiException {
|
public void testClientModelTest() throws ApiException {
|
||||||
Client body = null;
|
Client body = null;
|
||||||
// Client response = api.testClientModel(body);
|
Client response = api.testClientModel(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -82,10 +137,10 @@ public class FakeApiTest {
|
|||||||
String string = null;
|
String string = null;
|
||||||
byte[] binary = null;
|
byte[] binary = null;
|
||||||
LocalDate date = null;
|
LocalDate date = null;
|
||||||
DateTime dateTime = null;
|
OffsetDateTime dateTime = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
String paramCallback = null;
|
String paramCallback = null;
|
||||||
// api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -93,7 +148,7 @@ public class FakeApiTest {
|
|||||||
/**
|
/**
|
||||||
* To test enum parameters
|
* To test enum parameters
|
||||||
*
|
*
|
||||||
*
|
* To test enum parameters
|
||||||
*
|
*
|
||||||
* @throws ApiException
|
* @throws ApiException
|
||||||
* if the Api call fails
|
* if the Api call fails
|
||||||
@ -106,9 +161,42 @@ public class FakeApiTest {
|
|||||||
String enumHeaderString = null;
|
String enumHeaderString = null;
|
||||||
List<String> enumQueryStringArray = null;
|
List<String> enumQueryStringArray = null;
|
||||||
String enumQueryString = null;
|
String enumQueryString = null;
|
||||||
BigDecimal enumQueryInteger = null;
|
Integer enumQueryInteger = null;
|
||||||
Double enumQueryDouble = null;
|
Double enumQueryDouble = null;
|
||||||
// api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test inline additionalProperties
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testInlineAdditionalPropertiesTest() throws ApiException {
|
||||||
|
Object param = null;
|
||||||
|
api.testInlineAdditionalProperties(param);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test json serialization of form data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testJsonFormDataTest() throws ApiException {
|
||||||
|
String param = null;
|
||||||
|
String param2 = null;
|
||||||
|
api.testJsonFormData(param, param2);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
|
@ -8,28 +8,17 @@
|
|||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
|
||||||
* Licensed 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 io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.model.Pet;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import io.swagger.client.model.ModelApiResponse;
|
import io.swagger.client.model.ModelApiResponse;
|
||||||
|
import io.swagger.client.model.Pet;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -39,6 +28,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* API tests for PetApi
|
* API tests for PetApi
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class PetApiTest {
|
public class PetApiTest {
|
||||||
|
|
||||||
private final PetApi api = new PetApi();
|
private final PetApi api = new PetApi();
|
||||||
@ -55,7 +45,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void addPetTest() throws ApiException {
|
public void addPetTest() throws ApiException {
|
||||||
Pet body = null;
|
Pet body = null;
|
||||||
// api.addPet(body);
|
api.addPet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -72,7 +62,7 @@ public class PetApiTest {
|
|||||||
public void deletePetTest() throws ApiException {
|
public void deletePetTest() throws ApiException {
|
||||||
Long petId = null;
|
Long petId = null;
|
||||||
String apiKey = null;
|
String apiKey = null;
|
||||||
// api.deletePet(petId, apiKey);
|
api.deletePet(petId, apiKey);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -88,7 +78,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void findPetsByStatusTest() throws ApiException {
|
public void findPetsByStatusTest() throws ApiException {
|
||||||
List<String> status = null;
|
List<String> status = null;
|
||||||
// List<Pet> response = api.findPetsByStatus(status);
|
List<Pet> response = api.findPetsByStatus(status);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -104,7 +94,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void findPetsByTagsTest() throws ApiException {
|
public void findPetsByTagsTest() throws ApiException {
|
||||||
List<String> tags = null;
|
List<String> tags = null;
|
||||||
// List<Pet> response = api.findPetsByTags(tags);
|
List<Pet> response = api.findPetsByTags(tags);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -120,7 +110,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getPetByIdTest() throws ApiException {
|
public void getPetByIdTest() throws ApiException {
|
||||||
Long petId = null;
|
Long petId = null;
|
||||||
// Pet response = api.getPetById(petId);
|
Pet response = api.getPetById(petId);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -136,7 +126,7 @@ public class PetApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void updatePetTest() throws ApiException {
|
public void updatePetTest() throws ApiException {
|
||||||
Pet body = null;
|
Pet body = null;
|
||||||
// api.updatePet(body);
|
api.updatePet(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -154,7 +144,7 @@ public class PetApiTest {
|
|||||||
Long petId = null;
|
Long petId = null;
|
||||||
String name = null;
|
String name = null;
|
||||||
String status = null;
|
String status = null;
|
||||||
// api.updatePetWithForm(petId, name, status);
|
api.updatePetWithForm(petId, name, status);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -172,7 +162,7 @@ public class PetApiTest {
|
|||||||
Long petId = null;
|
Long petId = null;
|
||||||
String additionalMetadata = null;
|
String additionalMetadata = null;
|
||||||
File file = null;
|
File file = null;
|
||||||
// ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,6 @@
|
|||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
|
||||||
* Licensed 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +16,7 @@ package io.swagger.client.api;
|
|||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.model.Order;
|
import io.swagger.client.model.Order;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -37,6 +26,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* API tests for StoreApi
|
* API tests for StoreApi
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class StoreApiTest {
|
public class StoreApiTest {
|
||||||
|
|
||||||
private final StoreApi api = new StoreApi();
|
private final StoreApi api = new StoreApi();
|
||||||
@ -53,7 +43,7 @@ public class StoreApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void deleteOrderTest() throws ApiException {
|
public void deleteOrderTest() throws ApiException {
|
||||||
String orderId = null;
|
String orderId = null;
|
||||||
// api.deleteOrder(orderId);
|
api.deleteOrder(orderId);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -68,7 +58,7 @@ public class StoreApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void getInventoryTest() throws ApiException {
|
public void getInventoryTest() throws ApiException {
|
||||||
// Map<String, Integer> response = api.getInventory();
|
Map<String, Integer> response = api.getInventory();
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -84,7 +74,7 @@ public class StoreApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getOrderByIdTest() throws ApiException {
|
public void getOrderByIdTest() throws ApiException {
|
||||||
Long orderId = null;
|
Long orderId = null;
|
||||||
// Order response = api.getOrderById(orderId);
|
Order response = api.getOrderById(orderId);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -100,7 +90,7 @@ public class StoreApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void placeOrderTest() throws ApiException {
|
public void placeOrderTest() throws ApiException {
|
||||||
Order body = null;
|
Order body = null;
|
||||||
// Order response = api.placeOrder(body);
|
Order response = api.placeOrder(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,6 @@
|
|||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
|
||||||
* Licensed 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +16,7 @@ package io.swagger.client.api;
|
|||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.model.User;
|
import io.swagger.client.model.User;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -37,6 +26,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* API tests for UserApi
|
* API tests for UserApi
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class UserApiTest {
|
public class UserApiTest {
|
||||||
|
|
||||||
private final UserApi api = new UserApi();
|
private final UserApi api = new UserApi();
|
||||||
@ -53,7 +43,7 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void createUserTest() throws ApiException {
|
public void createUserTest() throws ApiException {
|
||||||
User body = null;
|
User body = null;
|
||||||
// api.createUser(body);
|
api.createUser(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -69,7 +59,7 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void createUsersWithArrayInputTest() throws ApiException {
|
public void createUsersWithArrayInputTest() throws ApiException {
|
||||||
List<User> body = null;
|
List<User> body = null;
|
||||||
// api.createUsersWithArrayInput(body);
|
api.createUsersWithArrayInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -85,7 +75,7 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void createUsersWithListInputTest() throws ApiException {
|
public void createUsersWithListInputTest() throws ApiException {
|
||||||
List<User> body = null;
|
List<User> body = null;
|
||||||
// api.createUsersWithListInput(body);
|
api.createUsersWithListInput(body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -101,7 +91,7 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void deleteUserTest() throws ApiException {
|
public void deleteUserTest() throws ApiException {
|
||||||
String username = null;
|
String username = null;
|
||||||
// api.deleteUser(username);
|
api.deleteUser(username);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -117,7 +107,7 @@ public class UserApiTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getUserByNameTest() throws ApiException {
|
public void getUserByNameTest() throws ApiException {
|
||||||
String username = null;
|
String username = null;
|
||||||
// User response = api.getUserByName(username);
|
User response = api.getUserByName(username);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -134,7 +124,7 @@ public class UserApiTest {
|
|||||||
public void loginUserTest() throws ApiException {
|
public void loginUserTest() throws ApiException {
|
||||||
String username = null;
|
String username = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
// String response = api.loginUser(username, password);
|
String response = api.loginUser(username, password);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -149,7 +139,7 @@ public class UserApiTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void logoutUserTest() throws ApiException {
|
public void logoutUserTest() throws ApiException {
|
||||||
// api.logoutUser();
|
api.logoutUser();
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
@ -166,7 +156,7 @@ public class UserApiTest {
|
|||||||
public void updateUserTest() throws ApiException {
|
public void updateUserTest() throws ApiException {
|
||||||
String username = null;
|
String username = null;
|
||||||
User body = null;
|
User body = null;
|
||||||
// api.updateUser(username, body);
|
api.updateUser(username, body);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.0-SNAPSHOT
|
2.3.1-SNAPSHOT
|
@ -61,32 +61,22 @@ Please follow the [installation](#installation) instruction and execute the foll
|
|||||||
import io.swagger.client.*;
|
import io.swagger.client.*;
|
||||||
import io.swagger.client.auth.*;
|
import io.swagger.client.auth.*;
|
||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
import io.swagger.client.api.FakeApi;
|
import io.swagger.client.api.AnotherFakeApi;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class FakeApiExample {
|
public class AnotherFakeApiExample {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
FakeApi apiInstance = new FakeApi();
|
AnotherFakeApi apiInstance = new AnotherFakeApi();
|
||||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
Client body = new Client(); // Client | client model
|
||||||
Double _double = 3.4D; // Double | None
|
|
||||||
String string = "string_example"; // String | None
|
|
||||||
byte[] _byte = B; // byte[] | None
|
|
||||||
Integer integer = 56; // Integer | None
|
|
||||||
Integer int32 = 56; // Integer | None
|
|
||||||
Long int64 = 789L; // Long | None
|
|
||||||
Float _float = 3.4F; // Float | None
|
|
||||||
byte[] binary = B; // byte[] | None
|
|
||||||
LocalDate date = new LocalDate(); // LocalDate | None
|
|
||||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
|
||||||
String password = "password_example"; // String | None
|
|
||||||
try {
|
try {
|
||||||
apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
Client result = apiInstance.testSpecialTags(body);
|
||||||
|
System.out.println(result);
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
System.err.println("Exception when calling FakeApi#testEndpointParameters");
|
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,11 +86,21 @@ public class FakeApiExample {
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*AnotherFakeApi* | [**testSpecialTags**](docs/AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
|
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||||
|
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||||
|
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||||
|
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||||
|
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||||
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||||
|
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||||
|
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||||
|
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||||
@ -109,9 +109,9 @@ Class | Method | HTTP request | Description
|
|||||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||||
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||||
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||||
@ -128,29 +128,56 @@ Class | Method | HTTP request | Description
|
|||||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||||
- [Animal](docs/Animal.md)
|
- [Animal](docs/Animal.md)
|
||||||
- [AnimalFarm](docs/AnimalFarm.md)
|
- [AnimalFarm](docs/AnimalFarm.md)
|
||||||
|
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [ArrayTest](docs/ArrayTest.md)
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
- [Cat](docs/Cat.md)
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
- [Dog](docs/Dog.md)
|
- [ClassModel](docs/ClassModel.md)
|
||||||
|
- [Client](docs/Client.md)
|
||||||
|
- [EnumArrays](docs/EnumArrays.md)
|
||||||
- [EnumClass](docs/EnumClass.md)
|
- [EnumClass](docs/EnumClass.md)
|
||||||
- [EnumTest](docs/EnumTest.md)
|
- [EnumTest](docs/EnumTest.md)
|
||||||
- [FormatTest](docs/FormatTest.md)
|
- [FormatTest](docs/FormatTest.md)
|
||||||
|
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||||
|
- [MapTest](docs/MapTest.md)
|
||||||
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||||
- [Model200Response](docs/Model200Response.md)
|
- [Model200Response](docs/Model200Response.md)
|
||||||
- [ModelApiResponse](docs/ModelApiResponse.md)
|
- [ModelApiResponse](docs/ModelApiResponse.md)
|
||||||
- [ModelReturn](docs/ModelReturn.md)
|
- [ModelReturn](docs/ModelReturn.md)
|
||||||
- [Name](docs/Name.md)
|
- [Name](docs/Name.md)
|
||||||
|
- [NumberOnly](docs/NumberOnly.md)
|
||||||
- [Order](docs/Order.md)
|
- [Order](docs/Order.md)
|
||||||
|
- [OuterComposite](docs/OuterComposite.md)
|
||||||
|
- [OuterEnum](docs/OuterEnum.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
|
- [Cat](docs/Cat.md)
|
||||||
|
- [Dog](docs/Dog.md)
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Authorization
|
## Documentation for Authorization
|
||||||
|
|
||||||
Authentication schemes defined for the API:
|
Authentication schemes defined for the API:
|
||||||
|
### api_key
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key
|
||||||
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
|
### http_basic_test
|
||||||
|
|
||||||
|
- **Type**: HTTP basic authentication
|
||||||
|
|
||||||
### petstore_auth
|
### petstore_auth
|
||||||
|
|
||||||
- **Type**: OAuth
|
- **Type**: OAuth
|
||||||
@ -160,16 +187,10 @@ Authentication schemes defined for the API:
|
|||||||
- write:pets: modify pets in your account
|
- write:pets: modify pets in your account
|
||||||
- read:pets: read your pets
|
- read:pets: read your pets
|
||||||
|
|
||||||
### api_key
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: api_key
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
|
|
||||||
## Recommendation
|
## Recommendation
|
||||||
|
|
||||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import org.glassfish.jersey.client.ClientConfig;
|
|||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
||||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||||
import org.glassfish.jersey.logging.LoggingFeature;
|
|
||||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.MultiPart;
|
import org.glassfish.jersey.media.multipart.MultiPart;
|
||||||
@ -26,6 +25,7 @@ import java.io.InputStream;
|
|||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import org.glassfish.jersey.logging.LoggingFeature;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/*
|
||||||
* Swagger Petstore
|
* Swagger Petstore
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0.0
|
* OpenAPI spec version: 1.0.0
|
||||||
* Contact: apiteam@swagger.io
|
* Contact: apiteam@swagger.io
|
||||||
@ -8,28 +8,19 @@
|
|||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*
|
|
||||||
* Licensed 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 io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import java.time.OffsetDateTime;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import io.swagger.client.model.Client;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import io.swagger.client.model.OuterComposite;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -39,11 +30,92 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* API tests for FakeApi
|
* API tests for FakeApi
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class FakeApiTest {
|
public class FakeApiTest {
|
||||||
|
|
||||||
private final FakeApi api = new FakeApi();
|
private final FakeApi api = new FakeApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer boolean types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterBooleanSerializeTest() throws ApiException {
|
||||||
|
Boolean body = null;
|
||||||
|
Boolean response = api.fakeOuterBooleanSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of object with outer number type
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterCompositeSerializeTest() throws ApiException {
|
||||||
|
OuterComposite body = null;
|
||||||
|
OuterComposite response = api.fakeOuterCompositeSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer number types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterNumberSerializeTest() throws ApiException {
|
||||||
|
BigDecimal body = null;
|
||||||
|
BigDecimal response = api.fakeOuterNumberSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer string types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterStringSerializeTest() throws ApiException {
|
||||||
|
String body = null;
|
||||||
|
String response = api.fakeOuterStringSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test \"client\" model
|
||||||
|
*
|
||||||
|
* To test \"client\" model
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testClientModelTest() throws ApiException {
|
||||||
|
Client body = null;
|
||||||
|
Client response = api.testClientModel(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
*
|
*
|
||||||
@ -56,17 +128,75 @@ public class FakeApiTest {
|
|||||||
public void testEndpointParametersTest() throws ApiException {
|
public void testEndpointParametersTest() throws ApiException {
|
||||||
BigDecimal number = null;
|
BigDecimal number = null;
|
||||||
Double _double = null;
|
Double _double = null;
|
||||||
String string = null;
|
String patternWithoutDelimiter = null;
|
||||||
byte[] _byte = null;
|
byte[] _byte = null;
|
||||||
Integer integer = null;
|
Integer integer = null;
|
||||||
Integer int32 = null;
|
Integer int32 = null;
|
||||||
Long int64 = null;
|
Long int64 = null;
|
||||||
Float _float = null;
|
Float _float = null;
|
||||||
|
String string = null;
|
||||||
byte[] binary = null;
|
byte[] binary = null;
|
||||||
LocalDate date = null;
|
LocalDate date = null;
|
||||||
OffsetDateTime dateTime = null;
|
OffsetDateTime dateTime = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
// api.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
String paramCallback = null;
|
||||||
|
api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test enum parameters
|
||||||
|
*
|
||||||
|
* To test enum parameters
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testEnumParametersTest() throws ApiException {
|
||||||
|
List<String> enumFormStringArray = null;
|
||||||
|
String enumFormString = null;
|
||||||
|
List<String> enumHeaderStringArray = null;
|
||||||
|
String enumHeaderString = null;
|
||||||
|
List<String> enumQueryStringArray = null;
|
||||||
|
String enumQueryString = null;
|
||||||
|
Integer enumQueryInteger = null;
|
||||||
|
Double enumQueryDouble = null;
|
||||||
|
api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test inline additionalProperties
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testInlineAdditionalPropertiesTest() throws ApiException {
|
||||||
|
Object param = null;
|
||||||
|
api.testInlineAdditionalProperties(param);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test json serialization of form data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testJsonFormDataTest() throws ApiException {
|
||||||
|
String param = null;
|
||||||
|
String param2 = null;
|
||||||
|
api.testJsonFormData(param, param2);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
|
@ -1,288 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import io.swagger.client.ApiException;
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
|
||||||
|
|
||||||
import io.swagger.client.*;
|
|
||||||
import io.swagger.client.api.*;
|
|
||||||
import io.swagger.client.auth.*;
|
|
||||||
import io.swagger.client.model.*;
|
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import io.swagger.client.model.ModelApiResponse;
|
||||||
|
import io.swagger.client.model.Pet;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.*;
|
/**
|
||||||
import static org.junit.Assert.*;
|
* API tests for PetApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
public class PetApiTest {
|
public class PetApiTest {
|
||||||
PetApi api = null;
|
|
||||||
|
|
||||||
@Before
|
private final PetApi api = new PetApi();
|
||||||
public void setup() {
|
|
||||||
api = new PetApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testApiClient() {
|
public void addPetTest() throws ApiException {
|
||||||
// the default api client is used
|
Pet body = null;
|
||||||
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
api.addPet(body);
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
|
|
||||||
ApiClient oldClient = api.getApiClient();
|
// TODO: test validations
|
||||||
|
|
||||||
ApiClient newClient = new ApiClient();
|
|
||||||
newClient.setBasePath("http://example.com");
|
|
||||||
newClient.setDebugging(true);
|
|
||||||
|
|
||||||
// set api client via constructor
|
|
||||||
api = new PetApi(newClient);
|
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://example.com", api.getApiClient().getBasePath());
|
|
||||||
assertTrue(api.getApiClient().isDebugging());
|
|
||||||
|
|
||||||
// set api client via setter method
|
|
||||||
api.setApiClient(oldClient);
|
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAndGetPet() throws Exception {
|
public void deletePetTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
api.addPet(pet);
|
String apiKey = null;
|
||||||
|
api.deletePet(petId, apiKey);
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
// TODO: test validations
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
*
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAndGetPetWithByteArray() throws Exception {
|
public void findPetsByStatusTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
List<String> status = null;
|
||||||
byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes();
|
List<Pet> response = api.findPetsByStatus(status);
|
||||||
api.addPetUsingByteArray(bytes);
|
|
||||||
|
|
||||||
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
// TODO: test validations
|
||||||
Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class, api.getApiClient());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
*
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPetByIdInObject() throws Exception {
|
public void findPetsByTagsTest() throws ApiException {
|
||||||
Pet pet = new Pet();
|
List<String> tags = null;
|
||||||
pet.setId(TestUtils.nextId());
|
List<Pet> response = api.findPetsByTags(tags);
|
||||||
pet.setName("pet " + pet.getId());
|
|
||||||
|
|
||||||
Category category = new Category();
|
// TODO: test validations
|
||||||
category.setId(TestUtils.nextId());
|
|
||||||
category.setName("category " + category.getId());
|
|
||||||
pet.setCategory(category);
|
|
||||||
|
|
||||||
pet.setStatus(Pet.StatusEnum.PENDING);
|
|
||||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1"});
|
|
||||||
pet.setPhotoUrls(photos);
|
|
||||||
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
InlineResponse200 fetched = api.getPetByIdInObject(pet.getId());
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertEquals(pet.getName(), fetched.getName());
|
|
||||||
|
|
||||||
Object categoryObj = fetched.getCategory();
|
|
||||||
assertNotNull(categoryObj);
|
|
||||||
assertTrue(categoryObj instanceof Map);
|
|
||||||
|
|
||||||
Map categoryMap = (Map) categoryObj;
|
|
||||||
Object categoryIdObj = categoryMap.get("id");
|
|
||||||
assertTrue(categoryIdObj instanceof Integer);
|
|
||||||
Integer categoryIdInt = (Integer) categoryIdObj;
|
|
||||||
assertEquals(category.getId(), Long.valueOf(categoryIdInt));
|
|
||||||
assertEquals(category.getName(), categoryMap.get("name"));
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
*
|
||||||
|
* Returns a single pet
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUpdatePet() throws Exception {
|
public void getPetByIdTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
pet.setName("programmer");
|
Pet response = api.getPetById(petId);
|
||||||
|
|
||||||
api.updatePet(pet);
|
// TODO: test validations
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFindPetsByStatus() throws Exception {
|
public void updatePetTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Pet body = null;
|
||||||
pet.setName("programmer");
|
api.updatePet(body);
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
// TODO: test validations
|
||||||
|
|
||||||
List<Pet> pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"}));
|
|
||||||
assertNotNull(pets);
|
|
||||||
|
|
||||||
boolean found = false;
|
|
||||||
for (Pet fetched : pets) {
|
|
||||||
if (fetched.getId().equals(pet.getId())) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertTrue(found);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFindPetsByTags() throws Exception {
|
public void updatePetWithFormTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
pet.setName("monster");
|
String name = null;
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
String status = null;
|
||||||
|
api.updatePetWithForm(petId, name, status);
|
||||||
|
|
||||||
List<Tag> tags = new ArrayList<Tag>();
|
// TODO: test validations
|
||||||
Tag tag1 = new Tag();
|
|
||||||
tag1.setName("friendly");
|
|
||||||
tags.add(tag1);
|
|
||||||
pet.setTags(tags);
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
|
||||||
|
|
||||||
List<Pet> pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"}));
|
|
||||||
assertNotNull(pets);
|
|
||||||
|
|
||||||
boolean found = false;
|
|
||||||
for (Pet fetched : pets) {
|
|
||||||
if (fetched.getId().equals(pet.getId())) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertTrue(found);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUpdatePetWithForm() throws Exception {
|
public void uploadFileTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
pet.setName("frank");
|
String additionalMetadata = null;
|
||||||
api.addPet(pet);
|
File file = null;
|
||||||
|
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
// TODO: test validations
|
||||||
|
|
||||||
api.updatePetWithForm(fetched.getId(), "furt", null);
|
|
||||||
Pet updated = api.getPetById(fetched.getId());
|
|
||||||
|
|
||||||
assertEquals(updated.getName(), "furt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeletePet() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
api.deletePet(fetched.getId(), null);
|
|
||||||
|
|
||||||
try {
|
|
||||||
fetched = api.getPetById(fetched.getId());
|
|
||||||
fail("expected an error");
|
|
||||||
} catch (ApiException e) {
|
|
||||||
assertEquals(404, e.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUploadFile() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
File file = new File("hello.txt");
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
|
||||||
writer.write("Hello world!");
|
|
||||||
writer.close();
|
|
||||||
|
|
||||||
api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testEqualsAndHashCode() {
|
|
||||||
Pet pet1 = new Pet();
|
|
||||||
Pet pet2 = new Pet();
|
|
||||||
assertTrue(pet1.equals(pet2));
|
|
||||||
assertTrue(pet2.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
|
||||||
assertTrue(pet1.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
|
||||||
|
|
||||||
pet2.setName("really-happy");
|
|
||||||
pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}));
|
|
||||||
assertFalse(pet1.equals(pet2));
|
|
||||||
assertFalse(pet2.equals(pet1));
|
|
||||||
assertFalse(pet1.hashCode() == (pet2.hashCode()));
|
|
||||||
assertTrue(pet2.equals(pet2));
|
|
||||||
assertTrue(pet2.hashCode() == pet2.hashCode());
|
|
||||||
|
|
||||||
pet1.setName("really-happy");
|
|
||||||
pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}));
|
|
||||||
assertTrue(pet1.equals(pet2));
|
|
||||||
assertTrue(pet2.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
|
||||||
assertTrue(pet1.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Pet createRandomPet() {
|
|
||||||
Pet pet = new Pet();
|
|
||||||
pet.setId(TestUtils.nextId());
|
|
||||||
pet.setName("gorilla");
|
|
||||||
|
|
||||||
Category category = new Category();
|
|
||||||
category.setName("really-happy");
|
|
||||||
|
|
||||||
pet.setCategory(category);
|
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"});
|
|
||||||
pet.setPhotoUrls(photos);
|
|
||||||
|
|
||||||
return pet;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String serializeJson(Object o, ApiClient apiClient) {
|
|
||||||
ObjectMapper mapper = apiClient.getJSON().getContext(null);
|
|
||||||
try {
|
|
||||||
return mapper.writeValueAsString(o);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T> T deserializeJson(String json, Class<T> klass, ApiClient apiClient) {
|
|
||||||
ObjectMapper mapper = apiClient.getJSON().getContext(null);
|
|
||||||
try {
|
|
||||||
return mapper.readValue(json, klass);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,101 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
import io.swagger.client.ApiException;
|
||||||
|
import io.swagger.client.model.Order;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import io.swagger.client.*;
|
import java.util.ArrayList;
|
||||||
import io.swagger.client.auth.*;
|
import java.util.HashMap;
|
||||||
import io.swagger.client.model.*;
|
import java.util.List;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
import java.time.OffsetDateTime;
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for StoreApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
public class StoreApiTest {
|
public class StoreApiTest {
|
||||||
StoreApi api = null;
|
|
||||||
|
|
||||||
@Before
|
private final StoreApi api = new StoreApi();
|
||||||
public void setup() {
|
|
||||||
api = new StoreApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
// set custom date format that is used by the petstore server
|
|
||||||
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetInventory() throws Exception {
|
public void deleteOrderTest() throws ApiException {
|
||||||
Map<String, Integer> inventory = api.getInventory();
|
String orderId = null;
|
||||||
assertTrue(inventory.keySet().size() > 0);
|
api.deleteOrder(orderId);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
*
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetInventoryInObject() throws Exception {
|
public void getInventoryTest() throws ApiException {
|
||||||
Object inventoryObj = api.getInventoryInObject();
|
Map<String, Integer> response = api.getInventory();
|
||||||
assertTrue(inventoryObj instanceof Map);
|
|
||||||
|
|
||||||
Map inventoryMap = (Map) inventoryObj;
|
// TODO: test validations
|
||||||
assertTrue(inventoryMap.keySet().size() > 0);
|
|
||||||
|
|
||||||
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
|
||||||
assertTrue(firstEntry.getKey() instanceof String);
|
|
||||||
assertTrue(firstEntry.getValue() instanceof Integer);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Find purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPlaceOrder() throws Exception {
|
public void getOrderByIdTest() throws ApiException {
|
||||||
Order order = createOrder();
|
Long orderId = null;
|
||||||
api.placeOrder(order);
|
Order response = api.getOrderById(orderId);
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
// TODO: test validations
|
||||||
assertEquals(order.getId(), fetched.getId());
|
|
||||||
assertEquals(order.getPetId(), fetched.getPetId());
|
|
||||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
|
||||||
assertEquals(order.getShipDate().toInstant(), fetched.getShipDate().toInstant());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteOrder() throws Exception {
|
public void placeOrderTest() throws ApiException {
|
||||||
Order order = createOrder();
|
Order body = null;
|
||||||
api.placeOrder(order);
|
Order response = api.placeOrder(body);
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
// TODO: test validations
|
||||||
assertEquals(fetched.getId(), order.getId());
|
|
||||||
|
|
||||||
api.deleteOrder(String.valueOf(order.getId()));
|
|
||||||
|
|
||||||
try {
|
|
||||||
api.getOrderById(order.getId());
|
|
||||||
// fail("expected an error");
|
|
||||||
} catch (ApiException e) {
|
|
||||||
// ok
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Order createOrder() {
|
|
||||||
Order order = new Order();
|
|
||||||
order.setPetId(200L);
|
|
||||||
order.setQuantity(13);
|
|
||||||
//Ensure 3 fractional digits because of a bug in the petstore server
|
|
||||||
order.setShipDate(OffsetDateTime.now().withNano(123000000));
|
|
||||||
order.setStatus(Order.StatusEnum.PLACED);
|
|
||||||
order.setComplete(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Field idField = Order.class.getDeclaredField("id");
|
|
||||||
idField.setAccessible(true);
|
|
||||||
idField.set(order, TestUtils.nextId());
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return order;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,88 +1,164 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
import io.swagger.client.ApiException;
|
||||||
|
import io.swagger.client.model.User;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import io.swagger.client.api.*;
|
import java.util.ArrayList;
|
||||||
import io.swagger.client.auth.*;
|
import java.util.HashMap;
|
||||||
import io.swagger.client.model.*;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for UserApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
public class UserApiTest {
|
public class UserApiTest {
|
||||||
UserApi api = null;
|
|
||||||
|
|
||||||
@Before
|
private final UserApi api = new UserApi();
|
||||||
public void setup() {
|
|
||||||
api = new UserApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUser() throws Exception {
|
public void createUserTest() throws ApiException {
|
||||||
User user = createUser();
|
User body = null;
|
||||||
|
api.createUser(body);
|
||||||
|
|
||||||
api.createUser(user);
|
// TODO: test validations
|
||||||
|
|
||||||
User fetched = api.getUserByName(user.getUsername());
|
|
||||||
assertEquals(user.getId(), fetched.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUsersWithArray() throws Exception {
|
public void createUsersWithArrayInputTest() throws ApiException {
|
||||||
User user1 = createUser();
|
List<User> body = null;
|
||||||
user1.setUsername("user" + user1.getId());
|
api.createUsersWithArrayInput(body);
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
// TODO: test validations
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUsersWithList() throws Exception {
|
public void createUsersWithListInputTest() throws ApiException {
|
||||||
User user1 = createUser();
|
List<User> body = null;
|
||||||
user1.setUsername("user" + user1.getId());
|
api.createUsersWithListInput(body);
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
// TODO: test validations
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoginUser() throws Exception {
|
public void deleteUserTest() throws ApiException {
|
||||||
User user = createUser();
|
String username = null;
|
||||||
api.createUser(user);
|
api.deleteUser(username);
|
||||||
|
|
||||||
String token = api.loginUser(user.getUsername(), user.getPassword());
|
// TODO: test validations
|
||||||
assertTrue(token.startsWith("logged in user session:"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void logoutUser() throws Exception {
|
public void getUserByNameTest() throws ApiException {
|
||||||
|
String username = null;
|
||||||
|
User response = api.getUserByName(username);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void loginUserTest() throws ApiException {
|
||||||
|
String username = null;
|
||||||
|
String password = null;
|
||||||
|
String response = api.loginUser(username, password);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void logoutUserTest() throws ApiException {
|
||||||
api.logoutUser();
|
api.logoutUser();
|
||||||
}
|
|
||||||
|
|
||||||
private User createUser() {
|
// TODO: test validations
|
||||||
User user = new User();
|
|
||||||
user.setId(TestUtils.nextId());
|
|
||||||
user.setUsername("fred" + user.getId());
|
|
||||||
user.setFirstName("Fred");
|
|
||||||
user.setLastName("Meyer");
|
|
||||||
user.setEmail("fred@fredmeyer.com");
|
|
||||||
user.setPassword("xxXXxx");
|
|
||||||
user.setPhone("408-867-5309");
|
|
||||||
user.setUserStatus(123);
|
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updated user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void updateUserTest() throws ApiException {
|
||||||
|
String username = null;
|
||||||
|
User body = null;
|
||||||
|
api.updateUser(username, body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.0-SNAPSHOT
|
2.3.1-SNAPSHOT
|
@ -61,30 +61,22 @@ Please follow the [installation](#installation) instruction and execute the foll
|
|||||||
import io.swagger.client.*;
|
import io.swagger.client.*;
|
||||||
import io.swagger.client.auth.*;
|
import io.swagger.client.auth.*;
|
||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
import io.swagger.client.api.PetApi;
|
import io.swagger.client.api.AnotherFakeApi;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class PetApiExample {
|
public class AnotherFakeApiExample {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
|
||||||
|
|
||||||
// Configure OAuth2 access token for authorization: petstore_auth
|
|
||||||
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
|
||||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PetApi apiInstance = new PetApi();
|
|
||||||
|
|
||||||
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
|
|
||||||
|
|
||||||
|
AnotherFakeApi apiInstance = new AnotherFakeApi();
|
||||||
|
Client body = new Client(); // Client | client model
|
||||||
try {
|
try {
|
||||||
apiInstance.addPet(body);
|
Client result = apiInstance.testSpecialTags(body);
|
||||||
|
System.out.println(result);
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
System.err.println("Exception when calling PetApi#addPet");
|
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,26 +86,32 @@ public class PetApiExample {
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*AnotherFakeApi* | [**testSpecialTags**](docs/AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||||
|
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||||
|
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||||
|
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||||
|
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||||
|
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||||
|
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
|
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||||
|
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||||
|
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||||
|
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||||
*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
|
||||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||||
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||||
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||||
*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
|
||||||
*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
|
||||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||||
*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status
|
|
||||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||||
*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||||
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||||
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||||
@ -127,21 +125,59 @@ Class | Method | HTTP request | Description
|
|||||||
|
|
||||||
## Documentation for Models
|
## Documentation for Models
|
||||||
|
|
||||||
|
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||||
|
- [Animal](docs/Animal.md)
|
||||||
|
- [AnimalFarm](docs/AnimalFarm.md)
|
||||||
|
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||||
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
- [InlineResponse200](docs/InlineResponse200.md)
|
- [ClassModel](docs/ClassModel.md)
|
||||||
|
- [Client](docs/Client.md)
|
||||||
|
- [EnumArrays](docs/EnumArrays.md)
|
||||||
|
- [EnumClass](docs/EnumClass.md)
|
||||||
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [FormatTest](docs/FormatTest.md)
|
||||||
|
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||||
|
- [MapTest](docs/MapTest.md)
|
||||||
|
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||||
- [Model200Response](docs/Model200Response.md)
|
- [Model200Response](docs/Model200Response.md)
|
||||||
|
- [ModelApiResponse](docs/ModelApiResponse.md)
|
||||||
- [ModelReturn](docs/ModelReturn.md)
|
- [ModelReturn](docs/ModelReturn.md)
|
||||||
- [Name](docs/Name.md)
|
- [Name](docs/Name.md)
|
||||||
|
- [NumberOnly](docs/NumberOnly.md)
|
||||||
- [Order](docs/Order.md)
|
- [Order](docs/Order.md)
|
||||||
|
- [OuterComposite](docs/OuterComposite.md)
|
||||||
|
- [OuterEnum](docs/OuterEnum.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
|
- [Cat](docs/Cat.md)
|
||||||
|
- [Dog](docs/Dog.md)
|
||||||
|
|
||||||
|
|
||||||
## Documentation for Authorization
|
## Documentation for Authorization
|
||||||
|
|
||||||
Authentication schemes defined for the API:
|
Authentication schemes defined for the API:
|
||||||
|
### api_key
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key
|
||||||
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
|
### http_basic_test
|
||||||
|
|
||||||
|
- **Type**: HTTP basic authentication
|
||||||
|
|
||||||
### petstore_auth
|
### petstore_auth
|
||||||
|
|
||||||
- **Type**: OAuth
|
- **Type**: OAuth
|
||||||
@ -151,44 +187,10 @@ Authentication schemes defined for the API:
|
|||||||
- write:pets: modify pets in your account
|
- write:pets: modify pets in your account
|
||||||
- read:pets: read your pets
|
- read:pets: read your pets
|
||||||
|
|
||||||
### test_api_client_id
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: x-test_api_client_id
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
### test_api_client_secret
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: x-test_api_client_secret
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
### api_key
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: api_key
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
### test_http_basic
|
|
||||||
|
|
||||||
- **Type**: HTTP basic authentication
|
|
||||||
|
|
||||||
### test_api_key_query
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: test_api_key_query
|
|
||||||
- **Location**: URL query string
|
|
||||||
|
|
||||||
### test_api_key_header
|
|
||||||
|
|
||||||
- **Type**: API key
|
|
||||||
- **API key parameter name**: test_api_key_header
|
|
||||||
- **Location**: HTTP header
|
|
||||||
|
|
||||||
|
|
||||||
## Recommendation
|
## Recommendation
|
||||||
|
|
||||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issue.
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import org.glassfish.jersey.client.ClientConfig;
|
|||||||
import org.glassfish.jersey.client.ClientProperties;
|
import org.glassfish.jersey.client.ClientProperties;
|
||||||
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
|
||||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||||
import org.glassfish.jersey.logging.LoggingFeature;
|
|
||||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||||
import org.glassfish.jersey.media.multipart.MultiPart;
|
import org.glassfish.jersey.media.multipart.MultiPart;
|
||||||
@ -26,6 +25,7 @@ import java.io.InputStream;
|
|||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import org.glassfish.jersey.logging.LoggingFeature;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -1,9 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import io.swagger.client.model.Client;
|
||||||
|
import org.threeten.bp.LocalDate;
|
||||||
|
import org.threeten.bp.OffsetDateTime;
|
||||||
|
import io.swagger.client.model.OuterComposite;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -13,11 +30,92 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* API tests for FakeApi
|
* API tests for FakeApi
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class FakeApiTest {
|
public class FakeApiTest {
|
||||||
|
|
||||||
private final FakeApi api = new FakeApi();
|
private final FakeApi api = new FakeApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer boolean types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterBooleanSerializeTest() throws ApiException {
|
||||||
|
Boolean body = null;
|
||||||
|
Boolean response = api.fakeOuterBooleanSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of object with outer number type
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterCompositeSerializeTest() throws ApiException {
|
||||||
|
OuterComposite body = null;
|
||||||
|
OuterComposite response = api.fakeOuterCompositeSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer number types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterNumberSerializeTest() throws ApiException {
|
||||||
|
BigDecimal body = null;
|
||||||
|
BigDecimal response = api.fakeOuterNumberSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Test serialization of outer string types
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void fakeOuterStringSerializeTest() throws ApiException {
|
||||||
|
String body = null;
|
||||||
|
String response = api.fakeOuterStringSerialize(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test \"client\" model
|
||||||
|
*
|
||||||
|
* To test \"client\" model
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testClientModelTest() throws ApiException {
|
||||||
|
Client body = null;
|
||||||
|
Client response = api.testClientModel(body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||||
*
|
*
|
||||||
@ -30,17 +128,75 @@ public class FakeApiTest {
|
|||||||
public void testEndpointParametersTest() throws ApiException {
|
public void testEndpointParametersTest() throws ApiException {
|
||||||
BigDecimal number = null;
|
BigDecimal number = null;
|
||||||
Double _double = null;
|
Double _double = null;
|
||||||
String string = null;
|
String patternWithoutDelimiter = null;
|
||||||
byte[] _byte = null;
|
byte[] _byte = null;
|
||||||
Integer integer = null;
|
Integer integer = null;
|
||||||
Integer int32 = null;
|
Integer int32 = null;
|
||||||
Long int64 = null;
|
Long int64 = null;
|
||||||
Float _float = null;
|
Float _float = null;
|
||||||
|
String string = null;
|
||||||
byte[] binary = null;
|
byte[] binary = null;
|
||||||
Date date = null;
|
LocalDate date = null;
|
||||||
Date dateTime = null;
|
OffsetDateTime dateTime = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
// api.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
String paramCallback = null;
|
||||||
|
api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test enum parameters
|
||||||
|
*
|
||||||
|
* To test enum parameters
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testEnumParametersTest() throws ApiException {
|
||||||
|
List<String> enumFormStringArray = null;
|
||||||
|
String enumFormString = null;
|
||||||
|
List<String> enumHeaderStringArray = null;
|
||||||
|
String enumHeaderString = null;
|
||||||
|
List<String> enumQueryStringArray = null;
|
||||||
|
String enumQueryString = null;
|
||||||
|
Integer enumQueryInteger = null;
|
||||||
|
Double enumQueryDouble = null;
|
||||||
|
api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test inline additionalProperties
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testInlineAdditionalPropertiesTest() throws ApiException {
|
||||||
|
Object param = null;
|
||||||
|
api.testInlineAdditionalProperties(param);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test json serialization of form data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testJsonFormDataTest() throws ApiException {
|
||||||
|
String param = null;
|
||||||
|
String param2 = null;
|
||||||
|
api.testJsonFormData(param, param2);
|
||||||
|
|
||||||
// TODO: test validations
|
// TODO: test validations
|
||||||
}
|
}
|
||||||
|
@ -1,288 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import io.swagger.client.ApiException;
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
|
||||||
|
|
||||||
import io.swagger.client.*;
|
|
||||||
import io.swagger.client.api.*;
|
|
||||||
import io.swagger.client.auth.*;
|
|
||||||
import io.swagger.client.model.*;
|
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import io.swagger.client.model.ModelApiResponse;
|
||||||
|
import io.swagger.client.model.Pet;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.*;
|
/**
|
||||||
import static org.junit.Assert.*;
|
* API tests for PetApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
public class PetApiTest {
|
public class PetApiTest {
|
||||||
PetApi api = null;
|
|
||||||
|
|
||||||
@Before
|
private final PetApi api = new PetApi();
|
||||||
public void setup() {
|
|
||||||
api = new PetApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testApiClient() {
|
public void addPetTest() throws ApiException {
|
||||||
// the default api client is used
|
Pet body = null;
|
||||||
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
api.addPet(body);
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
|
|
||||||
ApiClient oldClient = api.getApiClient();
|
// TODO: test validations
|
||||||
|
|
||||||
ApiClient newClient = new ApiClient();
|
|
||||||
newClient.setBasePath("http://example.com");
|
|
||||||
newClient.setDebugging(true);
|
|
||||||
|
|
||||||
// set api client via constructor
|
|
||||||
api = new PetApi(newClient);
|
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://example.com", api.getApiClient().getBasePath());
|
|
||||||
assertTrue(api.getApiClient().isDebugging());
|
|
||||||
|
|
||||||
// set api client via setter method
|
|
||||||
api.setApiClient(oldClient);
|
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAndGetPet() throws Exception {
|
public void deletePetTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
api.addPet(pet);
|
String apiKey = null;
|
||||||
|
api.deletePet(petId, apiKey);
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
// TODO: test validations
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
*
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAndGetPetWithByteArray() throws Exception {
|
public void findPetsByStatusTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
List<String> status = null;
|
||||||
byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes();
|
List<Pet> response = api.findPetsByStatus(status);
|
||||||
api.addPetUsingByteArray(bytes);
|
|
||||||
|
|
||||||
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
// TODO: test validations
|
||||||
Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class, api.getApiClient());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
*
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPetByIdInObject() throws Exception {
|
public void findPetsByTagsTest() throws ApiException {
|
||||||
Pet pet = new Pet();
|
List<String> tags = null;
|
||||||
pet.setId(TestUtils.nextId());
|
List<Pet> response = api.findPetsByTags(tags);
|
||||||
pet.setName("pet " + pet.getId());
|
|
||||||
|
|
||||||
Category category = new Category();
|
// TODO: test validations
|
||||||
category.setId(TestUtils.nextId());
|
|
||||||
category.setName("category " + category.getId());
|
|
||||||
pet.setCategory(category);
|
|
||||||
|
|
||||||
pet.setStatus(Pet.StatusEnum.PENDING);
|
|
||||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1"});
|
|
||||||
pet.setPhotoUrls(photos);
|
|
||||||
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
InlineResponse200 fetched = api.getPetByIdInObject(pet.getId());
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertEquals(pet.getName(), fetched.getName());
|
|
||||||
|
|
||||||
Object categoryObj = fetched.getCategory();
|
|
||||||
assertNotNull(categoryObj);
|
|
||||||
assertTrue(categoryObj instanceof Map);
|
|
||||||
|
|
||||||
Map categoryMap = (Map) categoryObj;
|
|
||||||
Object categoryIdObj = categoryMap.get("id");
|
|
||||||
assertTrue(categoryIdObj instanceof Integer);
|
|
||||||
Integer categoryIdInt = (Integer) categoryIdObj;
|
|
||||||
assertEquals(category.getId(), Long.valueOf(categoryIdInt));
|
|
||||||
assertEquals(category.getName(), categoryMap.get("name"));
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
*
|
||||||
|
* Returns a single pet
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUpdatePet() throws Exception {
|
public void getPetByIdTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
pet.setName("programmer");
|
Pet response = api.getPetById(petId);
|
||||||
|
|
||||||
api.updatePet(pet);
|
// TODO: test validations
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFindPetsByStatus() throws Exception {
|
public void updatePetTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Pet body = null;
|
||||||
pet.setName("programmer");
|
api.updatePet(body);
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
// TODO: test validations
|
||||||
|
|
||||||
List<Pet> pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"}));
|
|
||||||
assertNotNull(pets);
|
|
||||||
|
|
||||||
boolean found = false;
|
|
||||||
for (Pet fetched : pets) {
|
|
||||||
if (fetched.getId().equals(pet.getId())) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertTrue(found);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFindPetsByTags() throws Exception {
|
public void updatePetWithFormTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
pet.setName("monster");
|
String name = null;
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
String status = null;
|
||||||
|
api.updatePetWithForm(petId, name, status);
|
||||||
|
|
||||||
List<Tag> tags = new ArrayList<Tag>();
|
// TODO: test validations
|
||||||
Tag tag1 = new Tag();
|
|
||||||
tag1.setName("friendly");
|
|
||||||
tags.add(tag1);
|
|
||||||
pet.setTags(tags);
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
|
||||||
|
|
||||||
List<Pet> pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"}));
|
|
||||||
assertNotNull(pets);
|
|
||||||
|
|
||||||
boolean found = false;
|
|
||||||
for (Pet fetched : pets) {
|
|
||||||
if (fetched.getId().equals(pet.getId())) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertTrue(found);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUpdatePetWithForm() throws Exception {
|
public void uploadFileTest() throws ApiException {
|
||||||
Pet pet = createRandomPet();
|
Long petId = null;
|
||||||
pet.setName("frank");
|
String additionalMetadata = null;
|
||||||
api.addPet(pet);
|
File file = null;
|
||||||
|
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
// TODO: test validations
|
||||||
|
|
||||||
api.updatePetWithForm(fetched.getId(), "furt", null);
|
|
||||||
Pet updated = api.getPetById(fetched.getId());
|
|
||||||
|
|
||||||
assertEquals(updated.getName(), "furt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeletePet() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
api.deletePet(fetched.getId(), null);
|
|
||||||
|
|
||||||
try {
|
|
||||||
fetched = api.getPetById(fetched.getId());
|
|
||||||
fail("expected an error");
|
|
||||||
} catch (ApiException e) {
|
|
||||||
assertEquals(404, e.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUploadFile() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
File file = new File("hello.txt");
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
|
||||||
writer.write("Hello world!");
|
|
||||||
writer.close();
|
|
||||||
|
|
||||||
api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testEqualsAndHashCode() {
|
|
||||||
Pet pet1 = new Pet();
|
|
||||||
Pet pet2 = new Pet();
|
|
||||||
assertTrue(pet1.equals(pet2));
|
|
||||||
assertTrue(pet2.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
|
||||||
assertTrue(pet1.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
|
||||||
|
|
||||||
pet2.setName("really-happy");
|
|
||||||
pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}));
|
|
||||||
assertFalse(pet1.equals(pet2));
|
|
||||||
assertFalse(pet2.equals(pet1));
|
|
||||||
assertFalse(pet1.hashCode() == (pet2.hashCode()));
|
|
||||||
assertTrue(pet2.equals(pet2));
|
|
||||||
assertTrue(pet2.hashCode() == pet2.hashCode());
|
|
||||||
|
|
||||||
pet1.setName("really-happy");
|
|
||||||
pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}));
|
|
||||||
assertTrue(pet1.equals(pet2));
|
|
||||||
assertTrue(pet2.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
|
||||||
assertTrue(pet1.equals(pet1));
|
|
||||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Pet createRandomPet() {
|
|
||||||
Pet pet = new Pet();
|
|
||||||
pet.setId(TestUtils.nextId());
|
|
||||||
pet.setName("gorilla");
|
|
||||||
|
|
||||||
Category category = new Category();
|
|
||||||
category.setName("really-happy");
|
|
||||||
|
|
||||||
pet.setCategory(category);
|
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"});
|
|
||||||
pet.setPhotoUrls(photos);
|
|
||||||
|
|
||||||
return pet;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String serializeJson(Object o, ApiClient apiClient) {
|
|
||||||
ObjectMapper mapper = apiClient.getJSON().getContext(null);
|
|
||||||
try {
|
|
||||||
return mapper.writeValueAsString(o);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T> T deserializeJson(String json, Class<T> klass, ApiClient apiClient) {
|
|
||||||
ObjectMapper mapper = apiClient.getJSON().getContext(null);
|
|
||||||
try {
|
|
||||||
return mapper.readValue(json, klass);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,101 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
import io.swagger.client.ApiException;
|
||||||
|
import io.swagger.client.model.Order;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import io.swagger.client.*;
|
import java.util.ArrayList;
|
||||||
import io.swagger.client.auth.*;
|
import java.util.HashMap;
|
||||||
import io.swagger.client.model.*;
|
import java.util.List;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import org.threeten.bp.OffsetDateTime;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for StoreApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
public class StoreApiTest {
|
public class StoreApiTest {
|
||||||
private StoreApi api = null;
|
|
||||||
|
|
||||||
@Before
|
private final StoreApi api = new StoreApi();
|
||||||
public void setup() {
|
|
||||||
api = new StoreApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
// set custom date format that is used by the petstore server
|
|
||||||
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetInventory() throws Exception {
|
public void deleteOrderTest() throws ApiException {
|
||||||
Map<String, Integer> inventory = api.getInventory();
|
String orderId = null;
|
||||||
assertTrue(inventory.keySet().size() > 0);
|
api.deleteOrder(orderId);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
*
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetInventoryInObject() throws Exception {
|
public void getInventoryTest() throws ApiException {
|
||||||
Object inventoryObj = api.getInventoryInObject();
|
Map<String, Integer> response = api.getInventory();
|
||||||
assertTrue(inventoryObj instanceof Map);
|
|
||||||
|
|
||||||
Map inventoryMap = (Map) inventoryObj;
|
// TODO: test validations
|
||||||
assertTrue(inventoryMap.keySet().size() > 0);
|
|
||||||
|
|
||||||
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
|
||||||
assertTrue(firstEntry.getKey() instanceof String);
|
|
||||||
assertTrue(firstEntry.getValue() instanceof Integer);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Find purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPlaceOrder() throws Exception {
|
public void getOrderByIdTest() throws ApiException {
|
||||||
Order order = createOrder();
|
Long orderId = null;
|
||||||
api.placeOrder(order);
|
Order response = api.getOrderById(orderId);
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
// TODO: test validations
|
||||||
assertEquals(order.getId(), fetched.getId());
|
|
||||||
assertEquals(order.getPetId(), fetched.getPetId());
|
|
||||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
|
||||||
assertTrue(order.getShipDate().isEqual(fetched.getShipDate()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteOrder() throws Exception {
|
public void placeOrderTest() throws ApiException {
|
||||||
Order order = createOrder();
|
Order body = null;
|
||||||
api.placeOrder(order);
|
Order response = api.placeOrder(body);
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
// TODO: test validations
|
||||||
assertEquals(fetched.getId(), order.getId());
|
|
||||||
|
|
||||||
api.deleteOrder(String.valueOf(order.getId()));
|
|
||||||
|
|
||||||
try {
|
|
||||||
api.getOrderById(order.getId());
|
|
||||||
// fail("expected an error");
|
|
||||||
} catch (ApiException e) {
|
|
||||||
// ok
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Order createOrder() {
|
|
||||||
Order order = new Order();
|
|
||||||
order.setPetId(200L);
|
|
||||||
order.setQuantity(13);
|
|
||||||
//Ensure 3 fractional digits because of a bug in the petstore server
|
|
||||||
order.setShipDate(OffsetDateTime.now().withNano(123000000));
|
|
||||||
order.setStatus(Order.StatusEnum.PLACED);
|
|
||||||
order.setComplete(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Field idField = Order.class.getDeclaredField("id");
|
|
||||||
idField.setAccessible(true);
|
|
||||||
idField.set(order, TestUtils.nextId());
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return order;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,88 +1,164 @@
|
|||||||
|
/*
|
||||||
|
* Swagger Petstore
|
||||||
|
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
* Contact: apiteam@swagger.io
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
import io.swagger.client.ApiException;
|
||||||
|
import io.swagger.client.model.User;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
import io.swagger.client.api.*;
|
import java.util.ArrayList;
|
||||||
import io.swagger.client.auth.*;
|
import java.util.HashMap;
|
||||||
import io.swagger.client.model.*;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for UserApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
public class UserApiTest {
|
public class UserApiTest {
|
||||||
UserApi api = null;
|
|
||||||
|
|
||||||
@Before
|
private final UserApi api = new UserApi();
|
||||||
public void setup() {
|
|
||||||
api = new UserApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUser() throws Exception {
|
public void createUserTest() throws ApiException {
|
||||||
User user = createUser();
|
User body = null;
|
||||||
|
api.createUser(body);
|
||||||
|
|
||||||
api.createUser(user);
|
// TODO: test validations
|
||||||
|
|
||||||
User fetched = api.getUserByName(user.getUsername());
|
|
||||||
assertEquals(user.getId(), fetched.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUsersWithArray() throws Exception {
|
public void createUsersWithArrayInputTest() throws ApiException {
|
||||||
User user1 = createUser();
|
List<User> body = null;
|
||||||
user1.setUsername("user" + user1.getId());
|
api.createUsersWithArrayInput(body);
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
// TODO: test validations
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUsersWithList() throws Exception {
|
public void createUsersWithListInputTest() throws ApiException {
|
||||||
User user1 = createUser();
|
List<User> body = null;
|
||||||
user1.setUsername("user" + user1.getId());
|
api.createUsersWithListInput(body);
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
// TODO: test validations
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoginUser() throws Exception {
|
public void deleteUserTest() throws ApiException {
|
||||||
User user = createUser();
|
String username = null;
|
||||||
api.createUser(user);
|
api.deleteUser(username);
|
||||||
|
|
||||||
String token = api.loginUser(user.getUsername(), user.getPassword());
|
// TODO: test validations
|
||||||
assertTrue(token.startsWith("logged in user session:"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void logoutUser() throws Exception {
|
public void getUserByNameTest() throws ApiException {
|
||||||
|
String username = null;
|
||||||
|
User response = api.getUserByName(username);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void loginUserTest() throws ApiException {
|
||||||
|
String username = null;
|
||||||
|
String password = null;
|
||||||
|
String response = api.loginUser(username, password);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void logoutUserTest() throws ApiException {
|
||||||
api.logoutUser();
|
api.logoutUser();
|
||||||
}
|
|
||||||
|
|
||||||
private User createUser() {
|
// TODO: test validations
|
||||||
User user = new User();
|
|
||||||
user.setId(TestUtils.nextId());
|
|
||||||
user.setUsername("fred" + user.getId());
|
|
||||||
user.setFirstName("Fred");
|
|
||||||
user.setLastName("Meyer");
|
|
||||||
user.setEmail("fred@fredmeyer.com");
|
|
||||||
user.setPassword("xxXXxx");
|
|
||||||
user.setPhone("408-867-5309");
|
|
||||||
user.setUserStatus(123);
|
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updated user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void updateUserTest() throws ApiException {
|
||||||
|
String username = null;
|
||||||
|
User body = null;
|
||||||
|
api.updateUser(username, body);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user