-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/integrate-with-builder
- Loading branch information
Showing
15 changed files
with
557 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 118 additions & 34 deletions
152
core/src/main/kotlin/org/evomaster/core/problem/rest/RestActionBuilderV3.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
core/src/test/resources/swagger/artificial/defaultandexamples/default_object_single.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: default_object_single | ||
description: default_object_single | ||
version: 1.0.0 | ||
servers: | ||
- url: "/v2" | ||
paths: | ||
"/foo": | ||
post: | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
type: string | ||
extra: | ||
type: integer | ||
default: | ||
id: 42 | ||
name: Bar | ||
responses: | ||
'200': | ||
description: OK |
37 changes: 37 additions & 0 deletions
37
core/src/test/resources/swagger/artificial/defaultandexamples/examples_object_multi.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: example_object_multi | ||
description: example_object_multi | ||
version: 1.0.0 | ||
servers: | ||
- url: "/v2" | ||
paths: | ||
"/foo": | ||
post: | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
type: string | ||
extra: | ||
type: integer | ||
examples: | ||
Bar: | ||
value: | ||
id: 42 | ||
name: Bar | ||
Foo: | ||
value: | ||
id: 123 | ||
name: Foo | ||
extra: 77 | ||
responses: | ||
'200': | ||
description: OK |
30 changes: 30 additions & 0 deletions
30
core/src/test/resources/swagger/artificial/defaultandexamples/examples_object_single_in.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: example_object_single | ||
description: example_object_single | ||
version: 1.0.0 | ||
servers: | ||
- url: "/v2" | ||
paths: | ||
"/foo": | ||
post: | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
type: string | ||
extra: | ||
type: integer | ||
example: | ||
id: 42 | ||
name: Bar | ||
responses: | ||
'200': | ||
description: OK |
30 changes: 30 additions & 0 deletions
30
.../src/test/resources/swagger/artificial/defaultandexamples/examples_object_single_out.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: example_object_single | ||
description: example_object_single | ||
version: 1.0.0 | ||
servers: | ||
- url: "/v2" | ||
paths: | ||
"/foo": | ||
post: | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
type: string | ||
extra: | ||
type: integer | ||
example: | ||
id: 42 | ||
name: Bar | ||
responses: | ||
'200': | ||
description: OK |
35 changes: 35 additions & 0 deletions
35
...t-bb/src/main/kotlin/com/foo/rest/examples/bb/exampleobject/BBExampleObjectApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.foo.rest.examples.bb.exampleobject | ||
|
||
import org.evomaster.e2etests.utils.CoveredTargets | ||
import org.springframework.boot.SpringApplication | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.* | ||
|
||
|
||
@SpringBootApplication(exclude = [SecurityAutoConfiguration::class]) | ||
@RequestMapping(path = ["/api/bbexampleobject"]) | ||
@RestController | ||
open class BBExampleObjectApplication { | ||
|
||
companion object { | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
SpringApplication.run(BBExampleObjectApplication::class.java, *args) | ||
} | ||
} | ||
|
||
@PostMapping() | ||
fun post(@RequestBody dto: ExampleObjectDto): ResponseEntity<String>{ | ||
|
||
if(dto.id == "Foo" && dto.b == true && dto.x == 42 && dto.y == 12.3 | ||
&& dto.other?.name == "Bar" && dto.other?.x == 88){ | ||
CoveredTargets.cover("A") | ||
return ResponseEntity("OK", HttpStatus.OK) | ||
} | ||
|
||
return ResponseEntity("FAIL", HttpStatus.BAD_REQUEST) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...spring-rest-bb/src/main/kotlin/com/foo/rest/examples/bb/exampleobject/ExampleObjectDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.foo.rest.examples.bb.exampleobject | ||
|
||
class ExampleObjectDto { | ||
|
||
var id: String? = null | ||
|
||
var x: Int? = null | ||
|
||
var b: Boolean? = null | ||
|
||
var y: Double? = null | ||
|
||
var other: OtherDto? = null | ||
} |
8 changes: 8 additions & 0 deletions
8
e2e-tests/spring-rest-bb/src/main/kotlin/com/foo/rest/examples/bb/exampleobject/OtherDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.foo.rest.examples.bb.exampleobject | ||
|
||
class OtherDto { | ||
|
||
val name: String? = null | ||
|
||
val x: Int? = null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,4 @@ open class BBExamplesApplication { | |
|
||
return ResponseEntity.status(400).build() | ||
} | ||
|
||
//TODO examples in objects? | ||
} |
Oops, something went wrong.