From 817cd7f314a8ec264ac01b107b3bdc315d109973 Mon Sep 17 00:00:00 2001 From: Jeremie Bresson Date: Wed, 21 Mar 2018 22:59:16 +0100 Subject: [PATCH 1/3] Mark JavaCXFClientCodegen as deprecated --- .../io/swagger/codegen/languages/JavaCXFClientCodegen.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java index 528a3a1b408..f37e19af615 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java @@ -20,6 +20,11 @@ import io.swagger.codegen.languages.features.LoggingTestFeatures; import io.swagger.codegen.languages.features.UseGenericResponseFeatures; +/** + * new version of this class can be found on: https://github.com/swagger-api/swagger-codegen-generators + * @deprecated use io.swagger.codegen.languages.java.JavaCXFClientCodegen instead. + */ +@Deprecated public class JavaCXFClientCodegen extends AbstractJavaCodegen implements BeanValidationFeatures, UseGenericResponseFeatures, GzipTestFeatures, LoggingTestFeatures { From 045df390570e76945b113e261c641b460af92b6b Mon Sep 17 00:00:00 2001 From: Jeremie Bresson Date: Thu, 22 Mar 2018 06:50:47 +0100 Subject: [PATCH 2/3] Update scripts for "jaxrs-cxf-client" --- bin/jaxrs-cxf-client-petstore.sh | 4 ++-- bin/windows/jaxrs-cxf-client-petstore.bat | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/jaxrs-cxf-client-petstore.sh b/bin/jaxrs-cxf-client-petstore.sh index 4209324083c..aee0fdc6f1f 100755 --- a/bin/jaxrs-cxf-client-petstore.sh +++ b/bin/jaxrs-cxf-client-petstore.sh @@ -26,6 +26,6 @@ fi # 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" -ags="$@ generate --artifact-id "jaxrs-cxf-petstore-client" -t modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/ -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf -o samples/client/petstore/jaxrs-cxf-client/" +ags="$@ generate --artifact-id "jaxrs-cxf-petstore-client" -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf-client -o samples/client/petstore/jaxrs-cxf-client/" -# java $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/jaxrs-cxf-client-petstore.bat b/bin/windows/jaxrs-cxf-client-petstore.bat index f3cad1e7845..88f9b06a909 100755 --- a/bin/windows/jaxrs-cxf-client-petstore.bat +++ b/bin/windows/jaxrs-cxf-client-petstore.bat @@ -7,4 +7,4 @@ If Not Exist %executable% ( REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l jaxrs-cxf-client -o samples\client\petstore\jaxrs-cxf-client -REM java %JAVA_OPTS% -jar %executable% %ags% +java %JAVA_OPTS% -jar %executable% %ags% From 9d78fb3cfce77d00a19690768ef2a234039ac953 Mon Sep 17 00:00:00 2001 From: Jeremie Bresson Date: Sun, 25 Mar 2018 15:03:46 +0200 Subject: [PATCH 3/3] Update 'jaxrs-cxf-client' sample --- .../jaxrs-cxf-client/.swagger-codegen-ignore | 2 - .../jaxrs-cxf-client/.swagger-codegen/VERSION | 2 +- .../client/petstore/jaxrs-cxf-client/pom.xml | 49 +++--- .../src/gen/java/io/swagger/api/PetApi.java | 118 ++++++++++---- .../src/gen/java/io/swagger/api/StoreApi.java | 60 ++++++-- .../src/gen/java/io/swagger/api/UserApi.java | 116 ++++++++++---- .../gen/java/io/swagger/model/Category.java | 47 +++++- .../io/swagger/model/ModelApiResponse.java | 63 +++++++- .../src/gen/java/io/swagger/model/Order.java | 116 +++++++++++++- .../src/gen/java/io/swagger/model/Pet.java | 118 +++++++++++++- .../src/gen/java/io/swagger/model/Tag.java | 47 +++++- .../src/gen/java/io/swagger/model/User.java | 144 +++++++++++++++++- .../swagger/api/impl/PetApiServiceImpl.java | 71 --------- .../swagger/api/impl/StoreApiServiceImpl.java | 46 ------ .../swagger/api/impl/UserApiServiceImpl.java | 70 --------- .../test/java/io/swagger/api/PetApiTest.java | 106 +++++++++---- .../java/io/swagger/api/StoreApiTest.java | 54 ++++++- .../test/java/io/swagger/api/UserApiTest.java | 86 +++++++++-- 18 files changed, 958 insertions(+), 357 deletions(-) delete mode 100644 samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java delete mode 100644 samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java delete mode 100644 samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java diff --git a/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore b/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore index 70b88e71039..c5fa491b4c5 100644 --- a/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore +++ b/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen-ignore @@ -21,5 +21,3 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md - -**/impl/* \ No newline at end of file diff --git a/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen/VERSION b/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen/VERSION index 50794f17f1a..096bf47efe3 100644 --- a/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen/VERSION +++ b/samples/client/petstore/jaxrs-cxf-client/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/jaxrs-cxf-client/pom.xml b/samples/client/petstore/jaxrs-cxf-client/pom.xml index e2be3c4f26b..4ec587d5069 100644 --- a/samples/client/petstore/jaxrs-cxf-client/pom.xml +++ b/samples/client/petstore/jaxrs-cxf-client/pom.xml @@ -2,9 +2,11 @@ 4.0.0 io.swagger jaxrs-cxf-petstore-client - war + jar jaxrs-cxf-petstore-client + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + 1.0.0 src/main/java @@ -33,10 +35,11 @@ 8079 stopit - 8080 + 60000 + start-jetty @@ -77,15 +80,6 @@ - - - - maven-war-plugin - 3.1.0 - - false - - @@ -113,13 +107,7 @@ ${junit-version} test - - - javax.validation - validation-api - ${beanvalidation-version} - provided - + org.apache.cxf @@ -141,12 +129,6 @@ ${cxf-version} compile - - org.apache.cxf - cxf-rt-rs-service-description-swagger - ${cxf-version} - compile - org.apache.cxf cxf-rt-ws-policy @@ -165,12 +147,15 @@ ${jackson-jaxrs-version} compile + + - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-jaxrs-version} - compile + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-jaxrs-version} + + @@ -185,14 +170,14 @@ 1.7 ${java.version} ${java.version} - 1.5.15 + 1.5.18 9.2.9.v20150224 4.12 1.1.7 2.5 - 1.1.0.Final - 3.1.11 - 2.8.9 + + 3.2.1 + 2.9.1 UTF-8 diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java index f8b8a10d288..dd4e3196dc3 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java @@ -1,9 +1,9 @@ package io.swagger.api; -import java.io.File; import io.swagger.model.ModelApiResponse; import io.swagger.model.Pet; + import java.io.InputStream; import java.io.OutputStream; import java.util.List; @@ -18,139 +18,191 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; -import javax.validation.constraints.*; -import javax.validation.Valid; + + /** * Swagger Petstore * + *

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * + */ + @Path("/") @Api(value = "/", description = "") + public interface PetApi { + + + /** * Add a new pet to the store * - * - * + */ + @POST @Path("/pet") + @Consumes({ "application/json", "application/xml" }) - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Add a new pet to the store", tags={ "pet", }) + + + @ApiOperation(value = "Add a new pet to the store", tags={ }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) - public void addPet(@Valid Pet body); + public void addPet(Pet pet); + + /** * Deletes a pet * - * - * + */ + @DELETE @Path("/pet/{petId}") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Deletes a pet", tags={ "pet", }) + + + @ApiOperation(value = "Deletes a pet", tags={ }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value") }) - public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); + public void deletePet(@PathParam("petId") Integer petId, @HeaderParam("api_key") String apiKey); + + /** * Finds Pets by status * + * Multiple status values can be provided with comma separated strings * + */ + @GET @Path("/pet/findByStatus") + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Finds Pets by status", tags={ "pet", }) + + @ApiOperation(value = "Finds Pets by status", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value") }) - public List findPetsByStatus(@QueryParam("status") @NotNull List status); + public List findPetsByStatus(@QueryParam("status")List status); + + /** * Finds Pets by tags * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * + */ + @GET @Path("/pet/findByTags") + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Finds Pets by tags", tags={ "pet", }) + + @ApiOperation(value = "Finds Pets by tags", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value") }) - public List findPetsByTags(@QueryParam("tags") @NotNull List tags); + public List findPetsByTags(@QueryParam("tags")List tags); + + /** * Find pet by ID * + * Returns a single pet * + */ + @GET @Path("/pet/{petId}") + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Find pet by ID", tags={ "pet", }) + + @ApiOperation(value = "Find pet by ID", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Pet not found") }) - public Pet getPetById(@PathParam("petId") Long petId); + public Pet getPetById(@PathParam("petId") Integer petId); + + /** * Update an existing pet * - * - * + */ + @PUT @Path("/pet") + @Consumes({ "application/json", "application/xml" }) - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Update an existing pet", tags={ "pet", }) + + + @ApiOperation(value = "Update an existing pet", tags={ }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Pet not found"), @ApiResponse(code = 405, message = "Validation exception") }) - public void updatePet(@Valid Pet body); + public void updatePet(Pet pet); + + /** * Updates a pet in the store with form data * - * - * + */ + @POST @Path("/pet/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", }) + + + @ApiOperation(value = "Updates a pet in the store with form data", tags={ }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) - public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status); + public void updatePetWithForm(@PathParam("petId") Integer petId, Object body); + + /** * uploads an image * - * - * + */ + @POST @Path("/pet/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + + @Produces({ "application/json" }) - @ApiOperation(value = "uploads an image", tags={ "pet" }) + + @ApiOperation(value = "uploads an image", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail); + public ModelApiResponse uploadFile(@PathParam("petId") Integer petId, Object body); + } + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java index 72508ea286a..ec526f57623 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java @@ -1,8 +1,8 @@ package io.swagger.api; -import java.util.Map; import io.swagger.model.Order; + import java.io.InputStream; import java.io.OutputStream; import java.util.List; @@ -17,77 +17,113 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; -import javax.validation.constraints.*; -import javax.validation.Valid; + + /** * Swagger Petstore * + *

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * + */ + @Path("/") @Api(value = "/", description = "") + public interface StoreApi { + + + /** * Delete purchase order by ID * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * + */ + @DELETE @Path("/store/order/{orderId}") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Delete purchase order by ID", tags={ "store", }) + + + @ApiOperation(value = "Delete purchase order by ID", tags={ }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Order not found") }) public void deleteOrder(@PathParam("orderId") String orderId); + + /** * Returns pet inventories by status * + * Returns a map of status codes to quantities * + */ + @GET @Path("/store/inventory") + + @Produces({ "application/json" }) - @ApiOperation(value = "Returns pet inventories by status", tags={ "store", }) + + @ApiOperation(value = "Returns pet inventories by status", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) public Map getInventory(); + + /** * Find purchase order by ID * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * + */ + @GET @Path("/store/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Find purchase order by ID", tags={ "store", }) + + @ApiOperation(value = "Find purchase order by ID", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Order not found") }) - public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId); + public Order getOrderById(@PathParam("orderId") Integer orderId); + + /** * Place an order for a pet * - * - * + */ + @POST @Path("/store/order") + + @Consumes({ "*/*" }) + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Place an order for a pet", tags={ "store" }) + + @ApiOperation(value = "Place an order for a pet", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order") }) - public Order placeOrder(@Valid Order body); + public Order placeOrder(Order order); + } + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java index 7aba6911b46..a4410d32e56 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java @@ -1,8 +1,8 @@ package io.swagger.api; -import java.util.List; import io.swagger.model.User; + import java.io.InputStream; import java.io.OutputStream; import java.util.List; @@ -17,134 +17,186 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; -import javax.validation.constraints.*; -import javax.validation.Valid; + + /** * Swagger Petstore * + *

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. * + */ + @Path("/") @Api(value = "/", description = "") + public interface UserApi { + + + /** * Create user * + * This can only be done by the logged in user. * + */ + @POST @Path("/user") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Create user", tags={ "user", }) + + @Consumes({ "*/*" }) + + + @ApiOperation(value = "Create user", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUser(@Valid User body); + public void createUser(User user); + + /** * Creates list of users with given input array * - * - * + */ + @POST @Path("/user/createWithArray") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) + + @Consumes({ "*/*" }) + + + @ApiOperation(value = "Creates list of users with given input array", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUsersWithArrayInput(@Valid List body); + public void createUsersWithArrayInput(List body); + + /** * Creates list of users with given input array * - * - * + */ + @POST @Path("/user/createWithList") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) + + @Consumes({ "*/*" }) + + + @ApiOperation(value = "Creates list of users with given input array", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUsersWithListInput(@Valid List body); + public void createUsersWithListInput(List body); + + /** * Delete user * + * This can only be done by the logged in user. * + */ + @DELETE @Path("/user/{username}") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Delete user", tags={ "user", }) + + + @ApiOperation(value = "Delete user", tags={ }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public void deleteUser(@PathParam("username") String username); + + /** * Get user by user name * - * - * + */ + @GET @Path("/user/{username}") + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Get user by user name", tags={ "user", }) + + @ApiOperation(value = "Get user by user name", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public User getUserByName(@PathParam("username") String username); + + /** * Logs user into the system * - * - * + */ + @GET @Path("/user/login") + + @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Logs user into the system", tags={ "user", }) + + @ApiOperation(value = "Logs user into the system", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied") }) - public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password); + public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password); + + /** * Logs out current logged in user session * - * - * + */ + @GET @Path("/user/logout") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Logs out current logged in user session", tags={ "user", }) + + + @ApiOperation(value = "Logs out current logged in user session", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) public void logoutUser(); + + /** * Updated user * + * This can only be done by the logged in user. * + */ + @PUT @Path("/user/{username}") - @Produces({ "application/xml", "application/json" }) - @ApiOperation(value = "Updated user", tags={ "user" }) + + @Consumes({ "*/*" }) + + + @ApiOperation(value = "Updated user", tags={ }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) - public void updateUser(@PathParam("username") String username, @Valid User body); + public void updateUser(User user, @PathParam("username") String username); + } + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java index 0e190cbe457..033e881bea9 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Category.java @@ -1,7 +1,12 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; -import javax.validation.constraints.*; + + + + + + import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -13,26 +18,48 @@ import javax.xml.bind.annotation.XmlEnumValue; import com.fasterxml.jackson.annotation.JsonProperty; + + /** * A category for a pet **/ @ApiModel(description="A category for a pet") + public class Category { + @ApiModelProperty(value = "") + + + private Long id = null; + + @ApiModelProperty(value = "") + + + private String name = null; + + + /** + + * Get id + + + * @return id **/ @JsonProperty("id") + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } @@ -41,16 +68,27 @@ public Category id(Long id) { this.id = id; return this; } + + + + /** + + * Get name + + + * @return name **/ @JsonProperty("name") + public String getName() { return name; } + public void setName(String name) { this.name = name; } @@ -59,7 +97,11 @@ public Category name(String name) { this.name = name; return this; } + + + + @Override public String toString() { @@ -84,3 +126,6 @@ private static String toIndentedString(java.lang.Object o) { } } + + + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java index c6aab8b6a07..99ee9ebd1f2 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -1,7 +1,12 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; -import javax.validation.constraints.*; + + + + + + import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -13,29 +18,56 @@ import javax.xml.bind.annotation.XmlEnumValue; import com.fasterxml.jackson.annotation.JsonProperty; + + /** * Describes the result of uploading an image resource **/ @ApiModel(description="Describes the result of uploading an image resource") + public class ModelApiResponse { + @ApiModelProperty(value = "") + + + private Integer code = null; + + @ApiModelProperty(value = "") + + + private String type = null; + + @ApiModelProperty(value = "") + + + private String message = null; + + + /** + + * Get code + + + * @return code **/ @JsonProperty("code") + public Integer getCode() { return code; } + public void setCode(Integer code) { this.code = code; } @@ -44,16 +76,27 @@ public ModelApiResponse code(Integer code) { this.code = code; return this; } + + + + /** + + * Get type + + + * @return type **/ @JsonProperty("type") + public String getType() { return type; } + public void setType(String type) { this.type = type; } @@ -62,16 +105,27 @@ public ModelApiResponse type(String type) { this.type = type; return this; } + + + + /** + + * Get message + + + * @return message **/ @JsonProperty("message") + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } @@ -80,7 +134,11 @@ public ModelApiResponse message(String message) { this.message = message; return this; } + + + + @Override public String toString() { @@ -106,3 +164,6 @@ private static String toIndentedString(java.lang.Object o) { } } + + + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java index 973b0260b36..2227a22a8b5 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Order.java @@ -2,7 +2,12 @@ import io.swagger.annotations.ApiModel; import java.util.Date; -import javax.validation.constraints.*; + + + + + + import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -14,30 +19,55 @@ import javax.xml.bind.annotation.XmlEnumValue; import com.fasterxml.jackson.annotation.JsonProperty; + + /** * An order for a pets from the pet store **/ @ApiModel(description="An order for a pets from the pet store") + public class Order { + @ApiModelProperty(value = "") + + + private Long id = null; + + @ApiModelProperty(value = "") + + + private Long petId = null; + + @ApiModelProperty(value = "") + + + private Integer quantity = null; + + @ApiModelProperty(value = "") + + + private Date shipDate = null; + @XmlType(name="StatusEnum") @XmlEnum(String.class) public enum StatusEnum { + @XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); + private String value; @@ -65,23 +95,43 @@ public static StatusEnum fromValue(String v) { } } + @ApiModelProperty(value = "Order Status") + /** * Order Status **/ + + + private StatusEnum status = null; + + @ApiModelProperty(value = "") + + + private Boolean complete = false; + + + /** + + * Get id + + + * @return id **/ @JsonProperty("id") + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } @@ -90,16 +140,27 @@ public Order id(Long id) { this.id = id; return this; } + + + + /** + + * Get petId + + + * @return petId **/ @JsonProperty("petId") + public Long getPetId() { return petId; } + public void setPetId(Long petId) { this.petId = petId; } @@ -108,16 +169,27 @@ public Order petId(Long petId) { this.petId = petId; return this; } + + + + /** + + * Get quantity + + + * @return quantity **/ @JsonProperty("quantity") + public Integer getQuantity() { return quantity; } + public void setQuantity(Integer quantity) { this.quantity = quantity; } @@ -126,16 +198,27 @@ public Order quantity(Integer quantity) { this.quantity = quantity; return this; } + + + + /** + + * Get shipDate + + + * @return shipDate **/ @JsonProperty("shipDate") + public Date getShipDate() { return shipDate; } + public void setShipDate(Date shipDate) { this.shipDate = shipDate; } @@ -144,12 +227,22 @@ public Order shipDate(Date shipDate) { this.shipDate = shipDate; return this; } + + + + /** + * Order Status + + + + * @return status **/ @JsonProperty("status") + public String getStatus() { if (status == null) { return null; @@ -157,6 +250,7 @@ public String getStatus() { return status.value(); } + public void setStatus(StatusEnum status) { this.status = status; } @@ -165,16 +259,27 @@ public Order status(StatusEnum status) { this.status = status; return this; } + + + + /** + + * Get complete + + + * @return complete **/ @JsonProperty("complete") - public Boolean isComplete() { + + public Boolean isisComplete() { return complete; } + public void setComplete(Boolean complete) { this.complete = complete; } @@ -183,7 +288,11 @@ public Order complete(Boolean complete) { this.complete = complete; return this; } + + + + @Override public String toString() { @@ -212,3 +321,6 @@ private static String toIndentedString(java.lang.Object o) { } } + + + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java index 6e3fcf954ec..afd081cc35a 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Pet.java @@ -5,7 +5,12 @@ import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; -import javax.validation.constraints.*; + + + + + + import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -17,33 +22,63 @@ import javax.xml.bind.annotation.XmlEnumValue; import com.fasterxml.jackson.annotation.JsonProperty; + + /** * A pet for sale in the pet store **/ @ApiModel(description="A pet for sale in the pet store") + public class Pet { + @ApiModelProperty(value = "") + + + private Long id = null; + + @ApiModelProperty(value = "") + + + private Category category = null; + + @ApiModelProperty(example = "doggie", required = true, value = "") + + + private String name = null; + + @ApiModelProperty(required = true, value = "") + + private List photoUrls = new ArrayList(); + + + @ApiModelProperty(value = "") + + private List tags = null; + + @XmlType(name="StatusEnum") @XmlEnum(String.class) public enum StatusEnum { + @XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); + private String value; @@ -71,20 +106,35 @@ public static StatusEnum fromValue(String v) { } } + @ApiModelProperty(value = "pet status in the store") + /** * pet status in the store **/ + + + private StatusEnum status = null; + + + /** + + * Get id + + + * @return id **/ @JsonProperty("id") + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } @@ -93,16 +143,27 @@ public Pet id(Long id) { this.id = id; return this; } + + + + /** + + * Get category + + + * @return category **/ @JsonProperty("category") + public Category getCategory() { return category; } + public void setCategory(Category category) { this.category = category; } @@ -111,17 +172,27 @@ public Pet category(Category category) { this.category = category; return this; } + + + + /** + + * Get name + + + * @return name **/ @JsonProperty("name") - @NotNull + public String getName() { return name; } + public void setName(String name) { this.name = name; } @@ -130,17 +201,27 @@ public Pet name(String name) { this.name = name; return this; } + + + + /** + + * Get photoUrls + + + * @return photoUrls **/ @JsonProperty("photoUrls") - @NotNull + public List getPhotoUrls() { return photoUrls; } + public void setPhotoUrls(List photoUrls) { this.photoUrls = photoUrls; } @@ -149,21 +230,33 @@ public Pet photoUrls(List photoUrls) { this.photoUrls = photoUrls; return this; } + public Pet addPhotoUrlsItem(String photoUrlsItem) { this.photoUrls.add(photoUrlsItem); return this; } + + + + /** + + * Get tags + + + * @return tags **/ @JsonProperty("tags") + public List getTags() { return tags; } + public void setTags(List tags) { this.tags = tags; } @@ -172,17 +265,28 @@ public Pet tags(List tags) { this.tags = tags; return this; } + public Pet addTagsItem(Tag tagsItem) { this.tags.add(tagsItem); return this; } + + + + /** + * pet status in the store + + + + * @return status **/ @JsonProperty("status") + public String getStatus() { if (status == null) { return null; @@ -190,6 +294,7 @@ public String getStatus() { return status.value(); } + public void setStatus(StatusEnum status) { this.status = status; } @@ -198,7 +303,11 @@ public Pet status(StatusEnum status) { this.status = status; return this; } + + + + @Override public String toString() { @@ -227,3 +336,6 @@ private static String toIndentedString(java.lang.Object o) { } } + + + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java index 71801d143d3..d06a41d4383 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/Tag.java @@ -1,7 +1,12 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; -import javax.validation.constraints.*; + + + + + + import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -13,26 +18,48 @@ import javax.xml.bind.annotation.XmlEnumValue; import com.fasterxml.jackson.annotation.JsonProperty; + + /** * A tag for a pet **/ @ApiModel(description="A tag for a pet") + public class Tag { + @ApiModelProperty(value = "") + + + private Long id = null; + + @ApiModelProperty(value = "") + + + private String name = null; + + + /** + + * Get id + + + * @return id **/ @JsonProperty("id") + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } @@ -41,16 +68,27 @@ public Tag id(Long id) { this.id = id; return this; } + + + + /** + + * Get name + + + * @return name **/ @JsonProperty("name") + public String getName() { return name; } + public void setName(String name) { this.name = name; } @@ -59,7 +97,11 @@ public Tag name(String name) { this.name = name; return this; } + + + + @Override public String toString() { @@ -84,3 +126,6 @@ private static String toIndentedString(java.lang.Object o) { } } + + + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java index e7d2773ea70..3e15b722f0d 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/model/User.java @@ -1,7 +1,12 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; -import javax.validation.constraints.*; + + + + + + import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -13,47 +18,100 @@ import javax.xml.bind.annotation.XmlEnumValue; import com.fasterxml.jackson.annotation.JsonProperty; + + /** * A User who is purchasing from the pet store **/ @ApiModel(description="A User who is purchasing from the pet store") + public class User { + @ApiModelProperty(value = "") + + + private Long id = null; + + @ApiModelProperty(value = "") + + + private String username = null; + + @ApiModelProperty(value = "") + + + private String firstName = null; + + @ApiModelProperty(value = "") + + + private String lastName = null; + + @ApiModelProperty(value = "") + + + private String email = null; + + @ApiModelProperty(value = "") + + + private String password = null; + + @ApiModelProperty(value = "") + + + private String phone = null; + + @ApiModelProperty(value = "User Status") + /** * User Status **/ + + + private Integer userStatus = null; + + + /** + + * Get id + + + * @return id **/ @JsonProperty("id") + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } @@ -62,16 +120,27 @@ public User id(Long id) { this.id = id; return this; } + + + + /** + + * Get username + + + * @return username **/ @JsonProperty("username") + public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } @@ -80,16 +149,27 @@ public User username(String username) { this.username = username; return this; } + + + + /** + + * Get firstName + + + * @return firstName **/ @JsonProperty("firstName") + public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } @@ -98,16 +178,27 @@ public User firstName(String firstName) { this.firstName = firstName; return this; } + + + + /** + + * Get lastName + + + * @return lastName **/ @JsonProperty("lastName") + public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } @@ -116,16 +207,27 @@ public User lastName(String lastName) { this.lastName = lastName; return this; } + + + + /** + + * Get email + + + * @return email **/ @JsonProperty("email") + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } @@ -134,16 +236,27 @@ public User email(String email) { this.email = email; return this; } + + + + /** + + * Get password + + + * @return password **/ @JsonProperty("password") + public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } @@ -152,16 +265,27 @@ public User password(String password) { this.password = password; return this; } + + + + /** + + * Get phone + + + * @return phone **/ @JsonProperty("phone") + public String getPhone() { return phone; } + public void setPhone(String phone) { this.phone = phone; } @@ -170,16 +294,27 @@ public User phone(String phone) { this.phone = phone; return this; } + + + + /** + * User Status + + + + * @return userStatus **/ @JsonProperty("userStatus") + public Integer getUserStatus() { return userStatus; } + public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } @@ -188,7 +323,11 @@ public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } + + + + @Override public String toString() { @@ -219,3 +358,6 @@ private static String toIndentedString(java.lang.Object o) { } } + + + diff --git a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java deleted file mode 100644 index d9b9345d339..00000000000 --- a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -package io.swagger.api.impl; - -import io.swagger.api.*; -import java.io.File; -import io.swagger.model.ModelApiResponse; -import io.swagger.model.Pet; - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; - -import org.apache.cxf.jaxrs.ext.multipart.*; - -import io.swagger.annotations.Api; - -public class PetApiServiceImpl implements PetApi { - public void addPet(Pet body) { - // TODO: Implement... - - - } - - public void deletePet(Long petId, String apiKey) { - // TODO: Implement... - - - } - - public List findPetsByStatus(List status) { - // TODO: Implement... - - return null; - } - - public List findPetsByTags(List tags) { - // TODO: Implement... - - return null; - } - - public Pet getPetById(Long petId) { - // TODO: Implement... - - return null; - } - - public void updatePet(Pet body) { - // TODO: Implement... - - - } - - public void updatePetWithForm(Long petId, String name, String status) { - // TODO: Implement... - - - } - - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Attachment fileDetail) { - // TODO: Implement... - - return null; - } - -} - diff --git a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java deleted file mode 100644 index 3f791097b6b..00000000000 --- a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package io.swagger.api.impl; - -import io.swagger.api.*; -import java.util.Map; -import io.swagger.model.Order; - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; - -import org.apache.cxf.jaxrs.ext.multipart.*; - -import io.swagger.annotations.Api; - -public class StoreApiServiceImpl implements StoreApi { - public void deleteOrder(String orderId) { - // TODO: Implement... - - - } - - public Map getInventory() { - // TODO: Implement... - - return null; - } - - public Order getOrderById(Long orderId) { - // TODO: Implement... - - return null; - } - - public Order placeOrder(Order body) { - // TODO: Implement... - - return null; - } - -} - diff --git a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java deleted file mode 100644 index 861273cfb7b..00000000000 --- a/samples/client/petstore/jaxrs-cxf-client/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -package io.swagger.api.impl; - -import io.swagger.api.*; -import java.util.List; -import io.swagger.model.User; - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; - -import org.apache.cxf.jaxrs.ext.multipart.*; - -import io.swagger.annotations.Api; - -public class UserApiServiceImpl implements UserApi { - public void createUser(User body) { - // TODO: Implement... - - - } - - public void createUsersWithArrayInput(List body) { - // TODO: Implement... - - - } - - public void createUsersWithListInput(List body) { - // TODO: Implement... - - - } - - public void deleteUser(String username) { - // TODO: Implement... - - - } - - public User getUserByName(String username) { - // TODO: Implement... - - return null; - } - - public String loginUser(String username, String password) { - // TODO: Implement... - - return null; - } - - public void logoutUser() { - // TODO: Implement... - - - } - - public void updateUser(String username, User body) { - // TODO: Implement... - - - } - -} - diff --git a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java index b7a13f76849..e07af12923c 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/PetApiTest.java @@ -25,9 +25,9 @@ package io.swagger.api; -import java.io.File; import io.swagger.model.ModelApiResponse; import io.swagger.model.Pet; + import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; @@ -38,8 +38,11 @@ import org.apache.cxf.jaxrs.client.WebClient; + + import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -48,11 +51,23 @@ + + /** - * API tests for PetApi + + * Swagger Petstore + * + + + *

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + + * API tests for PetApi */ + public class PetApiTest { + private PetApi api; @@ -62,25 +77,33 @@ public void setup() { List providers = new ArrayList(); providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", PetApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); ClientConfiguration config = WebClient.getConfig(client); + + } /** + * Add a new pet to the store * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void addPetTest() { - Pet body = null; - //api.addPet(body); + + Pet pet = null; + + //api.addPet(pet); // TODO: test validations @@ -88,17 +111,21 @@ public void addPetTest() { } /** + * Deletes a pet * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void deletePetTest() { - Long petId = null; + + Integer petId = null; + String apiKey = null; + //api.deletePet(petId, apiKey); // TODO: test validations @@ -107,16 +134,22 @@ public void deletePetTest() { } /** + * Finds Pets by status * + * Multiple status values can be provided with comma separated strings * + + * @throws ApiException * if the Api call fails */ @Test public void findPetsByStatusTest() { + List status = null; + //List response = api.findPetsByStatus(status); //assertNotNull(response); // TODO: test validations @@ -125,16 +158,22 @@ public void findPetsByStatusTest() { } /** + * 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 public void findPetsByTagsTest() { + List tags = null; + //List response = api.findPetsByTags(tags); //assertNotNull(response); // TODO: test validations @@ -143,16 +182,22 @@ public void findPetsByTagsTest() { } /** + * Find pet by ID * + * Returns a single pet * + + * @throws ApiException * if the Api call fails */ @Test public void getPetByIdTest() { - Long petId = null; + + Integer petId = null; + //Pet response = api.getPetById(petId); //assertNotNull(response); // TODO: test validations @@ -161,17 +206,20 @@ public void getPetByIdTest() { } /** + * Update an existing pet * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void updatePetTest() { - Pet body = null; - //api.updatePet(body); + + Pet pet = null; + + //api.updatePet(pet); // TODO: test validations @@ -179,19 +227,22 @@ public void updatePetTest() { } /** + * Updates a pet in the store with form data * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void updatePetWithFormTest() { - Long petId = null; - String name = null; - String status = null; - //api.updatePetWithForm(petId, name, status); + + Integer petId = null; + + Object body = null; + + //api.updatePetWithForm(petId, body); // TODO: test validations @@ -199,19 +250,22 @@ public void updatePetWithFormTest() { } /** + * uploads an image * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void uploadFileTest() { - Long petId = null; - String additionalMetadata = null; - org.apache.cxf.jaxrs.ext.multipart.Attachment file = null; - //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + + Integer petId = null; + + Object body = null; + + //ModelApiResponse response = api.uploadFile(petId, body); //assertNotNull(response); // TODO: test validations diff --git a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java index 92bb0e8b8f9..7432e3b5869 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/StoreApiTest.java @@ -25,8 +25,8 @@ package io.swagger.api; -import java.util.Map; import io.swagger.model.Order; + import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; @@ -37,8 +37,11 @@ import org.apache.cxf.jaxrs.client.WebClient; + + import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -47,11 +50,23 @@ + + /** - * API tests for StoreApi + + * Swagger Petstore + * + + + *

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + + * API tests for StoreApi */ + public class StoreApiTest { + private StoreApi api; @@ -61,24 +76,35 @@ public void setup() { List providers = new ArrayList(); providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", StoreApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); ClientConfiguration config = WebClient.getConfig(client); + + } /** + * Delete purchase order by ID * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * + + * @throws ApiException * if the Api call fails */ @Test public void deleteOrderTest() { + String orderId = null; + //api.deleteOrder(orderId); // TODO: test validations @@ -87,15 +113,20 @@ public void deleteOrderTest() { } /** + * Returns pet inventories by status * + * Returns a map of status codes to quantities * + + * @throws ApiException * if the Api call fails */ @Test public void getInventoryTest() { + //Map response = api.getInventory(); //assertNotNull(response); // TODO: test validations @@ -104,16 +135,22 @@ public void getInventoryTest() { } /** + * 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 public void getOrderByIdTest() { - Long orderId = null; + + Integer orderId = null; + //Order response = api.getOrderById(orderId); //assertNotNull(response); // TODO: test validations @@ -122,17 +159,20 @@ public void getOrderByIdTest() { } /** + * Place an order for a pet * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void placeOrderTest() { - Order body = null; - //Order response = api.placeOrder(body); + + Order order = null; + + //Order response = api.placeOrder(order); //assertNotNull(response); // TODO: test validations diff --git a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java index a0ecb1dbee2..f3794c02c30 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/test/java/io/swagger/api/UserApiTest.java @@ -25,8 +25,8 @@ package io.swagger.api; -import java.util.List; import io.swagger.model.User; + import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; @@ -37,8 +37,11 @@ import org.apache.cxf.jaxrs.client.WebClient; + + import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -47,11 +50,23 @@ + + /** - * API tests for UserApi + + * Swagger Petstore + * + + + *

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + + * API tests for UserApi */ + public class UserApiTest { + private UserApi api; @@ -61,25 +76,36 @@ public void setup() { List providers = new ArrayList(); providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", UserApi.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); ClientConfiguration config = WebClient.getConfig(client); + + } /** + * Create user * + * This can only be done by the logged in user. * + + * @throws ApiException * if the Api call fails */ @Test public void createUserTest() { - User body = null; - //api.createUser(body); + + User user = null; + + //api.createUser(user); // TODO: test validations @@ -87,16 +113,19 @@ public void createUserTest() { } /** + * Creates list of users with given input array * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void createUsersWithArrayInputTest() { + List body = null; + //api.createUsersWithArrayInput(body); // TODO: test validations @@ -105,16 +134,19 @@ public void createUsersWithArrayInputTest() { } /** + * Creates list of users with given input array * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void createUsersWithListInputTest() { + List body = null; + //api.createUsersWithListInput(body); // TODO: test validations @@ -123,16 +155,22 @@ public void createUsersWithListInputTest() { } /** + * Delete user * + * This can only be done by the logged in user. * + + * @throws ApiException * if the Api call fails */ @Test public void deleteUserTest() { + String username = null; + //api.deleteUser(username); // TODO: test validations @@ -141,16 +179,19 @@ public void deleteUserTest() { } /** + * Get user by user name * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void getUserByNameTest() { + String username = null; + //User response = api.getUserByName(username); //assertNotNull(response); // TODO: test validations @@ -159,17 +200,21 @@ public void getUserByNameTest() { } /** + * Logs user into the system * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void loginUserTest() { + String username = null; + String password = null; + //String response = api.loginUser(username, password); //assertNotNull(response); // TODO: test validations @@ -178,15 +223,17 @@ public void loginUserTest() { } /** + * Logs out current logged in user session * - * - * + + * @throws ApiException * if the Api call fails */ @Test public void logoutUserTest() { + //api.logoutUser(); // TODO: test validations @@ -195,18 +242,25 @@ public void logoutUserTest() { } /** + * Updated user * + * This can only be done by the logged in user. * + + * @throws ApiException * if the Api call fails */ @Test public void updateUserTest() { + + User user = null; + String username = null; - User body = null; - //api.updateUser(username, body); + + //api.updateUser(user, username); // TODO: test validations