mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 10:46:09 +00:00
Add Flow import to kotlin spring reactive (#3107)
* Add Flow import to kotlin spring reactive * Add runBlockingTest to api tests * Add kotlin-springboot-petstore-server-reactive.sh to ensure-up-to-date * add reactive check for runBlockingTest * Samples
This commit is contained in:
committed by
William Cheng
parent
1d8c9dcc0b
commit
a882e4b3a5
@@ -25,6 +25,7 @@ declare -a scripts=(
|
|||||||
"./bin/kotlin-client-threetenbp.sh"
|
"./bin/kotlin-client-threetenbp.sh"
|
||||||
"./bin/kotlin-server-petstore.sh"
|
"./bin/kotlin-server-petstore.sh"
|
||||||
"./bin/kotlin-springboot-petstore-server.sh"
|
"./bin/kotlin-springboot-petstore-server.sh"
|
||||||
|
"./bin/kotlin-springboot-petstore-server-reactive.sh"
|
||||||
"./bin/mysql-schema-petstore.sh"
|
"./bin/mysql-schema-petstore.sh"
|
||||||
"./bin/python-petstore-all.sh"
|
"./bin/python-petstore-all.sh"
|
||||||
"./bin/openapi3/python-petstore.sh"
|
"./bin/openapi3/python-petstore.sh"
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ package {{package}}
|
|||||||
{{/imports}}
|
{{/imports}}
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
{{#reactive}}
|
||||||
|
import kotlinx.coroutines.flow.Flow;
|
||||||
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
|
{{/reactive}}
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
|
|
||||||
class {{classname}}Test {
|
class {{classname}}Test {
|
||||||
@@ -21,7 +25,7 @@ class {{classname}}Test {
|
|||||||
* if the Api call fails
|
* if the Api call fails
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
fun {{operationId}}Test() {
|
fun {{operationId}}Test() {{#reactive}}= runBlockingTest {{/reactive}}{
|
||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
val {{paramName}}:{{{dataType}}}? = null
|
val {{paramName}}:{{{dataType}}}? = null
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ dependencies {
|
|||||||
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
||||||
exclude(module = "junit")
|
exclude(module = "junit")
|
||||||
}
|
}
|
||||||
|
{{#reactive}}
|
||||||
|
testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion")
|
||||||
|
{{/reactive}}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
4.0.1-SNAPSHOT
|
4.0.2-SNAPSHOT
|
||||||
@@ -43,9 +43,11 @@ dependencies {
|
|||||||
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
||||||
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
|
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||||
|
|
||||||
|
testCompile("org.jetbrains.kotlin:kotlin-test-junit5")
|
||||||
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
testCompile("org.springframework.boot:spring-boot-starter-test") {
|
||||||
exclude(module = "junit")
|
exclude(module = "junit")
|
||||||
}
|
}
|
||||||
|
testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -117,6 +117,12 @@
|
|||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-test-junit5</artifactId>
|
||||||
|
<version>1.3.31</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
|
suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.addPet(body), HttpStatus.OK)
|
return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -70,10 +70,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = ["/pet/{petId}"],
|
value = ["/pet/{petId}"],
|
||||||
method = [RequestMethod.DELETE])
|
method = [RequestMethod.DELETE])
|
||||||
suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long
|
suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||||
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?
|
,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String?
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK)
|
return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -89,9 +89,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
value = ["/pet/findByStatus"],
|
value = ["/pet/findByStatus"],
|
||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List<String>
|
fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List<kotlin.String>
|
||||||
): ResponseEntity<Flow<Pet>> {
|
): ResponseEntity<Flow<Pet>> {
|
||||||
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK)
|
return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -107,9 +107,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
value = ["/pet/findByTags"],
|
value = ["/pet/findByTags"],
|
||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List<String>
|
fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List<kotlin.String>
|
||||||
): ResponseEntity<Flow<Pet>> {
|
): ResponseEntity<Flow<Pet>> {
|
||||||
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK)
|
return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -124,9 +124,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
value = ["/pet/{petId}"],
|
value = ["/pet/{petId}"],
|
||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long
|
suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||||
): ResponseEntity<Pet> {
|
): ResponseEntity<Pet> {
|
||||||
return ResponseEntity(service.getPetById(petId), HttpStatus.OK)
|
return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -142,7 +142,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
method = [RequestMethod.PUT])
|
method = [RequestMethod.PUT])
|
||||||
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
|
suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.updatePet(body), HttpStatus.OK)
|
return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -156,11 +156,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
value = ["/pet/{petId}"],
|
value = ["/pet/{petId}"],
|
||||||
consumes = ["application/x-www-form-urlencoded"],
|
consumes = ["application/x-www-form-urlencoded"],
|
||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long
|
suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||||
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String?
|
,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String?
|
||||||
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String?
|
,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String?
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK)
|
return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -176,10 +176,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) {
|
|||||||
produces = ["application/json"],
|
produces = ["application/json"],
|
||||||
consumes = ["multipart/form-data"],
|
consumes = ["multipart/form-data"],
|
||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long
|
suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long
|
||||||
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String?
|
,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String?
|
||||||
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
|
,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource?
|
||||||
): ResponseEntity<ModelApiResponse> {
|
): ResponseEntity<ModelApiResponse> {
|
||||||
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK)
|
return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ interface PetApiService {
|
|||||||
|
|
||||||
suspend fun addPet(body: Pet): Unit
|
suspend fun addPet(body: Pet): Unit
|
||||||
|
|
||||||
suspend fun deletePet(petId: Long, apiKey: String?): Unit
|
suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit
|
||||||
|
|
||||||
fun findPetsByStatus(status: List<String>): Flow<Pet>
|
fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): Flow<Pet>
|
||||||
|
|
||||||
fun findPetsByTags(tags: List<String>): Flow<Pet>
|
fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet>
|
||||||
|
|
||||||
suspend fun getPetById(petId: Long): Pet
|
suspend fun getPetById(petId: kotlin.Long): Pet
|
||||||
|
|
||||||
suspend fun updatePet(body: Pet): Unit
|
suspend fun updatePet(body: Pet): Unit
|
||||||
|
|
||||||
suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit
|
suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit
|
||||||
|
|
||||||
suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ class PetApiServiceImpl : PetApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun deletePet(petId: Long, apiKey: String?): Unit {
|
override suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findPetsByStatus(status: List<String>): Flow<Pet> {
|
override fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>): Flow<Pet> {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findPetsByTags(tags: List<String>): Flow<Pet> {
|
override fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>): Flow<Pet> {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getPetById(petId: Long): Pet {
|
override suspend fun getPetById(petId: kotlin.Long): Pet {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +31,11 @@ class PetApiServiceImpl : PetApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit {
|
override suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,26 +52,26 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
|||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = ["/store/order/{orderId}"],
|
value = ["/store/order/{orderId}"],
|
||||||
method = [RequestMethod.DELETE])
|
method = [RequestMethod.DELETE])
|
||||||
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String
|
suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK)
|
return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
value = "Returns pet inventories by status",
|
value = "Returns pet inventories by status",
|
||||||
nickname = "getInventory",
|
nickname = "getInventory",
|
||||||
notes = "Returns a map of status codes to quantities",
|
notes = "Returns a map of status codes to quantities",
|
||||||
response = Int::class,
|
response = kotlin.Int::class,
|
||||||
responseContainer = "Map",
|
responseContainer = "Map",
|
||||||
authorizations = [Authorization(value = "api_key")])
|
authorizations = [Authorization(value = "api_key")])
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")])
|
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")])
|
||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = ["/store/inventory"],
|
value = ["/store/inventory"],
|
||||||
produces = ["application/json"],
|
produces = ["application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
suspend fun getInventory(): ResponseEntity<Map<String, Int>> {
|
suspend fun getInventory(): ResponseEntity<Map<String, kotlin.Int>> {
|
||||||
return ResponseEntity(service.getInventory(), HttpStatus.OK)
|
return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -85,9 +85,9 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
|||||||
value = ["/store/order/{orderId}"],
|
value = ["/store/order/{orderId}"],
|
||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long
|
suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long
|
||||||
): ResponseEntity<Order> {
|
): ResponseEntity<Order> {
|
||||||
return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK)
|
return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -103,6 +103,6 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic
|
|||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order
|
suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order
|
||||||
): ResponseEntity<Order> {
|
): ResponseEntity<Order> {
|
||||||
return ResponseEntity(service.placeOrder(body), HttpStatus.OK)
|
return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import org.openapitools.model.Order
|
|||||||
import kotlinx.coroutines.flow.Flow;
|
import kotlinx.coroutines.flow.Flow;
|
||||||
interface StoreApiService {
|
interface StoreApiService {
|
||||||
|
|
||||||
suspend fun deleteOrder(orderId: String): Unit
|
suspend fun deleteOrder(orderId: kotlin.String): Unit
|
||||||
|
|
||||||
suspend fun getInventory(): Map<String, Int>
|
suspend fun getInventory(): Map<String, kotlin.Int>
|
||||||
|
|
||||||
suspend fun getOrderById(orderId: Long): Order
|
suspend fun getOrderById(orderId: kotlin.Long): Order
|
||||||
|
|
||||||
suspend fun placeOrder(body: Order): Order
|
suspend fun placeOrder(body: Order): Order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import org.springframework.stereotype.Service
|
|||||||
@Service
|
@Service
|
||||||
class StoreApiServiceImpl : StoreApiService {
|
class StoreApiServiceImpl : StoreApiService {
|
||||||
|
|
||||||
override suspend fun deleteOrder(orderId: String): Unit {
|
override suspend fun deleteOrder(orderId: kotlin.String): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getInventory(): Map<String, Int> {
|
override suspend fun getInventory(): Map<String, kotlin.Int> {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getOrderById(orderId: Long): Order {
|
override suspend fun getOrderById(orderId: kotlin.Long): Order {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User
|
suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.createUser(body), HttpStatus.OK)
|
return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -68,7 +68,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow<User>
|
suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow<User>
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK)
|
return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -82,7 +82,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
method = [RequestMethod.POST])
|
method = [RequestMethod.POST])
|
||||||
suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow<User>
|
suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow<User>
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK)
|
return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -94,9 +94,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = ["/user/{username}"],
|
value = ["/user/{username}"],
|
||||||
method = [RequestMethod.DELETE])
|
method = [RequestMethod.DELETE])
|
||||||
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String
|
suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.deleteUser(username), HttpStatus.OK)
|
return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -110,26 +110,26 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
value = ["/user/{username}"],
|
value = ["/user/{username}"],
|
||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String
|
suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String
|
||||||
): ResponseEntity<User> {
|
): ResponseEntity<User> {
|
||||||
return ResponseEntity(service.getUserByName(username), HttpStatus.OK)
|
return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
value = "Logs user into the system",
|
value = "Logs user into the system",
|
||||||
nickname = "loginUser",
|
nickname = "loginUser",
|
||||||
notes = "",
|
notes = "",
|
||||||
response = String::class)
|
response = kotlin.String::class)
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")])
|
||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = ["/user/login"],
|
value = ["/user/login"],
|
||||||
produces = ["application/xml", "application/json"],
|
produces = ["application/xml", "application/json"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
suspend fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String
|
suspend fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String
|
||||||
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String
|
,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String
|
||||||
): ResponseEntity<String> {
|
): ResponseEntity<kotlin.String> {
|
||||||
return ResponseEntity(service.loginUser(username, password), HttpStatus.OK)
|
return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -142,7 +142,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
value = ["/user/logout"],
|
value = ["/user/logout"],
|
||||||
method = [RequestMethod.GET])
|
method = [RequestMethod.GET])
|
||||||
suspend fun logoutUser(): ResponseEntity<Unit> {
|
suspend fun logoutUser(): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.logoutUser(), HttpStatus.OK)
|
return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
@@ -154,9 +154,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService)
|
|||||||
@RequestMapping(
|
@RequestMapping(
|
||||||
value = ["/user/{username}"],
|
value = ["/user/{username}"],
|
||||||
method = [RequestMethod.PUT])
|
method = [RequestMethod.PUT])
|
||||||
suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String
|
suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String
|
||||||
,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User
|
,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User
|
||||||
): ResponseEntity<Unit> {
|
): ResponseEntity<Unit> {
|
||||||
return ResponseEntity(service.updateUser(username, body), HttpStatus.OK)
|
return ResponseEntity(service.updateUser(username, body), HttpStatus.valueOf(400))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ interface UserApiService {
|
|||||||
|
|
||||||
suspend fun createUsersWithListInput(body: Flow<User>): Unit
|
suspend fun createUsersWithListInput(body: Flow<User>): Unit
|
||||||
|
|
||||||
suspend fun deleteUser(username: String): Unit
|
suspend fun deleteUser(username: kotlin.String): Unit
|
||||||
|
|
||||||
suspend fun getUserByName(username: String): User
|
suspend fun getUserByName(username: kotlin.String): User
|
||||||
|
|
||||||
suspend fun loginUser(username: String, password: String): String
|
suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String
|
||||||
|
|
||||||
suspend fun logoutUser(): Unit
|
suspend fun logoutUser(): Unit
|
||||||
|
|
||||||
suspend fun updateUser(username: String, body: User): Unit
|
suspend fun updateUser(username: kotlin.String, body: User): Unit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ class UserApiServiceImpl : UserApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun deleteUser(username: String): Unit {
|
override suspend fun deleteUser(username: kotlin.String): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getUserByName(username: String): User {
|
override suspend fun getUserByName(username: kotlin.String): User {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loginUser(username: String, password: String): String {
|
override suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ class UserApiServiceImpl : UserApiService {
|
|||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun updateUser(username: String, body: User): Unit {
|
override suspend fun updateUser(username: kotlin.String, body: User): Unit {
|
||||||
TODO("Implement me")
|
TODO("Implement me")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
|||||||
data class Category (
|
data class Category (
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("id") val id: Long? = null,
|
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("name") val name: String? = null
|
@JsonProperty("name") val name: kotlin.String? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ import io.swagger.annotations.ApiModelProperty
|
|||||||
data class ModelApiResponse (
|
data class ModelApiResponse (
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("code") val code: Int? = null,
|
@JsonProperty("code") val code: kotlin.Int? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("type") val type: String? = null,
|
@JsonProperty("type") val type: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("message") val message: String? = null
|
@JsonProperty("message") val message: kotlin.String? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ import io.swagger.annotations.ApiModelProperty
|
|||||||
data class Order (
|
data class Order (
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("id") val id: Long? = null,
|
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("petId") val petId: Long? = null,
|
@JsonProperty("petId") val petId: kotlin.Long? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("quantity") val quantity: Int? = null,
|
@JsonProperty("quantity") val quantity: kotlin.Int? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
@JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null,
|
||||||
@@ -39,14 +39,14 @@ data class Order (
|
|||||||
@JsonProperty("status") val status: Order.Status? = null,
|
@JsonProperty("status") val status: Order.Status? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("complete") val complete: Boolean? = null
|
@JsonProperty("complete") val complete: kotlin.Boolean? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order Status
|
* Order Status
|
||||||
* Values: placed,approved,delivered
|
* Values: placed,approved,delivered
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: String) {
|
enum class Status(val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("placed") placed("placed"),
|
@JsonProperty("placed") placed("placed"),
|
||||||
|
|
||||||
|
|||||||
@@ -27,20 +27,20 @@ data class Pet (
|
|||||||
|
|
||||||
@get:NotNull
|
@get:NotNull
|
||||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||||
@JsonProperty("name") val name: String,
|
@JsonProperty("name") val name: kotlin.String,
|
||||||
|
|
||||||
@get:NotNull
|
@get:NotNull
|
||||||
@ApiModelProperty(example = "null", required = true, value = "")
|
@ApiModelProperty(example = "null", required = true, value = "")
|
||||||
@JsonProperty("photoUrls") val photoUrls: List<String>,
|
@JsonProperty("photoUrls") val photoUrls: kotlin.collections.List<kotlin.String>,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("id") val id: Long? = null,
|
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("category") val category: Category? = null,
|
@JsonProperty("category") val category: Category? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("tags") val tags: List<Tag>? = null,
|
@JsonProperty("tags") val tags: kotlin.collections.List<Tag>? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||||
@JsonProperty("status") val status: Pet.Status? = null
|
@JsonProperty("status") val status: Pet.Status? = null
|
||||||
@@ -50,7 +50,7 @@ data class Pet (
|
|||||||
* pet status in the store
|
* pet status in the store
|
||||||
* Values: available,pending,sold
|
* Values: available,pending,sold
|
||||||
*/
|
*/
|
||||||
enum class Status(val value: String) {
|
enum class Status(val value: kotlin.String) {
|
||||||
|
|
||||||
@JsonProperty("available") available("available"),
|
@JsonProperty("available") available("available"),
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty
|
|||||||
data class Tag (
|
data class Tag (
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("id") val id: Long? = null,
|
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("name") val name: String? = null
|
@JsonProperty("name") val name: kotlin.String? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,28 +25,28 @@ import io.swagger.annotations.ApiModelProperty
|
|||||||
data class User (
|
data class User (
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("id") val id: Long? = null,
|
@JsonProperty("id") val id: kotlin.Long? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("username") val username: String? = null,
|
@JsonProperty("username") val username: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("firstName") val firstName: String? = null,
|
@JsonProperty("firstName") val firstName: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("lastName") val lastName: String? = null,
|
@JsonProperty("lastName") val lastName: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("email") val email: String? = null,
|
@JsonProperty("email") val email: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("password") val password: String? = null,
|
@JsonProperty("password") val password: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "")
|
@ApiModelProperty(example = "null", value = "")
|
||||||
@JsonProperty("phone") val phone: String? = null,
|
@JsonProperty("phone") val phone: kotlin.String? = null,
|
||||||
|
|
||||||
@ApiModelProperty(example = "null", value = "User Status")
|
@ApiModelProperty(example = "null", value = "User Status")
|
||||||
@JsonProperty("userStatus") val userStatus: Int? = null
|
@JsonProperty("userStatus") val userStatus: kotlin.Int? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package org.openapitools.api
|
||||||
|
|
||||||
|
import org.openapitools.model.ModelApiResponse
|
||||||
|
import org.openapitools.model.Pet
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.Flow;
|
||||||
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
|
||||||
|
class PetApiTest {
|
||||||
|
|
||||||
|
private val service: PetApiService = PetApiServiceImpl()
|
||||||
|
private val api: PetApiController = PetApiController(service)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new pet to the store
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun addPetTest() = runBlockingTest {
|
||||||
|
val body:Pet? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.addPet(body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun deletePetTest() = runBlockingTest {
|
||||||
|
val petId:kotlin.Long? = null
|
||||||
|
val apiKey:kotlin.String? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.deletePet(petId!!, apiKey!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by status
|
||||||
|
*
|
||||||
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun findPetsByStatusTest() = runBlockingTest {
|
||||||
|
val status:kotlin.collections.List<kotlin.String>? = null
|
||||||
|
val response: ResponseEntity<Flow<Pet>> = api.findPetsByStatus(status!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds Pets by tags
|
||||||
|
*
|
||||||
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun findPetsByTagsTest() = runBlockingTest {
|
||||||
|
val tags:kotlin.collections.List<kotlin.String>? = null
|
||||||
|
val response: ResponseEntity<Flow<Pet>> = api.findPetsByTags(tags!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find pet by ID
|
||||||
|
*
|
||||||
|
* Returns a single pet
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun getPetByIdTest() = runBlockingTest {
|
||||||
|
val petId:kotlin.Long? = null
|
||||||
|
val response: ResponseEntity<Pet> = api.getPetById(petId!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update an existing pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun updatePetTest() = runBlockingTest {
|
||||||
|
val body:Pet? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.updatePet(body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a pet in the store with form data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun updatePetWithFormTest() = runBlockingTest {
|
||||||
|
val petId:kotlin.Long? = null
|
||||||
|
val name:kotlin.String? = null
|
||||||
|
val status:kotlin.String? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.updatePetWithForm(petId!!, name!!, status!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uploads an image
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun uploadFileTest() = runBlockingTest {
|
||||||
|
val petId:kotlin.Long? = null
|
||||||
|
val additionalMetadata:kotlin.String? = null
|
||||||
|
val file:org.springframework.core.io.Resource? = null
|
||||||
|
val response: ResponseEntity<ModelApiResponse> = api.uploadFile(petId!!, additionalMetadata!!, file!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package org.openapitools.api
|
||||||
|
|
||||||
|
import org.openapitools.model.Order
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.Flow;
|
||||||
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
|
||||||
|
class StoreApiTest {
|
||||||
|
|
||||||
|
private val service: StoreApiService = StoreApiServiceImpl()
|
||||||
|
private val api: StoreApiController = StoreApiController(service)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun deleteOrderTest() = runBlockingTest {
|
||||||
|
val orderId:kotlin.String? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.deleteOrder(orderId!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pet inventories by status
|
||||||
|
*
|
||||||
|
* Returns a map of status codes to quantities
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun getInventoryTest() = runBlockingTest {
|
||||||
|
val response: ResponseEntity<Map<String, kotlin.Int>> = api.getInventory()
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find purchase order by ID
|
||||||
|
*
|
||||||
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun getOrderByIdTest() = runBlockingTest {
|
||||||
|
val orderId:kotlin.Long? = null
|
||||||
|
val response: ResponseEntity<Order> = api.getOrderById(orderId!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Place an order for a pet
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun placeOrderTest() = runBlockingTest {
|
||||||
|
val body:Order? = null
|
||||||
|
val response: ResponseEntity<Order> = api.placeOrder(body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package org.openapitools.api
|
||||||
|
|
||||||
|
import org.openapitools.model.User
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.Flow;
|
||||||
|
import kotlinx.coroutines.test.runBlockingTest
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
|
||||||
|
class UserApiTest {
|
||||||
|
|
||||||
|
private val service: UserApiService = UserApiServiceImpl()
|
||||||
|
private val api: UserApiController = UserApiController(service)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun createUserTest() = runBlockingTest {
|
||||||
|
val body:User? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.createUser(body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun createUsersWithArrayInputTest() = runBlockingTest {
|
||||||
|
val body:kotlin.collections.List<User>? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.createUsersWithArrayInput(body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates list of users with given input array
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun createUsersWithListInputTest() = runBlockingTest {
|
||||||
|
val body:kotlin.collections.List<User>? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.createUsersWithListInput(body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun deleteUserTest() = runBlockingTest {
|
||||||
|
val username:kotlin.String? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.deleteUser(username!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get user by user name
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun getUserByNameTest() = runBlockingTest {
|
||||||
|
val username:kotlin.String? = null
|
||||||
|
val response: ResponseEntity<User> = api.getUserByName(username!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs user into the system
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun loginUserTest() = runBlockingTest {
|
||||||
|
val username:kotlin.String? = null
|
||||||
|
val password:kotlin.String? = null
|
||||||
|
val response: ResponseEntity<kotlin.String> = api.loginUser(username!!, password!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs out current logged in user session
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun logoutUserTest() = runBlockingTest {
|
||||||
|
val response: ResponseEntity<Unit> = api.logoutUser()
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updated user
|
||||||
|
*
|
||||||
|
* This can only be done by the logged in user.
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun updateUserTest() = runBlockingTest {
|
||||||
|
val username:kotlin.String? = null
|
||||||
|
val body:User? = null
|
||||||
|
val response: ResponseEntity<Unit> = api.updateUser(username!!, body!!)
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user