mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
Merge branch 'cbornet-jersey_joda'
This commit is contained in:
commit
e32ccb24e4
@ -26,6 +26,9 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DdateLibrary=joda,hideGenerationTimestamp=true"
|
||||||
|
|
||||||
|
echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main"
|
||||||
|
rm -rf samples/client/petstore/java/jersey2/src/main
|
||||||
|
find samples/client/petstore/java/jersey2 -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -26,6 +26,9 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DhideGenerationTimestamp=true"
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -o samples/client/petstore/java/default -DdateLibrary=joda,hideGenerationTimestamp=true"
|
||||||
|
|
||||||
|
echo "Removing files and folders under samples/client/petstore/java/default/src/main"
|
||||||
|
rm -rf samples/client/petstore/java/default/src/main
|
||||||
|
find samples/client/petstore/java/default -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -5,6 +5,6 @@ If Not Exist %executable% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties
|
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||||
set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java
|
set ags=generate -t modules\swagger-codegen\src\main\resources\java -i modules\swagger-codegen\src\test\resources\2_0\petstore.json -l java -o samples\client\petstore\java -DdateLibrary=joda,hideGenerationTimestamp=true
|
||||||
|
|
||||||
java %JAVA_OPTS% -jar %executable% %ags%
|
java %JAVA_OPTS% -jar %executable% %ags%
|
||||||
|
23
samples/client/petstore/java/default/.swagger-codegen-ignore
Normal file
23
samples/client/petstore/java/default/.swagger-codegen-ignore
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Codegen Ignore
|
||||||
|
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
201
samples/client/petstore/java/default/LICENSE
Normal file
201
samples/client/petstore/java/default/LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
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.
|
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# AdditionalPropertiesClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**mapProperty** | **Map<String, String>** | | [optional]
|
||||||
|
**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**className** | **String** | |
|
**className** | **String** | |
|
||||||
|
**color** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
12
samples/client/petstore/java/default/docs/ArrayTest.md
Normal file
12
samples/client/petstore/java/default/docs/ArrayTest.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# ArrayTest
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**arrayOfString** | **List<String>** | | [optional]
|
||||||
|
**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional]
|
||||||
|
**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**className** | **String** | |
|
**className** | **String** | |
|
||||||
|
**color** | **String** | | [optional]
|
||||||
**declawed** | **Boolean** | | [optional]
|
**declawed** | **Boolean** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**className** | **String** | |
|
**className** | **String** | |
|
||||||
|
**color** | **String** | | [optional]
|
||||||
**breed** | **String** | | [optional]
|
**breed** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None
|
|||||||
Long int64 = 789L; // Long | None
|
Long int64 = 789L; // Long | None
|
||||||
Float _float = 3.4F; // Float | None
|
Float _float = 3.4F; // Float | None
|
||||||
byte[] binary = B; // byte[] | None
|
byte[] binary = B; // byte[] | None
|
||||||
Date date = new Date(); // Date | None
|
LocalDate date = new LocalDate(); // LocalDate | None
|
||||||
Date dateTime = new Date(); // Date | None
|
DateTime dateTime = new DateTime(); // DateTime | None
|
||||||
String password = "password_example"; // String | None
|
String password = "password_example"; // String | None
|
||||||
try {
|
try {
|
||||||
apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
@ -56,8 +56,8 @@ Name | Type | Description | Notes
|
|||||||
**int64** | **Long**| None | [optional]
|
**int64** | **Long**| None | [optional]
|
||||||
**_float** | **Float**| None | [optional]
|
**_float** | **Float**| None | [optional]
|
||||||
**binary** | **byte[]**| None | [optional]
|
**binary** | **byte[]**| None | [optional]
|
||||||
**date** | **Date**| None | [optional]
|
**date** | **LocalDate**| None | [optional]
|
||||||
**dateTime** | **Date**| None | [optional]
|
**dateTime** | **DateTime**| None | [optional]
|
||||||
**password** | **String**| None | [optional]
|
**password** | **String**| None | [optional]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
@ -70,6 +70,6 @@ No authorization required
|
|||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||||
- **Accept**: application/xml, application/json
|
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ Name | Type | Description | Notes
|
|||||||
**string** | **String** | | [optional]
|
**string** | **String** | | [optional]
|
||||||
**_byte** | **byte[]** | |
|
**_byte** | **byte[]** | |
|
||||||
**binary** | **byte[]** | | [optional]
|
**binary** | **byte[]** | | [optional]
|
||||||
**date** | [**Date**](Date.md) | |
|
**date** | [**LocalDate**](LocalDate.md) | |
|
||||||
**dateTime** | [**Date**](Date.md) | | [optional]
|
**dateTime** | [**DateTime**](DateTime.md) | | [optional]
|
||||||
**uuid** | **String** | | [optional]
|
**uuid** | **String** | | [optional]
|
||||||
**password** | **String** | |
|
**password** | **String** | |
|
||||||
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# MixedPropertiesAndAdditionalPropertiesClass
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**uuid** | **String** | | [optional]
|
||||||
|
**dateTime** | [**DateTime**](DateTime.md) | | [optional]
|
||||||
|
**map** | [**Map<String, Animal>**](Animal.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7,6 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**name** | **Integer** | |
|
**name** | **Integer** | |
|
||||||
**snakeCase** | **Integer** | | [optional]
|
**snakeCase** | **Integer** | | [optional]
|
||||||
**property** | **String** | | [optional]
|
**property** | **String** | | [optional]
|
||||||
|
**_123Number** | **Integer** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **Long** | | [optional]
|
**id** | **Long** | | [optional]
|
||||||
**petId** | **Long** | | [optional]
|
**petId** | **Long** | | [optional]
|
||||||
**quantity** | **Integer** | | [optional]
|
**quantity** | **Integer** | | [optional]
|
||||||
**shipDate** | [**Date**](Date.md) | | [optional]
|
**shipDate** | [**DateTime**](DateTime.md) | | [optional]
|
||||||
**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional]
|
**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **Boolean** | | [optional]
|
**complete** | **Boolean** | | [optional]
|
||||||
|
|
||||||
|
11
samples/client/petstore/java/default/docs/ReadOnlyFirst.md
Normal file
11
samples/client/petstore/java/default/docs/ReadOnlyFirst.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# ReadOnlyFirst
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**bar** | **String** | | [optional]
|
||||||
|
**baz** | **String** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
|
0
samples/client/petstore/java/default/gradlew
vendored
Executable file → Normal file
0
samples/client/petstore/java/default/gradlew
vendored
Executable file → Normal file
@ -1,23 +0,0 @@
|
|||||||
# To run the profiling:
|
|
||||||
# mvn compile test-compile exec:java -Dexec.classpathScope=test -Dexec.mainClass="io.swagger.PetstoreProfiling"
|
|
||||||
|
|
||||||
0: ADD PET => 0.987609128
|
|
||||||
0: GET PET => 0.450873167
|
|
||||||
0: UPDATE PET => 0.447611998
|
|
||||||
0: DELETE PET => 0.397707664
|
|
||||||
1: ADD PET => 0.395333121
|
|
||||||
1: GET PET => 0.381760136
|
|
||||||
1: UPDATE PET => 0.395245221
|
|
||||||
1: DELETE PET => 0.384854324
|
|
||||||
2: ADD PET => 0.400336227
|
|
||||||
2: GET PET => 0.378959921
|
|
||||||
2: UPDATE PET => 0.397619284
|
|
||||||
2: DELETE PET => 0.383307393
|
|
||||||
3: ADD PET => 0.385764805
|
|
||||||
3: GET PET => 0.40218304
|
|
||||||
3: UPDATE PET => 0.387887511
|
|
||||||
3: DELETE PET => 0.398063489
|
|
||||||
4: ADD PET => 0.384757488
|
|
||||||
4: GET PET => 0.398719713
|
|
||||||
4: UPDATE PET => 0.383319052
|
|
||||||
4: DELETE PET => 0.408516644
|
|
@ -97,8 +97,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.7</source>
|
||||||
<target>1.6</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
@ -41,7 +41,7 @@ import io.swagger.client.auth.HttpBasicAuth;
|
|||||||
import io.swagger.client.auth.ApiKeyAuth;
|
import io.swagger.client.auth.ApiKeyAuth;
|
||||||
import io.swagger.client.auth.OAuth;
|
import io.swagger.client.auth.OAuth;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T15:55:38.841+08:00")
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
private String basePath = "http://petstore.swagger.io/v2";
|
||||||
@ -75,13 +75,8 @@ public class ApiClient {
|
|||||||
|
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
authentications = new HashMap<String, Authentication>();
|
authentications = new HashMap<String, Authentication>();
|
||||||
authentications.put("petstore_auth", new OAuth());
|
|
||||||
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
|
|
||||||
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
|
|
||||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||||
authentications.put("test_http_basic", new HttpBasicAuth());
|
authentications.put("petstore_auth", new OAuth());
|
||||||
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
|
|
||||||
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
|
|
||||||
// Prevent the authentications from being modified.
|
// Prevent the authentications from being modified.
|
||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
|
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -5,65 +30,74 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
public class ApiException extends Exception {
|
public class ApiException extends Exception {
|
||||||
private int code = 0;
|
private int code = 0;
|
||||||
private Map<String, List<String>> responseHeaders = null;
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCode() {
|
/**
|
||||||
return code;
|
* Get the HTTP status code.
|
||||||
}
|
*
|
||||||
|
* @return HTTP status code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response headers.
|
* Get the HTTP response headers.
|
||||||
*/
|
*
|
||||||
public Map<String, List<String>> getResponseHeaders() {
|
* @return A map of list of string
|
||||||
return responseHeaders;
|
*/
|
||||||
}
|
public Map<String, List<String>> getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response body.
|
* Get the HTTP response body.
|
||||||
*/
|
*
|
||||||
public String getResponseBody() {
|
* @return Response body in the form of string
|
||||||
return responseBody;
|
*/
|
||||||
}
|
public String getResponseBody() {
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
|
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
private static ApiClient defaultApiClient = new ApiClient();
|
private static ApiClient defaultApiClient = new ApiClient();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default API client, which would be used when creating API
|
* Get the default API client, which would be used when creating API
|
||||||
* instances without providing an API client.
|
* instances without providing an API client.
|
||||||
*/
|
*
|
||||||
public static ApiClient getDefaultApiClient() {
|
* @return Default API client
|
||||||
return defaultApiClient;
|
*/
|
||||||
}
|
public static ApiClient getDefaultApiClient() {
|
||||||
|
return defaultApiClient;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default API client, which would be used when creating API
|
* Set the default API client, which would be used when creating API
|
||||||
* instances without providing an API client.
|
* instances without providing an API client.
|
||||||
*/
|
*
|
||||||
public static void setDefaultApiClient(ApiClient apiClient) {
|
* @param apiClient API client
|
||||||
defaultApiClient = apiClient;
|
*/
|
||||||
}
|
public static void setDefaultApiClient(ApiClient apiClient) {
|
||||||
|
defaultApiClient = apiClient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@ import io.swagger.client.Configuration;
|
|||||||
import io.swagger.client.model.*;
|
import io.swagger.client.model.*;
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
|
||||||
import java.util.Date;
|
import org.joda.time.LocalDate;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ public class FakeApi {
|
|||||||
* @param password None (optional)
|
* @param password None (optional)
|
||||||
* @throws ApiException if fails to make API call
|
* @throws ApiException if fails to make API call
|
||||||
*/
|
*/
|
||||||
public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException {
|
public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException {
|
||||||
Object localVarPostBody = null;
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'number' is set
|
// verify the required parameter 'number' is set
|
||||||
@ -113,12 +114,12 @@ if (password != null)
|
|||||||
localVarFormParams.put("password", password);
|
localVarFormParams.put("password", password);
|
||||||
|
|
||||||
final String[] localVarAccepts = {
|
final String[] localVarAccepts = {
|
||||||
"application/xml", "application/json"
|
"application/xml; charset=utf-8", "application/json; charset=utf-8"
|
||||||
};
|
};
|
||||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
|
||||||
final String[] localVarContentTypes = {
|
final String[] localVarContentTypes = {
|
||||||
|
"application/xml; charset=utf-8", "application/json; charset=utf-8"
|
||||||
};
|
};
|
||||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
@ -6,6 +31,11 @@ import java.util.Map;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface Authentication {
|
public interface Authentication {
|
||||||
/** Apply authentication settings to header and query params. */
|
/**
|
||||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
* Apply authentication settings to header and query params.
|
||||||
|
*
|
||||||
|
* @param queryParams List of query parameters
|
||||||
|
* @param headerParams Map of header parameters
|
||||||
|
*/
|
||||||
|
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
public enum OAuthFlow {
|
public enum OAuthFlow {
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdditionalPropertiesClass
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdditionalPropertiesClass {
|
||||||
|
|
||||||
|
private Map<String, String> mapProperty = new HashMap<String, String>();
|
||||||
|
private Map<String, Map<String, String>> mapOfMapProperty = new HashMap<String, Map<String, String>>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
|
||||||
|
this.mapProperty = mapProperty;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("map_property")
|
||||||
|
public Map<String, String> getMapProperty() {
|
||||||
|
return mapProperty;
|
||||||
|
}
|
||||||
|
public void setMapProperty(Map<String, String> mapProperty) {
|
||||||
|
this.mapProperty = mapProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
|
||||||
|
this.mapOfMapProperty = mapOfMapProperty;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("map_of_map_property")
|
||||||
|
public Map<String, Map<String, String>> getMapOfMapProperty() {
|
||||||
|
return mapOfMapProperty;
|
||||||
|
}
|
||||||
|
public void setMapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) {
|
||||||
|
this.mapOfMapProperty = mapOfMapProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o;
|
||||||
|
return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) &&
|
||||||
|
Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(mapProperty, mapOfMapProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class AdditionalPropertiesClass {\n");
|
||||||
|
|
||||||
|
sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n");
|
||||||
|
sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
public class Animal {
|
public class Animal {
|
||||||
|
|
||||||
private String className = null;
|
private String className = null;
|
||||||
|
private String color = "red";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,6 +34,23 @@ public class Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public Animal color(String color) {
|
||||||
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("color")
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(java.lang.Object o) {
|
public boolean equals(java.lang.Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
@ -42,12 +60,13 @@ public class Animal {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Animal animal = (Animal) o;
|
Animal animal = (Animal) o;
|
||||||
return Objects.equals(this.className, animal.className);
|
return Objects.equals(this.className, animal.className) &&
|
||||||
|
Objects.equals(this.color, animal.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(className);
|
return Objects.hash(className, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -56,6 +75,7 @@ public class Animal {
|
|||||||
sb.append("class Animal {\n");
|
sb.append("class Animal {\n");
|
||||||
|
|
||||||
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
||||||
|
sb.append(" color: ").append(toIndentedString(color)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,116 @@
|
|||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArrayTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ArrayTest {
|
||||||
|
|
||||||
|
private List<String> arrayOfString = new ArrayList<String>();
|
||||||
|
private List<List<Long>> arrayArrayOfInteger = new ArrayList<List<Long>>();
|
||||||
|
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ArrayTest arrayOfString(List<String> arrayOfString) {
|
||||||
|
this.arrayOfString = arrayOfString;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("array_of_string")
|
||||||
|
public List<String> getArrayOfString() {
|
||||||
|
return arrayOfString;
|
||||||
|
}
|
||||||
|
public void setArrayOfString(List<String> arrayOfString) {
|
||||||
|
this.arrayOfString = arrayOfString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
|
||||||
|
this.arrayArrayOfInteger = arrayArrayOfInteger;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("array_array_of_integer")
|
||||||
|
public List<List<Long>> getArrayArrayOfInteger() {
|
||||||
|
return arrayArrayOfInteger;
|
||||||
|
}
|
||||||
|
public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) {
|
||||||
|
this.arrayArrayOfInteger = arrayArrayOfInteger;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
|
||||||
|
this.arrayArrayOfModel = arrayArrayOfModel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("array_array_of_model")
|
||||||
|
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
|
||||||
|
return arrayArrayOfModel;
|
||||||
|
}
|
||||||
|
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
|
||||||
|
this.arrayArrayOfModel = arrayArrayOfModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ArrayTest arrayTest = (ArrayTest) o;
|
||||||
|
return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) &&
|
||||||
|
Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) &&
|
||||||
|
Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ArrayTest {\n");
|
||||||
|
|
||||||
|
sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n");
|
||||||
|
sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n");
|
||||||
|
sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ import io.swagger.client.model.Animal;
|
|||||||
public class Cat extends Animal {
|
public class Cat extends Animal {
|
||||||
|
|
||||||
private String className = null;
|
private String className = null;
|
||||||
|
private String color = "red";
|
||||||
private Boolean declawed = null;
|
private Boolean declawed = null;
|
||||||
|
|
||||||
|
|
||||||
@ -35,6 +36,23 @@ public class Cat extends Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public Cat color(String color) {
|
||||||
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("color")
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public Cat declawed(Boolean declawed) {
|
public Cat declawed(Boolean declawed) {
|
||||||
@ -62,13 +80,14 @@ public class Cat extends Animal {
|
|||||||
}
|
}
|
||||||
Cat cat = (Cat) o;
|
Cat cat = (Cat) o;
|
||||||
return Objects.equals(this.className, cat.className) &&
|
return Objects.equals(this.className, cat.className) &&
|
||||||
|
Objects.equals(this.color, cat.color) &&
|
||||||
Objects.equals(this.declawed, cat.declawed) &&
|
Objects.equals(this.declawed, cat.declawed) &&
|
||||||
super.equals(o);
|
super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(className, declawed, super.hashCode());
|
return Objects.hash(className, color, declawed, super.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -77,6 +96,7 @@ public class Cat extends Animal {
|
|||||||
sb.append("class Cat {\n");
|
sb.append("class Cat {\n");
|
||||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||||
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
||||||
|
sb.append(" color: ").append(toIndentedString(color)).append("\n");
|
||||||
sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n");
|
sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@ -15,6 +15,7 @@ import io.swagger.client.model.Animal;
|
|||||||
public class Dog extends Animal {
|
public class Dog extends Animal {
|
||||||
|
|
||||||
private String className = null;
|
private String className = null;
|
||||||
|
private String color = "red";
|
||||||
private String breed = null;
|
private String breed = null;
|
||||||
|
|
||||||
|
|
||||||
@ -35,6 +36,23 @@ public class Dog extends Animal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public Dog color(String color) {
|
||||||
|
this.color = color;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("color")
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public Dog breed(String breed) {
|
public Dog breed(String breed) {
|
||||||
@ -62,13 +80,14 @@ public class Dog extends Animal {
|
|||||||
}
|
}
|
||||||
Dog dog = (Dog) o;
|
Dog dog = (Dog) o;
|
||||||
return Objects.equals(this.className, dog.className) &&
|
return Objects.equals(this.className, dog.className) &&
|
||||||
|
Objects.equals(this.color, dog.color) &&
|
||||||
Objects.equals(this.breed, dog.breed) &&
|
Objects.equals(this.breed, dog.breed) &&
|
||||||
super.equals(o);
|
super.equals(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(className, breed, super.hashCode());
|
return Objects.hash(className, color, breed, super.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -77,6 +96,7 @@ public class Dog extends Animal {
|
|||||||
sb.append("class Dog {\n");
|
sb.append("class Dog {\n");
|
||||||
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
|
||||||
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
sb.append(" className: ").append(toIndentedString(className)).append("\n");
|
||||||
|
sb.append(" color: ").append(toIndentedString(color)).append("\n");
|
||||||
sb.append(" breed: ").append(toIndentedString(breed)).append("\n");
|
sb.append(" breed: ").append(toIndentedString(breed)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@ -6,7 +6,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.LocalDate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,8 +25,8 @@ public class FormatTest {
|
|||||||
private String string = null;
|
private String string = null;
|
||||||
private byte[] _byte = null;
|
private byte[] _byte = null;
|
||||||
private byte[] binary = null;
|
private byte[] binary = null;
|
||||||
private Date date = null;
|
private LocalDate date = null;
|
||||||
private Date dateTime = null;
|
private DateTime dateTime = null;
|
||||||
private String uuid = null;
|
private String uuid = null;
|
||||||
private String password = null;
|
private String password = null;
|
||||||
|
|
||||||
@ -195,34 +196,34 @@ public class FormatTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public FormatTest date(Date date) {
|
public FormatTest date(LocalDate date) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", required = true, value = "")
|
@ApiModelProperty(example = "null", required = true, value = "")
|
||||||
@JsonProperty("date")
|
@JsonProperty("date")
|
||||||
public Date getDate() {
|
public LocalDate getDate() {
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
public void setDate(Date date) {
|
public void setDate(LocalDate date) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public FormatTest dateTime(Date dateTime) {
|
public FormatTest dateTime(DateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("dateTime")
|
@JsonProperty("dateTime")
|
||||||
public Date getDateTime() {
|
public DateTime getDateTime() {
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
public void setDateTime(Date dateTime) {
|
public void setDateTime(DateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,119 @@
|
|||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.client.model.Animal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MixedPropertiesAndAdditionalPropertiesClass
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||||
|
|
||||||
|
private String uuid = null;
|
||||||
|
private DateTime dateTime = null;
|
||||||
|
private Map<String, Animal> map = new HashMap<String, Animal>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("uuid")
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("dateTime")
|
||||||
|
public DateTime getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
public void setDateTime(DateTime dateTime) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) {
|
||||||
|
this.map = map;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("map")
|
||||||
|
public Map<String, Animal> getMap() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
public void setMap(Map<String, Animal> map) {
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o;
|
||||||
|
return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) &&
|
||||||
|
Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) &&
|
||||||
|
Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(uuid, dateTime, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n");
|
||||||
|
|
||||||
|
sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n");
|
||||||
|
sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n");
|
||||||
|
sb.append(" map: ").append(toIndentedString(map)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ public class Name {
|
|||||||
private Integer name = null;
|
private Integer name = null;
|
||||||
private Integer snakeCase = null;
|
private Integer snakeCase = null;
|
||||||
private String property = null;
|
private String property = null;
|
||||||
|
private Integer _123Number = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,6 +61,13 @@ public class Name {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("123Number")
|
||||||
|
public Integer get123Number() {
|
||||||
|
return _123Number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(java.lang.Object o) {
|
public boolean equals(java.lang.Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
@ -71,12 +79,13 @@ public class Name {
|
|||||||
Name name = (Name) o;
|
Name name = (Name) o;
|
||||||
return Objects.equals(this.name, name.name) &&
|
return Objects.equals(this.name, name.name) &&
|
||||||
Objects.equals(this.snakeCase, name.snakeCase) &&
|
Objects.equals(this.snakeCase, name.snakeCase) &&
|
||||||
Objects.equals(this.property, name.property);
|
Objects.equals(this.property, name.property) &&
|
||||||
|
Objects.equals(this._123Number, name._123Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(name, snakeCase, property);
|
return Objects.hash(name, snakeCase, property, _123Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -87,6 +96,7 @@ public class Name {
|
|||||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
|
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
|
||||||
sb.append(" property: ").append(toIndentedString(property)).append("\n");
|
sb.append(" property: ").append(toIndentedString(property)).append("\n");
|
||||||
|
sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.util.Date;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,7 +18,7 @@ public class Order {
|
|||||||
private Long id = null;
|
private Long id = null;
|
||||||
private Long petId = null;
|
private Long petId = null;
|
||||||
private Integer quantity = null;
|
private Integer quantity = null;
|
||||||
private Date shipDate = null;
|
private DateTime shipDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order Status
|
* Order Status
|
||||||
@ -98,17 +98,17 @@ public class Order {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public Order shipDate(Date shipDate) {
|
public Order shipDate(DateTime shipDate) {
|
||||||
this.shipDate = shipDate;
|
this.shipDate = shipDate;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("shipDate")
|
@JsonProperty("shipDate")
|
||||||
public Date getShipDate() {
|
public DateTime getShipDate() {
|
||||||
return shipDate;
|
return shipDate;
|
||||||
}
|
}
|
||||||
public void setShipDate(Date shipDate) {
|
public void setShipDate(DateTime shipDate) {
|
||||||
this.shipDate = shipDate;
|
this.shipDate = shipDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
package io.swagger.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.Objects;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReadOnlyFirst
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ReadOnlyFirst {
|
||||||
|
|
||||||
|
private String bar = null;
|
||||||
|
private String baz = null;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("bar")
|
||||||
|
public String getBar() {
|
||||||
|
return bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
public ReadOnlyFirst baz(String baz) {
|
||||||
|
this.baz = baz;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "")
|
||||||
|
@JsonProperty("baz")
|
||||||
|
public String getBaz() {
|
||||||
|
return baz;
|
||||||
|
}
|
||||||
|
public void setBaz(String baz) {
|
||||||
|
this.baz = baz;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(java.lang.Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o;
|
||||||
|
return Objects.equals(this.bar, readOnlyFirst.bar) &&
|
||||||
|
Objects.equals(this.baz, readOnlyFirst.baz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(bar, baz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ReadOnlyFirst {\n");
|
||||||
|
|
||||||
|
sb.append(" bar: ").append(toIndentedString(bar)).append("\n");
|
||||||
|
sb.append(" baz: ").append(toIndentedString(baz)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(java.lang.Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -111,6 +111,7 @@ public class ApiClientTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore("There is no more basic auth in petstore security definitions")
|
||||||
@Test
|
@Test
|
||||||
public void testSetUsernameAndPassword() {
|
public void testSetUsernameAndPassword() {
|
||||||
HttpBasicAuth auth = null;
|
HttpBasicAuth auth = null;
|
||||||
|
@ -1,155 +1,306 @@
|
|||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
import io.swagger.client.model.Pet;
|
import com.fasterxml.jackson.databind.*;
|
||||||
import io.swagger.client.model.ModelApiResponse;
|
import com.fasterxml.jackson.datatype.joda.*;
|
||||||
import java.io.File;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
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.FileWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
import org.junit.*;
|
||||||
* API tests for PetApi
|
import static org.junit.Assert.*;
|
||||||
*/
|
|
||||||
public class PetApiTest {
|
public class PetApiTest {
|
||||||
|
private PetApi api;
|
||||||
|
private ObjectMapper mapper;
|
||||||
|
|
||||||
private final PetApi api = new PetApi();
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
api = new PetApi();
|
||||||
/**
|
// setup authentication
|
||||||
* Add a new pet to the store
|
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||||
*
|
apiKeyAuth.setApiKey("special-key");
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void addPetTest() throws ApiException {
|
|
||||||
Pet body = null;
|
|
||||||
// api.addPet(body);
|
|
||||||
|
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes a pet
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void deletePetTest() throws ApiException {
|
public void testApiClient() {
|
||||||
Long petId = null;
|
// the default api client is used
|
||||||
String apiKey = null;
|
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
||||||
// api.deletePet(petId, apiKey);
|
assertNotNull(api.getApiClient());
|
||||||
|
assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath());
|
||||||
|
assertFalse(api.getApiClient().isDebugging());
|
||||||
|
|
||||||
// TODO: test validations
|
ApiClient oldClient = api.getApiClient();
|
||||||
|
|
||||||
|
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/v2", api.getApiClient().getBasePath());
|
||||||
|
assertFalse(api.getApiClient().isDebugging());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 findPetsByStatusTest() throws ApiException {
|
public void testCreateAndGetPet() throws Exception {
|
||||||
List<String> status = null;
|
Pet pet = createRandomPet();
|
||||||
// List<Pet> response = api.findPetsByStatus(status);
|
api.addPet(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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 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 findPetsByTagsTest() throws ApiException {
|
public void testCreateAndGetPetWithByteArray() throws Exception {
|
||||||
List<String> tags = null;
|
Pet pet = createRandomPet();
|
||||||
// List<Pet> response = api.findPetsByTags(tags);
|
byte[] bytes = serializeJson(pet).getBytes();
|
||||||
|
api.addPetUsingByteArray(bytes);
|
||||||
|
|
||||||
// TODO: test validations
|
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
||||||
|
Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class);
|
||||||
|
assertNotNull(fetched);
|
||||||
|
assertEquals(pet.getId(), fetched.getId());
|
||||||
|
assertNotNull(fetched.getCategory());
|
||||||
|
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find pet by ID
|
|
||||||
*
|
|
||||||
* Returns a single pet
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void getPetByIdTest() throws ApiException {
|
public void testGetPetByIdInObject() throws Exception {
|
||||||
Long petId = null;
|
Pet pet = new Pet();
|
||||||
// Pet response = api.getPetById(petId);
|
pet.setId(TestUtils.nextId());
|
||||||
|
pet.setName("pet " + pet.getId());
|
||||||
|
|
||||||
// TODO: test validations
|
Category category = new Category();
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdatePet() throws Exception {
|
||||||
|
Pet pet = createRandomPet();
|
||||||
|
pet.setName("programmer");
|
||||||
|
|
||||||
|
api.updatePet(pet);
|
||||||
|
|
||||||
|
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 updatePetTest() throws ApiException {
|
public void testFindPetsByStatus() throws Exception {
|
||||||
Pet body = null;
|
Pet pet = createRandomPet();
|
||||||
// api.updatePet(body);
|
pet.setName("programmer");
|
||||||
|
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||||
|
|
||||||
// TODO: test validations
|
api.updatePet(pet);
|
||||||
|
|
||||||
|
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 updatePetWithFormTest() throws ApiException {
|
public void testFindPetsByTags() throws Exception {
|
||||||
Long petId = null;
|
Pet pet = createRandomPet();
|
||||||
String name = null;
|
pet.setName("monster");
|
||||||
String status = null;
|
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||||
// api.updatePetWithForm(petId, name, status);
|
|
||||||
|
|
||||||
// TODO: test validations
|
List<Tag> tags = new ArrayList<Tag>();
|
||||||
|
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 uploadFileTest() throws ApiException {
|
public void testUpdatePetWithForm() throws Exception {
|
||||||
Long petId = null;
|
Pet pet = createRandomPet();
|
||||||
String additionalMetadata = null;
|
pet.setName("frank");
|
||||||
File file = null;
|
api.addPet(pet);
|
||||||
// ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
|
||||||
|
|
||||||
// TODO: test validations
|
Pet fetched = api.getPetById(pet.getId());
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if (mapper == null) {
|
||||||
|
mapper = createObjectMapper();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return mapper.writeValueAsString(o);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T deserializeJson(String json, Class<T> klass) {
|
||||||
|
if (mapper == null) {
|
||||||
|
mapper = createObjectMapper();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return mapper.readValue(json, klass);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectMapper createObjectMapper() {
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.registerModule(new JodaModule());
|
||||||
|
return mapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,83 +1,103 @@
|
|||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
|
import io.swagger.TestUtils;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.client.ApiException;
|
||||||
import io.swagger.client.model.Order;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import io.swagger.client.*;
|
||||||
import java.util.HashMap;
|
import io.swagger.client.api.*;
|
||||||
import java.util.List;
|
import io.swagger.client.auth.*;
|
||||||
|
import io.swagger.client.model.*;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.DateTimeZone;
|
||||||
|
import org.junit.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
|
||||||
* API tests for StoreApi
|
|
||||||
*/
|
|
||||||
public class StoreApiTest {
|
public class StoreApiTest {
|
||||||
|
StoreApi api = null;
|
||||||
|
|
||||||
private final StoreApi api = new StoreApi();
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
api = new StoreApi();
|
||||||
/**
|
// setup authentication
|
||||||
* Delete purchase order by ID
|
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||||
*
|
apiKeyAuth.setApiKey("special-key");
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
// set custom date format that is used by the petstore server
|
||||||
*
|
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void deleteOrderTest() throws ApiException {
|
|
||||||
String orderId = null;
|
|
||||||
// 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 getInventoryTest() throws ApiException {
|
public void testGetInventory() throws Exception {
|
||||||
// Map<String, Integer> response = api.getInventory();
|
Map<String, Integer> inventory = api.getInventory();
|
||||||
|
assertTrue(inventory.keySet().size() > 0);
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 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 getOrderByIdTest() throws ApiException {
|
public void testGetInventoryInObject() throws Exception {
|
||||||
Long orderId = null;
|
Object inventoryObj = api.getInventoryInObject();
|
||||||
// Order response = api.getOrderById(orderId);
|
assertTrue(inventoryObj instanceof Map);
|
||||||
|
|
||||||
// TODO: test validations
|
Map inventoryMap = (Map) inventoryObj;
|
||||||
|
assertTrue(inventoryMap.keySet().size() > 0);
|
||||||
|
|
||||||
|
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
||||||
|
assertTrue(firstEntry.getKey() instanceof String);
|
||||||
|
assertTrue(firstEntry.getValue() instanceof Integer);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPlaceOrder() throws Exception {
|
||||||
|
Order order = createOrder();
|
||||||
|
api.placeOrder(order);
|
||||||
|
|
||||||
|
Order fetched = api.getOrderById(order.getId());
|
||||||
|
assertEquals(order.getId(), fetched.getId());
|
||||||
|
assertEquals(order.getPetId(), fetched.getPetId());
|
||||||
|
assertEquals(order.getQuantity(), fetched.getQuantity());
|
||||||
|
assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Place an order for a pet
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void placeOrderTest() throws ApiException {
|
public void testDeleteOrder() throws Exception {
|
||||||
Order body = null;
|
Order order = createOrder();
|
||||||
// Order response = api.placeOrder(body);
|
api.placeOrder(order);
|
||||||
|
|
||||||
// TODO: test validations
|
Order fetched = api.getOrderById(order.getId());
|
||||||
|
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(new Long(200));
|
||||||
|
order.setQuantity(new Integer(13));
|
||||||
|
order.setShipDate(DateTime.now());
|
||||||
|
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,149 +1,88 @@
|
|||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.TestUtils;
|
||||||
import io.swagger.client.model.User;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import io.swagger.client.api.*;
|
||||||
import java.util.HashMap;
|
import io.swagger.client.auth.*;
|
||||||
import java.util.List;
|
import io.swagger.client.model.*;
|
||||||
import java.util.Map;
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
|
||||||
* API tests for UserApi
|
|
||||||
*/
|
|
||||||
public class UserApiTest {
|
public class UserApiTest {
|
||||||
|
UserApi api = null;
|
||||||
|
|
||||||
private final UserApi api = new UserApi();
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
api = new UserApi();
|
||||||
/**
|
// setup authentication
|
||||||
* Create user
|
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||||
*
|
apiKeyAuth.setApiKey("special-key");
|
||||||
* This can only be done by the logged in user.
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void createUserTest() throws ApiException {
|
|
||||||
User body = null;
|
|
||||||
// api.createUser(body);
|
|
||||||
|
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates list of users with given input array
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithArrayInputTest() throws ApiException {
|
public void testCreateUser() throws Exception {
|
||||||
List<User> body = null;
|
User user = createUser();
|
||||||
// api.createUsersWithArrayInput(body);
|
|
||||||
|
|
||||||
// TODO: test validations
|
api.createUser(user);
|
||||||
|
|
||||||
|
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 createUsersWithListInputTest() throws ApiException {
|
public void testCreateUsersWithArray() throws Exception {
|
||||||
List<User> body = null;
|
User user1 = createUser();
|
||||||
// api.createUsersWithListInput(body);
|
user1.setUsername("user" + user1.getId());
|
||||||
|
User user2 = createUser();
|
||||||
|
user2.setUsername("user" + user2.getId());
|
||||||
|
|
||||||
// TODO: test validations
|
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
||||||
|
|
||||||
|
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 deleteUserTest() throws ApiException {
|
public void testCreateUsersWithList() throws Exception {
|
||||||
String username = null;
|
User user1 = createUser();
|
||||||
// api.deleteUser(username);
|
user1.setUsername("user" + user1.getId());
|
||||||
|
User user2 = createUser();
|
||||||
|
user2.setUsername("user" + user2.getId());
|
||||||
|
|
||||||
// TODO: test validations
|
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
||||||
|
|
||||||
|
User fetched = api.getUserByName(user1.getUsername());
|
||||||
|
assertEquals(user1.getId(), fetched.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get user by user name
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void getUserByNameTest() throws ApiException {
|
public void testLoginUser() throws Exception {
|
||||||
String username = null;
|
User user = createUser();
|
||||||
// User response = api.getUserByName(username);
|
api.createUser(user);
|
||||||
|
|
||||||
// TODO: test validations
|
String token = api.loginUser(user.getUsername(), user.getPassword());
|
||||||
|
assertTrue(token.startsWith("logged in user session:"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs user into the system
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void loginUserTest() throws ApiException {
|
public void logoutUser() throws Exception {
|
||||||
String username = null;
|
api.logoutUser();
|
||||||
String password = null;
|
|
||||||
// String response = api.loginUser(username, password);
|
|
||||||
|
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private User createUser() {
|
||||||
* Logs out current logged in user session
|
User user = new User();
|
||||||
*
|
user.setId(TestUtils.nextId());
|
||||||
*
|
user.setUsername("fred" + user.getId());
|
||||||
*
|
user.setFirstName("Fred");
|
||||||
* @throws ApiException
|
user.setLastName("Meyer");
|
||||||
* if the Api call fails
|
user.setEmail("fred@fredmeyer.com");
|
||||||
*/
|
user.setPassword("xxXXxx");
|
||||||
@Test
|
user.setPhone("408-867-5309");
|
||||||
public void logoutUserTest() throws ApiException {
|
user.setUserStatus(123);
|
||||||
// api.logoutUser();
|
|
||||||
|
|
||||||
// TODO: test validations
|
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,306 +0,0 @@
|
|||||||
package io.swagger.petstore.test;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.*;
|
|
||||||
import com.fasterxml.jackson.databind.*;
|
|
||||||
import com.fasterxml.jackson.datatype.joda.*;
|
|
||||||
|
|
||||||
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.FileWriter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class PetApiTest {
|
|
||||||
private PetApi api;
|
|
||||||
private ObjectMapper mapper;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() {
|
|
||||||
api = new PetApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testApiClient() {
|
|
||||||
// the default api client is used
|
|
||||||
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
|
|
||||||
ApiClient oldClient = api.getApiClient();
|
|
||||||
|
|
||||||
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/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateAndGetPet() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void testCreateAndGetPetWithByteArray() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
byte[] bytes = serializeJson(pet).getBytes();
|
|
||||||
api.addPetUsingByteArray(bytes);
|
|
||||||
|
|
||||||
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
|
||||||
Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class);
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetPetByIdInObject() throws Exception {
|
|
||||||
Pet pet = new Pet();
|
|
||||||
pet.setId(TestUtils.nextId());
|
|
||||||
pet.setName("pet " + pet.getId());
|
|
||||||
|
|
||||||
Category category = new Category();
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdatePet() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("programmer");
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindPetsByStatus() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("programmer");
|
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindPetsByTags() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("monster");
|
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
|
|
||||||
List<Tag> tags = new ArrayList<Tag>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdatePetWithForm() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("frank");
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
|
|
||||||
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) {
|
|
||||||
if (mapper == null) {
|
|
||||||
mapper = createObjectMapper();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return mapper.writeValueAsString(o);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T> T deserializeJson(String json, Class<T> klass) {
|
|
||||||
if (mapper == null) {
|
|
||||||
mapper = createObjectMapper();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return mapper.readValue(json, klass);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObjectMapper createObjectMapper() {
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
|
||||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
|
||||||
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
|
||||||
mapper.registerModule(new JodaModule());
|
|
||||||
return mapper;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
package io.swagger.petstore.test;
|
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
|
||||||
|
|
||||||
import io.swagger.client.*;
|
|
||||||
import io.swagger.client.api.*;
|
|
||||||
import io.swagger.client.auth.*;
|
|
||||||
import io.swagger.client.model.*;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class StoreApiTest {
|
|
||||||
StoreApi api = null;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetInventory() throws Exception {
|
|
||||||
Map<String, Integer> inventory = api.getInventory();
|
|
||||||
assertTrue(inventory.keySet().size() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void testGetInventoryInObject() throws Exception {
|
|
||||||
Object inventoryObj = api.getInventoryInObject();
|
|
||||||
assertTrue(inventoryObj instanceof Map);
|
|
||||||
|
|
||||||
Map inventoryMap = (Map) inventoryObj;
|
|
||||||
assertTrue(inventoryMap.keySet().size() > 0);
|
|
||||||
|
|
||||||
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
|
||||||
assertTrue(firstEntry.getKey() instanceof String);
|
|
||||||
assertTrue(firstEntry.getValue() instanceof Integer);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPlaceOrder() throws Exception {
|
|
||||||
Order order = createOrder();
|
|
||||||
api.placeOrder(order);
|
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
|
||||||
assertEquals(order.getId(), fetched.getId());
|
|
||||||
assertEquals(order.getPetId(), fetched.getPetId());
|
|
||||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteOrder() throws Exception {
|
|
||||||
Order order = createOrder();
|
|
||||||
api.placeOrder(order);
|
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
|
||||||
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(new Long(200));
|
|
||||||
order.setQuantity(new Integer(13));
|
|
||||||
order.setShipDate(new java.util.Date());
|
|
||||||
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 +0,0 @@
|
|||||||
package io.swagger.petstore.test;
|
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
|
||||||
|
|
||||||
import io.swagger.client.api.*;
|
|
||||||
import io.swagger.client.auth.*;
|
|
||||||
import io.swagger.client.model.*;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class UserApiTest {
|
|
||||||
UserApi api = null;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() {
|
|
||||||
api = new UserApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateUser() throws Exception {
|
|
||||||
User user = createUser();
|
|
||||||
|
|
||||||
api.createUser(user);
|
|
||||||
|
|
||||||
User fetched = api.getUserByName(user.getUsername());
|
|
||||||
assertEquals(user.getId(), fetched.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateUsersWithArray() throws Exception {
|
|
||||||
User user1 = createUser();
|
|
||||||
user1.setUsername("user" + user1.getId());
|
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateUsersWithList() throws Exception {
|
|
||||||
User user1 = createUser();
|
|
||||||
user1.setUsername("user" + user1.getId());
|
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLoginUser() throws Exception {
|
|
||||||
User user = createUser();
|
|
||||||
api.createUser(user);
|
|
||||||
|
|
||||||
String token = api.loginUser(user.getUsername(), user.getPassword());
|
|
||||||
assertTrue(token.startsWith("logged in user session:"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void logoutUser() throws Exception {
|
|
||||||
api.logoutUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
private User createUser() {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
swagger_annotations_version = "1.5.0"
|
swagger_annotations_version = "1.5.8"
|
||||||
jackson_version = "2.7.0"
|
jackson_version = "2.7.0"
|
||||||
jersey_version = "2.22.2"
|
jersey_version = "2.22.2"
|
||||||
jodatime_version = "2.9.3"
|
jodatime_version = "2.9.3"
|
||||||
|
@ -32,8 +32,8 @@ Integer int32 = 56; // Integer | None
|
|||||||
Long int64 = 789L; // Long | None
|
Long int64 = 789L; // Long | None
|
||||||
Float _float = 3.4F; // Float | None
|
Float _float = 3.4F; // Float | None
|
||||||
byte[] binary = B; // byte[] | None
|
byte[] binary = B; // byte[] | None
|
||||||
Date date = new Date(); // Date | None
|
LocalDate date = new LocalDate(); // LocalDate | None
|
||||||
Date dateTime = new Date(); // Date | None
|
DateTime dateTime = new DateTime(); // DateTime | None
|
||||||
String password = "password_example"; // String | None
|
String password = "password_example"; // String | None
|
||||||
try {
|
try {
|
||||||
apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
apiInstance.testEndpointParameters(number, _double, string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
@ -56,8 +56,8 @@ Name | Type | Description | Notes
|
|||||||
**int64** | **Long**| None | [optional]
|
**int64** | **Long**| None | [optional]
|
||||||
**_float** | **Float**| None | [optional]
|
**_float** | **Float**| None | [optional]
|
||||||
**binary** | **byte[]**| None | [optional]
|
**binary** | **byte[]**| None | [optional]
|
||||||
**date** | **Date**| None | [optional]
|
**date** | **LocalDate**| None | [optional]
|
||||||
**dateTime** | **Date**| None | [optional]
|
**dateTime** | **DateTime**| None | [optional]
|
||||||
**password** | **String**| None | [optional]
|
**password** | **String**| None | [optional]
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
@ -13,8 +13,8 @@ Name | Type | Description | Notes
|
|||||||
**string** | **String** | | [optional]
|
**string** | **String** | | [optional]
|
||||||
**_byte** | **byte[]** | |
|
**_byte** | **byte[]** | |
|
||||||
**binary** | **byte[]** | | [optional]
|
**binary** | **byte[]** | | [optional]
|
||||||
**date** | [**Date**](Date.md) | |
|
**date** | [**LocalDate**](LocalDate.md) | |
|
||||||
**dateTime** | [**Date**](Date.md) | | [optional]
|
**dateTime** | [**DateTime**](DateTime.md) | | [optional]
|
||||||
**uuid** | **String** | | [optional]
|
**uuid** | **String** | | [optional]
|
||||||
**password** | **String** | |
|
**password** | **String** | |
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**uuid** | **String** | | [optional]
|
**uuid** | **String** | | [optional]
|
||||||
**dateTime** | [**Date**](Date.md) | | [optional]
|
**dateTime** | [**DateTime**](DateTime.md) | | [optional]
|
||||||
**map** | [**Map<String, Animal>**](Animal.md) | | [optional]
|
**map** | [**Map<String, Animal>**](Animal.md) | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
|||||||
**id** | **Long** | | [optional]
|
**id** | **Long** | | [optional]
|
||||||
**petId** | **Long** | | [optional]
|
**petId** | **Long** | | [optional]
|
||||||
**quantity** | **Integer** | | [optional]
|
**quantity** | **Integer** | | [optional]
|
||||||
**shipDate** | [**Date**](Date.md) | | [optional]
|
**shipDate** | [**DateTime**](DateTime.md) | | [optional]
|
||||||
**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional]
|
**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional]
|
||||||
**complete** | **Boolean** | | [optional]
|
**complete** | **Boolean** | | [optional]
|
||||||
|
|
||||||
|
0
samples/client/petstore/java/jersey2/gradlew
vendored
Executable file → Normal file
0
samples/client/petstore/java/jersey2/gradlew
vendored
Executable file → Normal file
@ -1 +0,0 @@
|
|||||||
Hello world!
|
|
@ -48,7 +48,7 @@ import io.swagger.client.auth.HttpBasicAuth;
|
|||||||
import io.swagger.client.auth.ApiKeyAuth;
|
import io.swagger.client.auth.ApiKeyAuth;
|
||||||
import io.swagger.client.auth.OAuth;
|
import io.swagger.client.auth.OAuth;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-03-17T17:22:31.147+08:00")
|
|
||||||
public class ApiClient {
|
public class ApiClient {
|
||||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
private String basePath = "http://petstore.swagger.io/v2";
|
private String basePath = "http://petstore.swagger.io/v2";
|
||||||
@ -84,13 +84,8 @@ public class ApiClient {
|
|||||||
|
|
||||||
// Setup authentications (key: authentication name, value: authentication).
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
authentications = new HashMap<String, Authentication>();
|
authentications = new HashMap<String, Authentication>();
|
||||||
authentications.put("petstore_auth", new OAuth());
|
|
||||||
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
|
|
||||||
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
|
|
||||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||||
authentications.put("test_http_basic", new HttpBasicAuth());
|
authentications.put("petstore_auth", new OAuth());
|
||||||
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
|
|
||||||
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
|
|
||||||
// Prevent the authentications from being modified.
|
// Prevent the authentications from being modified.
|
||||||
authentications = Collections.unmodifiableMap(authentications);
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
}
|
}
|
||||||
|
@ -1,69 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class ApiException extends Exception {
|
public class ApiException extends Exception {
|
||||||
private int code = 0;
|
private int code = 0;
|
||||||
private Map<String, List<String>> responseHeaders = null;
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
private String responseBody = null;
|
private String responseBody = null;
|
||||||
|
|
||||||
public ApiException() {}
|
public ApiException() {}
|
||||||
|
|
||||||
public ApiException(Throwable throwable) {
|
public ApiException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message) {
|
public ApiException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
super(message, throwable);
|
super(message, throwable);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
this(message, throwable, code, responseHeaders, null);
|
this(message, throwable, code, responseHeaders, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(int code, String message) {
|
public ApiException(int code, String message) {
|
||||||
super(message);
|
super(message);
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
this(code, message);
|
this(code, message);
|
||||||
this.responseHeaders = responseHeaders;
|
this.responseHeaders = responseHeaders;
|
||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCode() {
|
/**
|
||||||
return code;
|
* Get the HTTP status code.
|
||||||
}
|
*
|
||||||
|
* @return HTTP status code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response headers.
|
* Get the HTTP response headers.
|
||||||
*/
|
*
|
||||||
public Map<String, List<String>> getResponseHeaders() {
|
* @return A map of list of string
|
||||||
return responseHeaders;
|
*/
|
||||||
}
|
public Map<String, List<String>> getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HTTP response body.
|
* Get the HTTP response body.
|
||||||
*/
|
*
|
||||||
public String getResponseBody() {
|
* @return Response body in the form of string
|
||||||
return responseBody;
|
*/
|
||||||
}
|
public String getResponseBody() {
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
private static ApiClient defaultApiClient = new ApiClient();
|
private static ApiClient defaultApiClient = new ApiClient();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default API client, which would be used when creating API
|
* Get the default API client, which would be used when creating API
|
||||||
* instances without providing an API client.
|
* instances without providing an API client.
|
||||||
*/
|
*
|
||||||
public static ApiClient getDefaultApiClient() {
|
* @return Default API client
|
||||||
return defaultApiClient;
|
*/
|
||||||
}
|
public static ApiClient getDefaultApiClient() {
|
||||||
|
return defaultApiClient;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default API client, which would be used when creating API
|
* Set the default API client, which would be used when creating API
|
||||||
* instances without providing an API client.
|
* instances without providing an API client.
|
||||||
*/
|
*
|
||||||
public static void setDefaultApiClient(ApiClient apiClient) {
|
* @param apiClient API client
|
||||||
defaultApiClient = apiClient;
|
*/
|
||||||
}
|
public static void setDefaultApiClient(ApiClient apiClient) {
|
||||||
|
defaultApiClient = apiClient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import java.text.DateFormat;
|
|||||||
|
|
||||||
import javax.ws.rs.ext.ContextResolver;
|
import javax.ws.rs.ext.ContextResolver;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class JSON implements ContextResolver<ObjectMapper> {
|
public class JSON implements ContextResolver<ObjectMapper> {
|
||||||
private ObjectMapper mapper;
|
private ObjectMapper mapper;
|
||||||
|
|
||||||
|
@ -1,6 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Pair {
|
public class Pair {
|
||||||
private String name = "";
|
private String name = "";
|
||||||
private String value = "";
|
private String value = "";
|
||||||
|
@ -1,6 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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;
|
package io.swagger.client;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class StringUtil {
|
public class StringUtil {
|
||||||
/**
|
/**
|
||||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
@ -7,15 +7,16 @@ import io.swagger.client.Pair;
|
|||||||
|
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
import org.joda.time.LocalDate;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class FakeApi {
|
public class FakeApi {
|
||||||
private ApiClient apiClient;
|
private ApiClient apiClient;
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ public class FakeApi {
|
|||||||
* @param password None (optional)
|
* @param password None (optional)
|
||||||
* @throws ApiException if fails to make API call
|
* @throws ApiException if fails to make API call
|
||||||
*/
|
*/
|
||||||
public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException {
|
public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, LocalDate date, DateTime dateTime, String password) throws ApiException {
|
||||||
Object localVarPostBody = null;
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
// verify the required parameter 'number' is set
|
// verify the required parameter 'number' is set
|
||||||
|
@ -8,15 +8,15 @@ import io.swagger.client.Pair;
|
|||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
import io.swagger.client.model.Pet;
|
import io.swagger.client.model.Pet;
|
||||||
import io.swagger.client.model.ModelApiResponse;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import io.swagger.client.model.ModelApiResponse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
private ApiClient apiClient;
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
private ApiClient apiClient;
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
private ApiClient apiClient;
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
@ -5,7 +30,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class ApiKeyAuth implements Authentication {
|
public class ApiKeyAuth implements Authentication {
|
||||||
private final String location;
|
private final String location;
|
||||||
private final String paramName;
|
private final String paramName;
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
@ -6,6 +31,11 @@ import java.util.Map;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface Authentication {
|
public interface Authentication {
|
||||||
/** Apply authentication settings to header and query params. */
|
/**
|
||||||
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
* Apply authentication settings to header and query params.
|
||||||
|
*
|
||||||
|
* @param queryParams List of query parameters
|
||||||
|
* @param headerParams Map of header parameters
|
||||||
|
*/
|
||||||
|
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
@ -9,7 +34,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class HttpBasicAuth implements Authentication {
|
public class HttpBasicAuth implements Authentication {
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
import io.swagger.client.Pair;
|
import io.swagger.client.Pair;
|
||||||
@ -5,7 +30,7 @@ import io.swagger.client.Pair;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class OAuth implements Authentication {
|
public class OAuth implements Authentication {
|
||||||
private String accessToken;
|
private String accessToken;
|
||||||
|
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.auth;
|
package io.swagger.client.auth;
|
||||||
|
|
||||||
public enum OAuthFlow {
|
public enum OAuthFlow {
|
||||||
|
@ -13,7 +13,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* AdditionalPropertiesClass
|
* AdditionalPropertiesClass
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class AdditionalPropertiesClass {
|
public class AdditionalPropertiesClass {
|
||||||
|
|
||||||
private Map<String, String> mapProperty = new HashMap<String, String>();
|
private Map<String, String> mapProperty = new HashMap<String, String>();
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Animal
|
* Animal
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
|
|
||||||
private String className = null;
|
private String className = null;
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* AnimalFarm
|
* AnimalFarm
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class AnimalFarm extends ArrayList<Animal> {
|
public class AnimalFarm extends ArrayList<Animal> {
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* ArrayTest
|
* ArrayTest
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class ArrayTest {
|
public class ArrayTest {
|
||||||
|
|
||||||
private List<String> arrayOfString = new ArrayList<String>();
|
private List<String> arrayOfString = new ArrayList<String>();
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.client.model.Animal;
|
|||||||
/**
|
/**
|
||||||
* Cat
|
* Cat
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Cat extends Animal {
|
public class Cat extends Animal {
|
||||||
|
|
||||||
private String className = null;
|
private String className = null;
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Category
|
* Category
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Category {
|
public class Category {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.client.model.Animal;
|
|||||||
/**
|
/**
|
||||||
* Dog
|
* Dog
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Dog extends Animal {
|
public class Dog extends Animal {
|
||||||
|
|
||||||
private String className = null;
|
private String className = null;
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* EnumTest
|
* EnumTest
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class EnumTest {
|
public class EnumTest {
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,13 +6,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.LocalDate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormatTest
|
* FormatTest
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class FormatTest {
|
public class FormatTest {
|
||||||
|
|
||||||
private Integer integer = null;
|
private Integer integer = null;
|
||||||
@ -24,8 +25,8 @@ public class FormatTest {
|
|||||||
private String string = null;
|
private String string = null;
|
||||||
private byte[] _byte = null;
|
private byte[] _byte = null;
|
||||||
private byte[] binary = null;
|
private byte[] binary = null;
|
||||||
private Date date = null;
|
private LocalDate date = null;
|
||||||
private Date dateTime = null;
|
private DateTime dateTime = null;
|
||||||
private String uuid = null;
|
private String uuid = null;
|
||||||
private String password = null;
|
private String password = null;
|
||||||
|
|
||||||
@ -195,34 +196,34 @@ public class FormatTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public FormatTest date(Date date) {
|
public FormatTest date(LocalDate date) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", required = true, value = "")
|
@ApiModelProperty(example = "null", required = true, value = "")
|
||||||
@JsonProperty("date")
|
@JsonProperty("date")
|
||||||
public Date getDate() {
|
public LocalDate getDate() {
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
public void setDate(Date date) {
|
public void setDate(LocalDate date) {
|
||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public FormatTest dateTime(Date dateTime) {
|
public FormatTest dateTime(DateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("dateTime")
|
@JsonProperty("dateTime")
|
||||||
public Date getDateTime() {
|
public DateTime getDateTime() {
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
public void setDateTime(Date dateTime) {
|
public void setDateTime(DateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,20 +6,20 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.client.model.Animal;
|
import io.swagger.client.model.Animal;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MixedPropertiesAndAdditionalPropertiesClass
|
* MixedPropertiesAndAdditionalPropertiesClass
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class MixedPropertiesAndAdditionalPropertiesClass {
|
public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||||
|
|
||||||
private String uuid = null;
|
private String uuid = null;
|
||||||
private Date dateTime = null;
|
private DateTime dateTime = null;
|
||||||
private Map<String, Animal> map = new HashMap<String, Animal>();
|
private Map<String, Animal> map = new HashMap<String, Animal>();
|
||||||
|
|
||||||
|
|
||||||
@ -42,17 +42,17 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) {
|
public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("dateTime")
|
@JsonProperty("dateTime")
|
||||||
public Date getDateTime() {
|
public DateTime getDateTime() {
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
public void setDateTime(Date dateTime) {
|
public void setDateTime(DateTime dateTime) {
|
||||||
this.dateTime = dateTime;
|
this.dateTime = dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
* Model for testing model name starting with number
|
* Model for testing model name starting with number
|
||||||
*/
|
*/
|
||||||
@ApiModel(description = "Model for testing model name starting with number")
|
@ApiModel(description = "Model for testing model name starting with number")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Model200Response {
|
public class Model200Response {
|
||||||
|
|
||||||
private Integer name = null;
|
private Integer name = null;
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* ModelApiResponse
|
* ModelApiResponse
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class ModelApiResponse {
|
public class ModelApiResponse {
|
||||||
|
|
||||||
private Integer code = null;
|
private Integer code = null;
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
* Model for testing reserved words
|
* Model for testing reserved words
|
||||||
*/
|
*/
|
||||||
@ApiModel(description = "Model for testing reserved words")
|
@ApiModel(description = "Model for testing reserved words")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class ModelReturn {
|
public class ModelReturn {
|
||||||
|
|
||||||
private Integer _return = null;
|
private Integer _return = null;
|
||||||
|
@ -11,7 +11,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
* Model for testing model name same as property name
|
* Model for testing model name same as property name
|
||||||
*/
|
*/
|
||||||
@ApiModel(description = "Model for testing model name same as property name")
|
@ApiModel(description = "Model for testing model name same as property name")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Name {
|
public class Name {
|
||||||
|
|
||||||
private Integer name = null;
|
private Integer name = null;
|
||||||
|
@ -6,19 +6,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.util.Date;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order
|
* Order
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Order {
|
public class Order {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
private Long petId = null;
|
private Long petId = null;
|
||||||
private Integer quantity = null;
|
private Integer quantity = null;
|
||||||
private Date shipDate = null;
|
private DateTime shipDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order Status
|
* Order Status
|
||||||
@ -98,17 +98,17 @@ public class Order {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
public Order shipDate(Date shipDate) {
|
public Order shipDate(DateTime shipDate) {
|
||||||
this.shipDate = shipDate;
|
this.shipDate = shipDate;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("shipDate")
|
@JsonProperty("shipDate")
|
||||||
public Date getShipDate() {
|
public DateTime getShipDate() {
|
||||||
return shipDate;
|
return shipDate;
|
||||||
}
|
}
|
||||||
public void setShipDate(Date shipDate) {
|
public void setShipDate(DateTime shipDate) {
|
||||||
this.shipDate = shipDate;
|
this.shipDate = shipDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Pet
|
* Pet
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Pet {
|
public class Pet {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* ReadOnlyFirst
|
* ReadOnlyFirst
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class ReadOnlyFirst {
|
public class ReadOnlyFirst {
|
||||||
|
|
||||||
private String bar = null;
|
private String bar = null;
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* SpecialModelName
|
* SpecialModelName
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class SpecialModelName {
|
public class SpecialModelName {
|
||||||
|
|
||||||
private Long specialPropertyName = null;
|
private Long specialPropertyName = null;
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* Tag
|
* Tag
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class Tag {
|
public class Tag {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
/**
|
/**
|
||||||
* User
|
* User
|
||||||
*/
|
*/
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-06-03T00:41:43.242+08:00")
|
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -111,6 +111,7 @@ public class ApiClientTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore("There is no more basic auth in petstore security definitions")
|
||||||
@Test
|
@Test
|
||||||
public void testSetUsernameAndPassword() {
|
public void testSetUsernameAndPassword() {
|
||||||
HttpBasicAuth auth = null;
|
HttpBasicAuth auth = null;
|
||||||
|
@ -3,10 +3,10 @@ package io.swagger.client;
|
|||||||
import io.swagger.client.model.Order;
|
import io.swagger.client.model.Order;
|
||||||
|
|
||||||
import java.lang.Exception;
|
import java.lang.Exception;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
|
import org.joda.time.DateTimeZone;
|
||||||
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
|
import org.joda.time.format.ISODateTimeFormat;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
@ -23,26 +23,23 @@ public class JSONTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultDate() throws Exception {
|
public void testDefaultDate() throws Exception {
|
||||||
final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
final DateTimeFormatter dateFormat = ISODateTimeFormat.dateTime();
|
||||||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
||||||
final String dateStr = "2015-11-07T14:11:05.267Z";
|
final String dateStr = "2015-11-07T14:11:05.267Z";
|
||||||
order.setShipDate(dateFormat.parse(dateStr));
|
order.setShipDate(dateFormat.parseDateTime(dateStr));
|
||||||
|
|
||||||
String str = json.getContext(null).writeValueAsString(order);
|
String str = json.getContext(null).writeValueAsString(order);
|
||||||
Order o = json.getContext(null).readValue(str, Order.class);
|
Order o = json.getContext(null).readValue(str, Order.class);
|
||||||
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
|
assertEquals(dateStr, dateFormat.print(o.getShipDate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomDate() throws Exception {
|
public void testCustomDate() throws Exception {
|
||||||
final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
|
final DateTimeFormatter dateFormat = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.forID("Etc/GMT+2"));
|
||||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT-2"));
|
|
||||||
final String dateStr = "2015-11-07T14:11:05-02:00";
|
final String dateStr = "2015-11-07T14:11:05-02:00";
|
||||||
order.setShipDate(dateFormat.parse(dateStr));
|
order.setShipDate(dateFormat.parseDateTime(dateStr));
|
||||||
|
|
||||||
json.setDateFormat(dateFormat);
|
|
||||||
String str = json.getContext(null).writeValueAsString(order);
|
String str = json.getContext(null).writeValueAsString(order);
|
||||||
Order o = json.getContext(null).readValue(str, Order.class);
|
Order o = json.getContext(null).readValue(str, Order.class);
|
||||||
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
|
assertEquals(dateStr, dateFormat.print(o.getShipDate()));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,155 +1,288 @@
|
|||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.swagger.client.model.Pet;
|
|
||||||
import io.swagger.client.model.ModelApiResponse;
|
|
||||||
import java.io.File;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
|
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.FileWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
import org.junit.*;
|
||||||
* API tests for PetApi
|
import static org.junit.Assert.*;
|
||||||
*/
|
|
||||||
public class PetApiTest {
|
public class PetApiTest {
|
||||||
|
PetApi api = null;
|
||||||
|
|
||||||
private final PetApi api = new PetApi();
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
api = new PetApi();
|
||||||
/**
|
// setup authentication
|
||||||
* Add a new pet to the store
|
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||||
*
|
apiKeyAuth.setApiKey("special-key");
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void addPetTest() throws ApiException {
|
|
||||||
Pet body = null;
|
|
||||||
// api.addPet(body);
|
|
||||||
|
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes a pet
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void deletePetTest() throws ApiException {
|
public void testApiClient() {
|
||||||
Long petId = null;
|
// the default api client is used
|
||||||
String apiKey = null;
|
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
||||||
// api.deletePet(petId, apiKey);
|
assertNotNull(api.getApiClient());
|
||||||
|
assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath());
|
||||||
|
assertFalse(api.getApiClient().isDebugging());
|
||||||
|
|
||||||
// TODO: test validations
|
ApiClient oldClient = api.getApiClient();
|
||||||
|
|
||||||
|
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/v2", api.getApiClient().getBasePath());
|
||||||
|
assertFalse(api.getApiClient().isDebugging());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 findPetsByStatusTest() throws ApiException {
|
public void testCreateAndGetPet() throws Exception {
|
||||||
List<String> status = null;
|
Pet pet = createRandomPet();
|
||||||
// List<Pet> response = api.findPetsByStatus(status);
|
api.addPet(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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 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 findPetsByTagsTest() throws ApiException {
|
public void testCreateAndGetPetWithByteArray() throws Exception {
|
||||||
List<String> tags = null;
|
Pet pet = createRandomPet();
|
||||||
// List<Pet> response = api.findPetsByTags(tags);
|
byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes();
|
||||||
|
api.addPetUsingByteArray(bytes);
|
||||||
|
|
||||||
// TODO: test validations
|
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
||||||
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find pet by ID
|
|
||||||
*
|
|
||||||
* Returns a single pet
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void getPetByIdTest() throws ApiException {
|
public void testGetPetByIdInObject() throws Exception {
|
||||||
Long petId = null;
|
Pet pet = new Pet();
|
||||||
// Pet response = api.getPetById(petId);
|
pet.setId(TestUtils.nextId());
|
||||||
|
pet.setName("pet " + pet.getId());
|
||||||
|
|
||||||
// TODO: test validations
|
Category category = new Category();
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdatePet() throws Exception {
|
||||||
|
Pet pet = createRandomPet();
|
||||||
|
pet.setName("programmer");
|
||||||
|
|
||||||
|
api.updatePet(pet);
|
||||||
|
|
||||||
|
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 updatePetTest() throws ApiException {
|
public void testFindPetsByStatus() throws Exception {
|
||||||
Pet body = null;
|
Pet pet = createRandomPet();
|
||||||
// api.updatePet(body);
|
pet.setName("programmer");
|
||||||
|
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||||
|
|
||||||
// TODO: test validations
|
api.updatePet(pet);
|
||||||
|
|
||||||
|
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 updatePetWithFormTest() throws ApiException {
|
public void testFindPetsByTags() throws Exception {
|
||||||
Long petId = null;
|
Pet pet = createRandomPet();
|
||||||
String name = null;
|
pet.setName("monster");
|
||||||
String status = null;
|
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||||
// api.updatePetWithForm(petId, name, status);
|
|
||||||
|
|
||||||
// TODO: test validations
|
List<Tag> tags = new ArrayList<Tag>();
|
||||||
|
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 uploadFileTest() throws ApiException {
|
public void testUpdatePetWithForm() throws Exception {
|
||||||
Long petId = null;
|
Pet pet = createRandomPet();
|
||||||
String additionalMetadata = null;
|
pet.setName("frank");
|
||||||
File file = null;
|
api.addPet(pet);
|
||||||
// ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
|
||||||
|
|
||||||
// TODO: test validations
|
Pet fetched = api.getPetById(pet.getId());
|
||||||
|
|
||||||
|
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,83 +1,100 @@
|
|||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.TestUtils;
|
||||||
import io.swagger.client.model.Order;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import io.swagger.client.*;
|
||||||
import java.util.HashMap;
|
import io.swagger.client.auth.*;
|
||||||
import java.util.List;
|
import io.swagger.client.model.*;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.DateTimeZone;
|
||||||
|
import org.junit.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
|
||||||
* API tests for StoreApi
|
|
||||||
*/
|
|
||||||
public class StoreApiTest {
|
public class StoreApiTest {
|
||||||
|
StoreApi api = null;
|
||||||
|
|
||||||
private final StoreApi api = new StoreApi();
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
api = new StoreApi();
|
||||||
/**
|
// setup authentication
|
||||||
* Delete purchase order by ID
|
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||||
*
|
apiKeyAuth.setApiKey("special-key");
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
// set custom date format that is used by the petstore server
|
||||||
*
|
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void deleteOrderTest() throws ApiException {
|
|
||||||
String orderId = null;
|
|
||||||
// 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 getInventoryTest() throws ApiException {
|
public void testGetInventory() throws Exception {
|
||||||
// Map<String, Integer> response = api.getInventory();
|
Map<String, Integer> inventory = api.getInventory();
|
||||||
|
assertTrue(inventory.keySet().size() > 0);
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 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 getOrderByIdTest() throws ApiException {
|
public void testGetInventoryInObject() throws Exception {
|
||||||
Long orderId = null;
|
Object inventoryObj = api.getInventoryInObject();
|
||||||
// Order response = api.getOrderById(orderId);
|
assertTrue(inventoryObj instanceof Map);
|
||||||
|
|
||||||
// TODO: test validations
|
Map inventoryMap = (Map) inventoryObj;
|
||||||
|
assertTrue(inventoryMap.keySet().size() > 0);
|
||||||
|
|
||||||
|
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
||||||
|
assertTrue(firstEntry.getKey() instanceof String);
|
||||||
|
assertTrue(firstEntry.getValue() instanceof Integer);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPlaceOrder() throws Exception {
|
||||||
|
Order order = createOrder();
|
||||||
|
api.placeOrder(order);
|
||||||
|
|
||||||
|
Order fetched = api.getOrderById(order.getId());
|
||||||
|
assertEquals(order.getId(), fetched.getId());
|
||||||
|
assertEquals(order.getPetId(), fetched.getPetId());
|
||||||
|
assertEquals(order.getQuantity(), fetched.getQuantity());
|
||||||
|
assertEquals(order.getShipDate().withZone(DateTimeZone.UTC), fetched.getShipDate().withZone(DateTimeZone.UTC));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Place an order for a pet
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void placeOrderTest() throws ApiException {
|
public void testDeleteOrder() throws Exception {
|
||||||
Order body = null;
|
Order order = createOrder();
|
||||||
// Order response = api.placeOrder(body);
|
api.placeOrder(order);
|
||||||
|
|
||||||
// TODO: test validations
|
Order fetched = api.getOrderById(order.getId());
|
||||||
|
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(new Long(200));
|
||||||
|
order.setQuantity(new Integer(13));
|
||||||
|
order.setShipDate(DateTime.now());
|
||||||
|
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,149 +1,88 @@
|
|||||||
package io.swagger.client.api;
|
package io.swagger.client.api;
|
||||||
|
|
||||||
import io.swagger.client.ApiException;
|
import io.swagger.TestUtils;
|
||||||
import io.swagger.client.model.User;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import io.swagger.client.api.*;
|
||||||
import java.util.HashMap;
|
import io.swagger.client.auth.*;
|
||||||
import java.util.List;
|
import io.swagger.client.model.*;
|
||||||
import java.util.Map;
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
|
||||||
* API tests for UserApi
|
|
||||||
*/
|
|
||||||
public class UserApiTest {
|
public class UserApiTest {
|
||||||
|
UserApi api = null;
|
||||||
|
|
||||||
private final UserApi api = new UserApi();
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
api = new UserApi();
|
||||||
/**
|
// setup authentication
|
||||||
* Create user
|
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||||
*
|
apiKeyAuth.setApiKey("special-key");
|
||||||
* This can only be done by the logged in user.
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void createUserTest() throws ApiException {
|
|
||||||
User body = null;
|
|
||||||
// api.createUser(body);
|
|
||||||
|
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates list of users with given input array
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void createUsersWithArrayInputTest() throws ApiException {
|
public void testCreateUser() throws Exception {
|
||||||
List<User> body = null;
|
User user = createUser();
|
||||||
// api.createUsersWithArrayInput(body);
|
|
||||||
|
|
||||||
// TODO: test validations
|
api.createUser(user);
|
||||||
|
|
||||||
|
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 createUsersWithListInputTest() throws ApiException {
|
public void testCreateUsersWithArray() throws Exception {
|
||||||
List<User> body = null;
|
User user1 = createUser();
|
||||||
// api.createUsersWithListInput(body);
|
user1.setUsername("user" + user1.getId());
|
||||||
|
User user2 = createUser();
|
||||||
|
user2.setUsername("user" + user2.getId());
|
||||||
|
|
||||||
// TODO: test validations
|
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
||||||
|
|
||||||
|
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 deleteUserTest() throws ApiException {
|
public void testCreateUsersWithList() throws Exception {
|
||||||
String username = null;
|
User user1 = createUser();
|
||||||
// api.deleteUser(username);
|
user1.setUsername("user" + user1.getId());
|
||||||
|
User user2 = createUser();
|
||||||
|
user2.setUsername("user" + user2.getId());
|
||||||
|
|
||||||
// TODO: test validations
|
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
||||||
|
|
||||||
|
User fetched = api.getUserByName(user1.getUsername());
|
||||||
|
assertEquals(user1.getId(), fetched.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get user by user name
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void getUserByNameTest() throws ApiException {
|
public void testLoginUser() throws Exception {
|
||||||
String username = null;
|
User user = createUser();
|
||||||
// User response = api.getUserByName(username);
|
api.createUser(user);
|
||||||
|
|
||||||
// TODO: test validations
|
String token = api.loginUser(user.getUsername(), user.getPassword());
|
||||||
|
assertTrue(token.startsWith("logged in user session:"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs user into the system
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws ApiException
|
|
||||||
* if the Api call fails
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void loginUserTest() throws ApiException {
|
public void logoutUser() throws Exception {
|
||||||
String username = null;
|
api.logoutUser();
|
||||||
String password = null;
|
|
||||||
// String response = api.loginUser(username, password);
|
|
||||||
|
|
||||||
// TODO: test validations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private User createUser() {
|
||||||
* Logs out current logged in user session
|
User user = new User();
|
||||||
*
|
user.setId(TestUtils.nextId());
|
||||||
*
|
user.setUsername("fred" + user.getId());
|
||||||
*
|
user.setFirstName("Fred");
|
||||||
* @throws ApiException
|
user.setLastName("Meyer");
|
||||||
* if the Api call fails
|
user.setEmail("fred@fredmeyer.com");
|
||||||
*/
|
user.setPassword("xxXXxx");
|
||||||
@Test
|
user.setPhone("408-867-5309");
|
||||||
public void logoutUserTest() throws ApiException {
|
user.setUserStatus(123);
|
||||||
// api.logoutUser();
|
|
||||||
|
|
||||||
// TODO: test validations
|
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,288 +0,0 @@
|
|||||||
package io.swagger.petstore.test;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
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.FileWriter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class PetApiTest {
|
|
||||||
PetApi api = null;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() {
|
|
||||||
api = new PetApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testApiClient() {
|
|
||||||
// the default api client is used
|
|
||||||
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
|
||||||
assertNotNull(api.getApiClient());
|
|
||||||
assertEquals("http://petstore.swagger.io/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
|
|
||||||
ApiClient oldClient = api.getApiClient();
|
|
||||||
|
|
||||||
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/v2", api.getApiClient().getBasePath());
|
|
||||||
assertFalse(api.getApiClient().isDebugging());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateAndGetPet() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void testCreateAndGetPetWithByteArray() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
byte[] bytes = serializeJson(pet, api.getApiClient()).getBytes();
|
|
||||||
api.addPetUsingByteArray(bytes);
|
|
||||||
|
|
||||||
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetPetByIdInObject() throws Exception {
|
|
||||||
Pet pet = new Pet();
|
|
||||||
pet.setId(TestUtils.nextId());
|
|
||||||
pet.setName("pet " + pet.getId());
|
|
||||||
|
|
||||||
Category category = new Category();
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdatePet() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("programmer");
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
assertNotNull(fetched);
|
|
||||||
assertEquals(pet.getId(), fetched.getId());
|
|
||||||
assertNotNull(fetched.getCategory());
|
|
||||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindPetsByStatus() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("programmer");
|
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
|
|
||||||
api.updatePet(pet);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindPetsByTags() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("monster");
|
|
||||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
|
||||||
|
|
||||||
List<Tag> tags = new ArrayList<Tag>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUpdatePetWithForm() throws Exception {
|
|
||||||
Pet pet = createRandomPet();
|
|
||||||
pet.setName("frank");
|
|
||||||
api.addPet(pet);
|
|
||||||
|
|
||||||
Pet fetched = api.getPetById(pet.getId());
|
|
||||||
|
|
||||||
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,98 +0,0 @@
|
|||||||
package io.swagger.petstore.test;
|
|
||||||
|
|
||||||
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.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class StoreApiTest {
|
|
||||||
StoreApi api = null;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetInventory() throws Exception {
|
|
||||||
Map<String, Integer> inventory = api.getInventory();
|
|
||||||
assertTrue(inventory.keySet().size() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void testGetInventoryInObject() throws Exception {
|
|
||||||
Object inventoryObj = api.getInventoryInObject();
|
|
||||||
assertTrue(inventoryObj instanceof Map);
|
|
||||||
|
|
||||||
Map inventoryMap = (Map) inventoryObj;
|
|
||||||
assertTrue(inventoryMap.keySet().size() > 0);
|
|
||||||
|
|
||||||
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
|
||||||
assertTrue(firstEntry.getKey() instanceof String);
|
|
||||||
assertTrue(firstEntry.getValue() instanceof Integer);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPlaceOrder() throws Exception {
|
|
||||||
Order order = createOrder();
|
|
||||||
api.placeOrder(order);
|
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
|
||||||
assertEquals(order.getId(), fetched.getId());
|
|
||||||
assertEquals(order.getPetId(), fetched.getPetId());
|
|
||||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDeleteOrder() throws Exception {
|
|
||||||
Order order = createOrder();
|
|
||||||
api.placeOrder(order);
|
|
||||||
|
|
||||||
Order fetched = api.getOrderById(order.getId());
|
|
||||||
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(new Long(200));
|
|
||||||
order.setQuantity(new Integer(13));
|
|
||||||
order.setShipDate(new java.util.Date());
|
|
||||||
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 +0,0 @@
|
|||||||
package io.swagger.petstore.test;
|
|
||||||
|
|
||||||
import io.swagger.TestUtils;
|
|
||||||
|
|
||||||
import io.swagger.client.api.*;
|
|
||||||
import io.swagger.client.auth.*;
|
|
||||||
import io.swagger.client.model.*;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.junit.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class UserApiTest {
|
|
||||||
UserApi api = null;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setup() {
|
|
||||||
api = new UserApi();
|
|
||||||
// setup authentication
|
|
||||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
|
||||||
apiKeyAuth.setApiKey("special-key");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateUser() throws Exception {
|
|
||||||
User user = createUser();
|
|
||||||
|
|
||||||
api.createUser(user);
|
|
||||||
|
|
||||||
User fetched = api.getUserByName(user.getUsername());
|
|
||||||
assertEquals(user.getId(), fetched.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateUsersWithArray() throws Exception {
|
|
||||||
User user1 = createUser();
|
|
||||||
user1.setUsername("user" + user1.getId());
|
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCreateUsersWithList() throws Exception {
|
|
||||||
User user1 = createUser();
|
|
||||||
user1.setUsername("user" + user1.getId());
|
|
||||||
User user2 = createUser();
|
|
||||||
user2.setUsername("user" + user2.getId());
|
|
||||||
|
|
||||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
|
||||||
|
|
||||||
User fetched = api.getUserByName(user1.getUsername());
|
|
||||||
assertEquals(user1.getId(), fetched.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLoginUser() throws Exception {
|
|
||||||
User user = createUser();
|
|
||||||
api.createUser(user);
|
|
||||||
|
|
||||||
String token = api.loginUser(user.getUsername(), user.getPassword());
|
|
||||||
assertTrue(token.startsWith("logged in user session:"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void logoutUser() throws Exception {
|
|
||||||
api.logoutUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
private User createUser() {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user