Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
125 additions
and
19 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
46 changes: 46 additions & 0 deletions
46
e2e-tests/spring-rest-postgres/src/main/kotlin/com/foo/spring/rest/postgres/base/BaseApp.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,46 @@ | |||
package com.foo.spring.rest.postgres.base | |||
|
|||
import com.foo.spring.rest.postgres.SwaggerConfiguration | |||
import org.springframework.beans.factory.annotation.Autowired | |||
import org.springframework.boot.SpringApplication | |||
import org.springframework.boot.autoconfigure.SpringBootApplication | |||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration | |||
import org.springframework.http.ResponseEntity | |||
import org.springframework.web.bind.annotation.GetMapping | |||
import org.springframework.web.bind.annotation.RequestMapping | |||
import springfox.documentation.swagger2.annotations.EnableSwagger2 | |||
import javax.persistence.EntityManager | |||
|
|||
|
|||
|
|||
|
|||
/** | |||
* Created by arcuri82 on 21-Jun-19. | |||
*/ | |||
@EnableSwagger2 | |||
@SpringBootApplication(exclude = [SecurityAutoConfiguration::class]) | |||
@RequestMapping(path = ["/api/basic"]) | |||
open class BaseApp : SwaggerConfiguration() { | |||
|
|||
companion object { | |||
@JvmStatic | |||
fun main(args: Array<String>) { | |||
SpringApplication.run(BaseApp::class.java, *args) | |||
} | |||
} | |||
|
|||
@Autowired | |||
private lateinit var em : EntityManager | |||
|
|||
|
|||
@GetMapping | |||
open fun get() : ResponseEntity<Any> { | |||
|
|||
val query = em.createNativeQuery("select * from X where id>0") | |||
val res = query.resultList | |||
|
|||
val status = if(res.isEmpty()) 400 else 200 | |||
|
|||
return ResponseEntity.status(status).build<Any>() | |||
} | |||
} |
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
4 changes: 4 additions & 0 deletions
4
e2e-tests/spring-rest-postgres/src/main/resources/schema/base/V1.0__createDB.sql
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
create table X ( | |||
id BIGINT, | |||
constraint pk_x primary key (id) | |||
); |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
.../spring-rest-postgres/src/test/kotlin/com/foo/spring/rest/postgres/base/BaseController.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
package com.foo.spring.rest.postgres.base | |||
|
|||
|
|||
import com.foo.spring.rest.postgres.SpringRestPostgresController | |||
|
|||
/** | |||
* Created by arcuri82 on 21-Jun-19. | |||
*/ | |||
class BaseController : SpringRestPostgresController(BaseApp::class.java) { | |||
|
|||
override fun pathToFlywayFiles() = "classpath:/schema/base" | |||
} |
11 changes: 0 additions & 11 deletions
11
...pring-rest-postgres/src/test/kotlin/com/foo/spring/rest/postgres/basic/BasicController.kt
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
.../spring-rest-postgres/src/test/kotlin/com/foo/spring/rest/postgres/ind0/Ind0Controller.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
package com.foo.spring.rest.postgres.ind0 | |||
|
|||
import com.foo.spring.rest.postgres.SpringRestPostgresController | |||
|
|||
/** | |||
* Created by arcuri82 on 21-Jun-19. | |||
*/ | |||
class Ind0Controller : SpringRestPostgresController(Ind0App::class.java) { | |||
|
|||
override fun pathToFlywayFiles() = "classpath:/schema/ind0" | |||
} |
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
39 changes: 39 additions & 0 deletions
39
...t-postgres/src/test/kotlin/org/evomaster/e2etests/spring/rest/postgres/ind0/Ind0EMTest.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
package org.evomaster.e2etests.spring.rest.postgres.ind0 | |||
|
|||
import com.foo.spring.rest.postgres.ind0.Ind0Controller | |||
import org.evomaster.core.problem.rest.HttpVerb | |||
import org.evomaster.e2etests.spring.rest.postgres.SpringRestPostgresTestBase | |||
import org.junit.jupiter.api.Assertions.assertTrue | |||
import org.junit.jupiter.api.BeforeAll | |||
import org.junit.jupiter.api.Test | |||
|
|||
/** | |||
* Created by arcuri82 on 21-Jun-19. | |||
*/ | |||
class Ind0EMTest : SpringRestPostgresTestBase(){ | |||
|
|||
companion object { | |||
@BeforeAll @JvmStatic | |||
fun initClass() { | |||
SpringRestPostgresTestBase.initKlass(Ind0Controller()) | |||
} | |||
} | |||
|
|||
@Test | |||
fun testRunEM() { | |||
|
|||
runTestHandlingFlakyAndCompilation( | |||
"Ind0EM", | |||
"org.bar.Ind0EM", | |||
100 | |||
) { args -> | |||
|
|||
val solution = initAndRun(args) | |||
|
|||
assertTrue(solution.individuals.size >= 1) | |||
|
|||
assertHasAtLeastOne(solution, HttpVerb.GET, 400) | |||
assertHasAtLeastOne(solution, HttpVerb.GET, 200) | |||
} | |||
} | |||
} |