diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java index ad8ae3aff94e..5fbf037b2fff 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java index 3c45b7e282f5..1c5dade251c3 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class ApiOriginFilter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java index 1bddb4087ae4..91264320d2c2 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java index 37f7328aaf76..7b5055536d29 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java index 260523279cda..d8918a855f97 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApi.java @@ -26,7 +26,7 @@ import javax.ws.rs.*; @io.swagger.annotations.Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class PetApi { private final PetApiService delegate = PetApiServiceFactory.getPetApi(); @@ -48,7 +48,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) throws NotFoundException { return delegate.updatePet(body); } @@ -65,7 +65,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) throws NotFoundException { return delegate.addPet(body); } @@ -121,7 +121,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) - public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("petId") Long petId) + public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("petId") Long petId) throws NotFoundException { return delegate.getPetById(petId); } @@ -138,9 +138,9 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathParam("petId") String petId, - @ApiParam(value = "Updated name of the pet" )@FormParam("name") String name, - @ApiParam(value = "Updated status of the pet" )@FormParam("status") String status) + public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") String petId, + @ApiParam(value = "Updated name of the pet")@FormParam("name") String name, + @ApiParam(value = "Updated status of the pet")@FormParam("status") String status) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status); } @@ -157,8 +157,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) - public Response deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathParam("petId") Long petId, - @ApiParam(value = "" )@HeaderParam("api_key") String apiKey) + public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId, + @ApiParam(value = "" )@HeaderParam("api_key") String apiKey) throws NotFoundException { return delegate.deletePet(petId,apiKey); } @@ -175,8 +175,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathParam("petId") Long petId, - @ApiParam(value = "Additional data to pass to server" )@FormParam("additionalMetadata") String additionalMetadata, + public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId, + @ApiParam(value = "Additional data to pass to server")@FormParam("additionalMetadata") String additionalMetadata, @FormDataParam("file") InputStream inputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java index 8171555b0d08..edb656bba4bb 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/PetApiService.java @@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public abstract class PetApiService { public abstract Response updatePet(Pet body) diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java index 63fac7c2b34f..c75b7c0b0058 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApi.java @@ -26,7 +26,7 @@ import javax.ws.rs.*; @io.swagger.annotations.Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class StoreApi { private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); @@ -55,7 +55,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body) + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body) throws NotFoundException { return delegate.placeOrder(body); } @@ -71,7 +71,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) }) - public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("orderId") String orderId) + public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") String orderId) throws NotFoundException { return delegate.getOrderById(orderId); } @@ -85,7 +85,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) - public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathParam("orderId") String orderId) + public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId) throws NotFoundException { return delegate.deleteOrder(orderId); } diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java index dc8274ce7399..20dd92d9cd91 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/StoreApiService.java @@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public abstract class StoreApiService { public abstract Response getInventory() diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java index cade9a3b2f16..9a1b81870210 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApi.java @@ -26,7 +26,7 @@ import javax.ws.rs.*; @io.swagger.annotations.Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class UserApi { private final UserApiService delegate = UserApiServiceFactory.getUserApi(); @@ -39,7 +39,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ) User body) + public Response createUser(@ApiParam(value = "Created user object" ) User body) throws NotFoundException { return delegate.createUser(body); } @@ -51,7 +51,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List body) + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List body) throws NotFoundException { return delegate.createUsersWithArrayInput(body); } @@ -63,7 +63,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ) List body) + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ) List body) throws NotFoundException { return delegate.createUsersWithListInput(body); } @@ -106,7 +106,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) }) - public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathParam("username") String username) + public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathParam("username") String username) throws NotFoundException { return delegate.getUserByName(username); } @@ -120,8 +120,8 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathParam("username") String username, - @ApiParam(value = "Updated user object" ) User body) + public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username, + @ApiParam(value = "Updated user object" ) User body) throws NotFoundException { return delegate.updateUser(username,body); } @@ -135,7 +135,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathParam("username") String username) + public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username) throws NotFoundException { return delegate.deleteUser(username); } diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java index 175aa32757af..efd8a3fe9a4c 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/api/UserApiService.java @@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public abstract class UserApiService { public abstract Response createUser(User body) diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java index 9aed596a7680..e390c5b806c1 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Category.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java index 8a5c22a38ac3..59c85b3d7d88 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Order.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java index f3e1cfa17f20..f0d2790a8ac7 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Pet.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java index fe723eea4d85..83434c8b812e 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/Tag.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java index ea890100a74f..6aa15fe86b42 100644 --- a/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs/src/gen/java/io/swagger/model/User.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-10-26T17:58:55.634+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:51:39.623-08:00") public class User { private Long id = null; diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java index c3a7cbf8bf77..1110a6abad9b 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java @@ -3,7 +3,7 @@ package io.swagger.api.factories; import io.swagger.api.PetApiService; import io.swagger.api.impl.PetApiServiceImpl; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T22:18:00.553-07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:43:02.375-08:00") public class PetApiServiceFactory { private final static PetApiService service = new PetApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java index 9eb7af458dd9..cd3cd1fa9e23 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java @@ -3,7 +3,7 @@ package io.swagger.api.factories; import io.swagger.api.StoreApiService; import io.swagger.api.impl.StoreApiServiceImpl; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T22:18:00.553-07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:43:02.375-08:00") public class StoreApiServiceFactory { private final static StoreApiService service = new StoreApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java index 2f381c6b4591..2be6d83827a5 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java @@ -3,7 +3,7 @@ package io.swagger.api.factories; import io.swagger.api.UserApiService; import io.swagger.api.impl.UserApiServiceImpl; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T22:18:00.553-07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:43:02.375-08:00") public class UserApiServiceFactory { private final static UserApiService service = new UserApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java index c7ee88aaf638..3432c17d0b04 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T22:18:00.553-07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:43:02.375-08:00") public class PetApiServiceImpl extends PetApiService { @Override diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java index 7dbf5e75dd27..96a7d50cd3a3 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java @@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T22:18:00.553-07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:43:02.375-08:00") public class StoreApiServiceImpl extends StoreApiService { @Override diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java index cdbc9afed191..1d5eeab2cd67 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -18,7 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-08-23T22:18:00.553-07:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JaxRSServerCodegen", date = "2015-11-05T18:43:02.375-08:00") public class UserApiServiceImpl extends UserApiService { @Override diff --git a/samples/server/petstore/jaxrs/src/main/webapp/WEB-INF/web.xml b/samples/server/petstore/jaxrs/src/main/webapp/WEB-INF/web.xml index 80df1cd180db..bde33eae91ab 100644 --- a/samples/server/petstore/jaxrs/src/main/webapp/WEB-INF/web.xml +++ b/samples/server/petstore/jaxrs/src/main/webapp/WEB-INF/web.xml @@ -34,14 +34,14 @@ swagger.api.basepath - http://localhost:8080 + http://petstore.swagger.io/v2 2 jersey - /* + /v2/* ApiOriginFilter diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/ApiClient.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/ApiClient.java deleted file mode 100644 index 9af0c10b5439..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/ApiClient.java +++ /dev/null @@ -1,553 +0,0 @@ -package io.swagger.client; - -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.config.ClientConfig; -import com.sun.jersey.api.client.config.DefaultClientConfig; -import com.sun.jersey.api.client.filter.LoggingFilter; -import com.sun.jersey.api.client.WebResource.Builder; - -import com.sun.jersey.multipart.FormDataMultiPart; -import com.sun.jersey.multipart.file.FileDataBodyPart; - -import javax.ws.rs.core.Response.Status.Family; -import javax.ws.rs.core.MediaType; - -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.TimeZone; - -import java.net.URLEncoder; - -import java.io.IOException; -import java.io.File; -import java.io.UnsupportedEncodingException; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.text.ParseException; - -import io.swagger.client.auth.Authentication; -import io.swagger.client.auth.HttpBasicAuth; -import io.swagger.client.auth.ApiKeyAuth; -import io.swagger.client.auth.OAuth; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class ApiClient { - private Map hostMap = new HashMap(); - private Map defaultHeaderMap = new HashMap(); - private boolean debugging = false; - private String basePath = "http://petstore.swagger.io/v2"; - private JSON json = new JSON(); - - private Map authentications; - - private DateFormat dateFormat; - - public ApiClient() { - // Use ISO 8601 format for date and datetime. - // See https://en.wikipedia.org/wiki/ISO_8601 - this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); - - // Use UTC as the default time zone. - this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - - // Set default User-Agent. - setUserAgent("Java-Swagger"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - authentications.put("petstore_auth", new OAuth()); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - public String getBasePath() { - return basePath; - } - - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - */ - public ApiClient setDebugging(boolean debugging) { - this.debugging = debugging; - return this; - } - - /** - * Get the date format used to parse/format date parameters. - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Set the date format used to parse/format date parameters. - */ - public ApiClient getDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - return this; - } - - /** - * Parse the given string into Date object. - */ - public Date parseDate(String str) { - try { - return dateFormat.parse(str); - } catch (java.text.ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Format the given Date object into string. - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given parameter object into string. - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDate((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /* - Format to {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection = null; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; - } - - if (valueCollection.isEmpty()){ - return params; - } - - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv - - // create the params based on the collection format - if (collectionFormat.equals("multi")) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; - } - - String delimiter = ","; - - if (collectionFormat.equals("csv")) { - delimiter = ","; - } else if (collectionFormat.equals("ssv")) { - delimiter = " "; - } else if (collectionFormat.equals("tsv")) { - delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) return null; - if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json"; - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) return "application/json"; - if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json"; - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Serialize the given Java object into string according the given - * Content-Type (only JSON is supported for now). - */ - public String serialize(Object obj, String contentType) throws ApiException { - if (contentType.startsWith("application/json")) { - return json.serialize(obj); - } else { - throw new ApiException(400, "can not serialize object into Content-Type: " + contentType); - } - } - - /** - * Deserialize response body to Java object according to the Content-Type. - */ - public T deserialize(ClientResponse response, TypeRef returnType) throws ApiException { - String contentType = null; - List contentTypes = response.getHeaders().get("Content-Type"); - if (contentTypes != null && !contentTypes.isEmpty()) - contentType = contentTypes.get(0); - if (contentType == null) - throw new ApiException(500, "missing Content-Type in response"); - - String body; - if (response.hasEntity()) - body = (String) response.getEntity(String.class); - else - body = ""; - - if (contentType.startsWith("application/json")) { - return json.deserialize(body, returnType); - } else { - throw new ApiException(500, "can not deserialize Content-Type: " + contentType); - } - } - - /** - * Invoke API by sending HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param accept The request's Accept header - * @param contentType The request's Content-Type header - * @param authNames The authentications to apply - * @param returnType The return type into which to deserialize the response - * @return The response body in type of string - */ - public T invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, TypeRef returnType) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams); - - Client client = getClient(); - - StringBuilder b = new StringBuilder(); - b.append("?"); - if (queryParams != null){ - for (Pair queryParam : queryParams){ - if (!queryParam.getName().isEmpty()) { - b.append(escapeString(queryParam.getName())); - b.append("="); - b.append(escapeString(queryParam.getValue())); - b.append("&"); - } - } - } - - String querystring = b.substring(0, b.length() - 1); - - Builder builder; - if (accept == null) - builder = client.resource(basePath + path + querystring).getRequestBuilder(); - else - builder = client.resource(basePath + path + querystring).accept(accept); - - for (String key : headerParams.keySet()) { - builder = builder.header(key, headerParams.get(key)); - } - for (String key : defaultHeaderMap.keySet()) { - if (!headerParams.containsKey(key)) { - builder = builder.header(key, defaultHeaderMap.get(key)); - } - } - - String encodedFormParams = null; - if (contentType.startsWith("multipart/form-data")) { - FormDataMultiPart mp = new FormDataMultiPart(); - for (Entry param: formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - mp.field(param.getKey(), file.getName()); - mp.bodyPart(new FileDataBodyPart(param.getKey(), file, MediaType.MULTIPART_FORM_DATA_TYPE)); - } else { - mp.field(param.getKey(), parameterToString(param.getValue()), MediaType.MULTIPART_FORM_DATA_TYPE); - } - } - body = mp; - } else if (contentType.startsWith("application/x-www-form-urlencoded")) { - encodedFormParams = this.getXWWWFormUrlencodedParams(formParams); - } - - ClientResponse response = null; - - if ("GET".equals(method)) { - response = (ClientResponse) builder.get(ClientResponse.class); - } else if ("POST".equals(method)) { - if (encodedFormParams != null) { - response = builder.type(contentType).post(ClientResponse.class, encodedFormParams); - } else if (body == null) { - response = builder.post(ClientResponse.class, null); - } else if (body instanceof FormDataMultiPart) { - response = builder.type(contentType).post(ClientResponse.class, body); - } else { - response = builder.type(contentType).post(ClientResponse.class, serialize(body, contentType)); - } - } else if ("PUT".equals(method)) { - if (encodedFormParams != null) { - response = builder.type(contentType).put(ClientResponse.class, encodedFormParams); - } else if(body == null) { - response = builder.put(ClientResponse.class, serialize(body, contentType)); - } else { - response = builder.type(contentType).put(ClientResponse.class, serialize(body, contentType)); - } - } else if ("DELETE".equals(method)) { - if (encodedFormParams != null) { - response = builder.type(contentType).delete(ClientResponse.class, encodedFormParams); - } else if(body == null) { - response = builder.delete(ClientResponse.class); - } else { - response = builder.type(contentType).delete(ClientResponse.class, serialize(body, contentType)); - } - } else { - throw new ApiException(500, "unknown method type " + method); - } - - if (response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) { - return null; - } else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { - if (returnType == null) - return null; - else - return deserialize(response, returnType); - } else { - String message = "error"; - String respBody = null; - if (response.hasEntity()) { - try { - respBody = String.valueOf(response.getEntity(String.class)); - message = respBody; - } catch (RuntimeException e) { - // e.printStackTrace(); - } - } - throw new ApiException( - response.getStatusInfo().getStatusCode(), - message, - response.getHeaders(), - respBody); - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - */ - private void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - } - } - - /** - * Encode the given form parameters as request body. - */ - private String getXWWWFormUrlencodedParams(Map formParams) { - StringBuilder formParamBuilder = new StringBuilder(); - - for (Entry param : formParams.entrySet()) { - String keyStr = param.getKey(); - String valueStr = parameterToString(param.getValue()); - try { - formParamBuilder.append(URLEncoder.encode(param.getKey(), "utf8")) - .append("=") - .append(URLEncoder.encode(valueStr, "utf8")); - formParamBuilder.append("&"); - } catch (UnsupportedEncodingException e) { - // move on to next - } - } - - String encodedFormParams = formParamBuilder.toString(); - if (encodedFormParams.endsWith("&")) { - encodedFormParams = encodedFormParams.substring(0, encodedFormParams.length() - 1); - } - - return encodedFormParams; - } - - /** - * Get an existing client or create a new client to handle HTTP request. - */ - private Client getClient() { - if(!hostMap.containsKey(basePath)) { - Client client = Client.create(); - if (debugging) - client.addFilter(new LoggingFilter()); - hostMap.put(basePath, client); - } - return hostMap.get(basePath); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/ApiException.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/ApiException.java deleted file mode 100644 index 605f8c3769d7..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/ApiException.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.swagger.client; - -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class ApiException extends Exception { - private int code = 0; - private String message = null; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(int code, String message) { - this.code = code; - this.message = message; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this.code = code; - this.message = message; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } - - /** - * Get the HTTP response headers. - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/Configuration.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/Configuration.java deleted file mode 100644 index 524006fd7bd3..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/Configuration.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.swagger.client; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/JSON.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/JSON.java deleted file mode 100644 index 3514e41778eb..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/JSON.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.swagger.client; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.datatype.joda.*; - -import java.io.IOException; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class JSON { - private ObjectMapper mapper; - - public JSON() { - mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - mapper.registerModule(new JodaModule()); - } - - /** - * Serialize the given Java object into JSON string. - */ - public String serialize(Object obj) throws ApiException { - try { - if (obj != null) - return mapper.writeValueAsString(obj); - else - return null; - } catch (Exception e) { - throw new ApiException(400, e.getMessage()); - } - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param body The JSON string - * @param returnType The type to deserialize inot - * @return The deserialized Java object - */ - public T deserialize(String body, TypeRef returnType) throws ApiException { - JavaType javaType = mapper.constructType(returnType.getType()); - try { - return mapper.readValue(body, javaType); - } catch (IOException e) { - if (returnType.getType().equals(String.class)) - return (T) body; - else - throw new ApiException(500, e.getMessage(), null, body); - } - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/Pair.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/Pair.java deleted file mode 100644 index e7dd3350637d..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/Pair.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.swagger.client; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) return; - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) return; - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; - - return true; - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/StringUtil.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/StringUtil.java deleted file mode 100644 index c80bc8a1647c..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/StringUtil.java +++ /dev/null @@ -1,42 +0,0 @@ -package io.swagger.client; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; - } - return false; - } - - /** - * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - *

- * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) return ""; - - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); - } - return out.toString(); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/TypeRef.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/TypeRef.java deleted file mode 100644 index 15eb3ea05bad..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/TypeRef.java +++ /dev/null @@ -1,26 +0,0 @@ -package io.swagger.client; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class TypeRef { - private final Type type; - - public TypeRef() { - this.type = getGenericType(getClass()); - } - - private static Type getGenericType(Class klass) { - Type superclass = klass.getGenericSuperclass(); - if (superclass instanceof Class) { - throw new RuntimeException("No type parameter provided"); - } - ParameterizedType parameterized = (ParameterizedType) superclass; - return parameterized.getActualTypeArguments()[0]; - } - - public Type getType() { - return type; - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/PetApi.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/PetApi.java deleted file mode 100644 index 5b71f7c199cb..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/PetApi.java +++ /dev/null @@ -1,407 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; -import io.swagger.client.TypeRef; - -import io.swagger.client.model.*; - -import java.util.*; - -import io.swagger.client.model.Pet; -import java.io.File; - -import java.io.File; -import java.util.Map; -import java.util.HashMap; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class PetApi { - private ApiClient apiClient; - - public PetApi() { - this(Configuration.getDefaultApiClient()); - } - - public PetApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - * @return void - */ - public void updatePet (Pet body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - "application/json", "application/xml" - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - * @return void - */ - public void addPet (Pet body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/pet".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - "application/json", "application/xml" - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Finds Pets by status - * Multiple status values can be provided with comma seperated strings - * @param status Status values that need to be considered for filter - * @return List - */ - public List findPetsByStatus (List status) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/pet/findByStatus".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - queryParams.addAll(apiClient.parameterToPairs("multi", "status", status)); - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - TypeRef returnType = new TypeRef>() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Finds Pets by tags - * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - * @return List - */ - public List findPetsByTags (List tags) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/pet/findByTags".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - queryParams.addAll(apiClient.parameterToPairs("multi", "tags", tags)); - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - TypeRef returnType = new TypeRef>() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - * @return Pet - */ - public Pet getPetById (Long petId) throws ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); - } - - - // create path and map variables - String path = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "api_key", "petstore_auth" }; - - TypeRef returnType = new TypeRef() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Updates a pet in the store with form data - * - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - * @return void - */ - public void updatePetWithForm (String petId, String name, String status) throws ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); - } - - - // create path and map variables - String path = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - if (name != null) - formParams.put("name", name); - if (status != null) - formParams.put("status", status); - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - "application/x-www-form-urlencoded" - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - * @return void - */ - public void deletePet (Long petId, String apiKey) throws ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); - } - - - // create path and map variables - String path = "/pet/{petId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - if (apiKey != null) - headerParams.put("api_key", apiClient.parameterToString(apiKey)); - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - * @return void - */ - public void uploadFile (Long petId, String additionalMetadata, File file) throws ApiException { - Object postBody = null; - - // verify the required parameter 'petId' is set - if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); - } - - - // create path and map variables - String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - if (additionalMetadata != null) - formParams.put("additionalMetadata", additionalMetadata); - if (file != null) - formParams.put("file", file); - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - "multipart/form-data" - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "petstore_auth" }; - - apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/StoreApi.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/StoreApi.java deleted file mode 100644 index 7c0430b5f718..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/StoreApi.java +++ /dev/null @@ -1,215 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; -import io.swagger.client.TypeRef; - -import io.swagger.client.model.*; - -import java.util.*; - -import java.util.Map; -import io.swagger.client.model.Order; - -import java.io.File; -import java.util.Map; -import java.util.HashMap; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class StoreApi { - private ApiClient apiClient; - - public StoreApi() { - this(Configuration.getDefaultApiClient()); - } - - public StoreApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return Map - */ - public Map getInventory () throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/store/inventory".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { "api_key" }; - - TypeRef returnType = new TypeRef>() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - * @return Order - */ - public Order placeOrder (Order body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/store/order".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - TypeRef returnType = new TypeRef() {}; - return apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - * @return Order - */ - public Order getOrderById (String orderId) throws ApiException { - Object postBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); - } - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - TypeRef returnType = new TypeRef() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - * @return void - */ - public void deleteOrder (String orderId) throws ApiException { - Object postBody = null; - - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); - } - - - // create path and map variables - String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "orderId" + "\\}", apiClient.escapeString(orderId.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/UserApi.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/UserApi.java deleted file mode 100644 index a11ac7d16ed1..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/api/UserApi.java +++ /dev/null @@ -1,386 +0,0 @@ -package io.swagger.client.api; - -import io.swagger.client.ApiException; -import io.swagger.client.ApiClient; -import io.swagger.client.Configuration; -import io.swagger.client.Pair; -import io.swagger.client.TypeRef; - -import io.swagger.client.model.*; - -import java.util.*; - -import io.swagger.client.model.User; -import java.util.*; - -import java.io.File; -import java.util.Map; -import java.util.HashMap; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class UserApi { - private ApiClient apiClient; - - public UserApi() { - this(Configuration.getDefaultApiClient()); - } - - public UserApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - * @return void - */ - public void createUser (User body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/user".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - */ - public void createUsersWithArrayInput (List body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/user/createWithArray".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Creates list of users with given input array - * - * @param body List of user object - * @return void - */ - public void createUsersWithListInput (List body) throws ApiException { - Object postBody = body; - - - // create path and map variables - String path = "/user/createWithList".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "POST", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - * @return String - */ - public String loginUser (String username, String password) throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/user/login".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - queryParams.addAll(apiClient.parameterToPairs("", "username", username)); - - queryParams.addAll(apiClient.parameterToPairs("", "password", password)); - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - TypeRef returnType = new TypeRef() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Logs out current logged in user session - * - * @return void - */ - public void logoutUser () throws ApiException { - Object postBody = null; - - - // create path and map variables - String path = "/user/logout".replaceAll("\\{format\\}","json"); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - * @return User - */ - public User getUserByName (String username) throws ApiException { - Object postBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - TypeRef returnType = new TypeRef() {}; - return apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); - - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - * @return void - */ - public void updateUser (String username, User body) throws ApiException { - Object postBody = body; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "PUT", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - * @return void - */ - public void deleteUser (String username) throws ApiException { - Object postBody = null; - - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); - } - - - // create path and map variables - String path = "/user/{username}".replaceAll("\\{format\\}","json") - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); - - // query params - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - - - - - - - final String[] accepts = { - "application/json", "application/xml" - }; - final String accept = apiClient.selectHeaderAccept(accepts); - - final String[] contentTypes = { - - }; - final String contentType = apiClient.selectHeaderContentType(contentTypes); - - String[] authNames = new String[] { }; - - apiClient.invokeAPI(path, "DELETE", queryParams, postBody, headerParams, formParams, accept, contentType, authNames, null); - - } - -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/ApiKeyAuth.java deleted file mode 100644 index 41094d084401..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/ApiKeyAuth.java +++ /dev/null @@ -1,59 +0,0 @@ -package io.swagger.client.auth; - -import io.swagger.client.Pair; - -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if (location == "query") { - queryParams.add(new Pair(paramName, value)); - } else if (location == "header") { - headerParams.put(paramName, value); - } - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/Authentication.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/Authentication.java deleted file mode 100644 index 5585eecdf1e2..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/Authentication.java +++ /dev/null @@ -1,12 +0,0 @@ -package io.swagger.client.auth; - -import io.swagger.client.Pair; - -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public interface Authentication { - /** Apply authentication settings to header and query params. */ - void applyToParams(List queryParams, Map headerParams); -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/HttpBasicAuth.java deleted file mode 100644 index 740d8993862d..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/HttpBasicAuth.java +++ /dev/null @@ -1,41 +0,0 @@ -package io.swagger.client.auth; - -import io.swagger.client.Pair; - -import java.util.Map; -import java.util.List; - -import java.io.UnsupportedEncodingException; -import javax.xml.bind.DatatypeConverter; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class HttpBasicAuth implements Authentication { - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - try { - headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/OAuth.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/OAuth.java deleted file mode 100644 index b592d67848f7..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/auth/OAuth.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.swagger.client.auth; - -import io.swagger.client.Pair; - -import java.util.Map; -import java.util.List; - -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class OAuth implements Authentication { - @Override - public void applyToParams(List queryParams, Map headerParams) { - // TODO: support oauth - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Category.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Category.java deleted file mode 100644 index 0d1945b5804f..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Category.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.swagger.client.model; - - - - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.JsonProperty; - - -@ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class Category { - - private Long id = null; - private String name = null; - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Order.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Order.java deleted file mode 100644 index 2a3892f29181..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Order.java +++ /dev/null @@ -1,114 +0,0 @@ -package io.swagger.client.model; - -import java.util.Date; - - - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.JsonProperty; - - -@ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class Order { - - private Long id = null; - private Long petId = null; - private Integer quantity = null; - private Date shipDate = null; - public enum StatusEnum { - placed, approved, delivered, - }; - private StatusEnum status = null; - private Boolean complete = null; - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("petId") - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("quantity") - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("shipDate") - public Date getShipDate() { - return shipDate; - } - public void setShipDate(Date shipDate) { - this.shipDate = shipDate; - } - - - /** - * Order Status - **/ - @ApiModelProperty(value = "Order Status") - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("complete") - public Boolean getComplete() { - return complete; - } - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" petId: ").append(petId).append("\n"); - sb.append(" quantity: ").append(quantity).append("\n"); - sb.append(" shipDate: ").append(shipDate).append("\n"); - sb.append(" status: ").append(status).append("\n"); - sb.append(" complete: ").append(complete).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Pet.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Pet.java deleted file mode 100644 index 6cb7df1fde58..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Pet.java +++ /dev/null @@ -1,116 +0,0 @@ -package io.swagger.client.model; - -import io.swagger.client.model.Category; -import io.swagger.client.model.Tag; -import java.util.*; - - - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.JsonProperty; - - -@ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class Pet { - - private Long id = null; - private Category category = null; - private String name = null; - private List photoUrls = new ArrayList(); - private List tags = new ArrayList(); - public enum StatusEnum { - available, pending, sold, - }; - private StatusEnum status = null; - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - - /** - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - /** - * pet status in the store - **/ - @ApiModelProperty(value = "pet status in the store") - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" category: ").append(category).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append(" photoUrls: ").append(photoUrls).append("\n"); - sb.append(" tags: ").append(tags).append("\n"); - sb.append(" status: ").append(status).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Tag.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Tag.java deleted file mode 100644 index fe212ea8ab6f..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/Tag.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.swagger.client.model; - - - - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.JsonProperty; - - -@ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class Tag { - - private Long id = null; - private String name = null; - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/User.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/User.java deleted file mode 100644 index 5b9230b8e015..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/client/model/User.java +++ /dev/null @@ -1,138 +0,0 @@ -package io.swagger.client.model; - - - - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.JsonProperty; - - -@ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-08-23T11:08:48.917-07:00") -public class User { - - private Long id = null; - private String username = null; - private String firstName = null; - private String lastName = null; - private String email = null; - private String password = null; - private String phone = null; - private Integer userStatus = null; - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("username") - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("firstName") - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("lastName") - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("email") - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("password") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - /** - **/ - @ApiModelProperty(value = "") - @JsonProperty("phone") - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - - - /** - * User Status - **/ - @ApiModelProperty(value = "User Status") - @JsonProperty("userStatus") - public Integer getUserStatus() { - return userStatus; - } - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - - sb.append(" id: ").append(id).append("\n"); - sb.append(" username: ").append(username).append("\n"); - sb.append(" firstName: ").append(firstName).append("\n"); - sb.append(" lastName: ").append(lastName).append("\n"); - sb.append(" email: ").append(email).append("\n"); - sb.append(" password: ").append(password).append("\n"); - sb.append(" phone: ").append(phone).append("\n"); - sb.append(" userStatus: ").append(userStatus).append("\n"); - sb.append("}\n"); - return sb.toString(); - } -} diff --git a/samples/server/petstore/jaxrs/src/test/java/io/swagger/test/integration/ResourceListingTestIT.java b/samples/server/petstore/jaxrs/src/test/java/io/swagger/test/integration/ResourceListingTestIT.java deleted file mode 100644 index f2b6ffffa68e..000000000000 --- a/samples/server/petstore/jaxrs/src/test/java/io/swagger/test/integration/ResourceListingTestIT.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2015 SmartBear Software - * - * 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.test.integration; - -import io.swagger.client.ApiClient; -import io.swagger.client.Pair; -import io.swagger.client.TypeRef; -import io.swagger.models.Operation; -import io.swagger.models.Response; -import io.swagger.models.Swagger; -import io.swagger.models.parameters.Parameter; -import io.swagger.models.properties.IntegerProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.Property; -import io.swagger.util.Json; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import static org.testng.Assert.*; - -public class ResourceListingTestIT { - ApiClient client = new ApiClient(); - Swagger swagger = null; - - @BeforeClass - public void setup() throws Exception { - TypeRef ref = new TypeRef(){}; - List queryParams = new ArrayList(); - Map headerParams = new HashMap(); - Map formParams = new HashMap(); - - String str = client.invokeAPI("/swagger.json", "GET", queryParams, null, headerParams, formParams, "application/json", "", new String[0], ref); - swagger = Json.mapper().readValue(str, Swagger.class); - assertNotNull(swagger); - } - - @Test - public void verifyFileInput() throws Exception { - Operation op = swagger.getPath("/pet/{petId}/uploadImage").getPost(); - List parameters = op.getParameters(); - Parameter petId = parameters.get(0); - assertEquals(petId.getName(), "petId"); - assertEquals(petId.getIn(), "path"); - - Parameter additionalMetadata = parameters.get(1); - assertEquals(additionalMetadata.getName(), "additionalMetadata"); - assertEquals(additionalMetadata.getIn(), "formData"); - - Parameter file = parameters.get(2); - assertEquals(file.getName(), "file"); - assertEquals(file.getIn(), "formData"); - } - - @Test - public void verifyMapResponse() throws Exception { - Operation op = swagger.getPath("/store/inventory").getGet(); - Response response = op.getResponses().get("200"); - - Property property = response.getSchema(); - assertTrue(property instanceof MapProperty); - - MapProperty mp = (MapProperty) property; - assertTrue(mp.getAdditionalProperties() instanceof IntegerProperty); - } -} \ No newline at end of file