Skip to content

Commit a16199d

Browse files
Merge branch 'master' into feature/jsonPatch
2 parents 8e4c63d + 273a03a commit a16199d

29 files changed

Lines changed: 1012 additions & 33 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
# An exception is docs/options.md , as created from build
1212
paths:
1313
- "**"
14+
- '!pypi-distribution/**'
1415
- '!scripts/**'
1516
- '!version.py'
1617
- '!makeExecutable.sh'

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ jobs:
4747
path: core/target/evomaster.jar
4848
retention-days: ${{env.retention-days}}
4949
if-no-files-found: error
50+
51+
52+
publish-docker:
53+
needs: build-base
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
- name: Download fat jar
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: evomaster.jar
61+
path: core/target
5062
- name: Docker meta
5163
id: meta
5264
uses: docker/metadata-action@v5
@@ -70,6 +82,7 @@ jobs:
7082
tags: ${{ steps.meta.outputs.tags }}
7183
labels: ${{ steps.meta.outputs.labels }}
7284

85+
7386
installer-for-windows:
7487
needs: build-base
7588
runs-on: windows-latest
@@ -185,3 +198,39 @@ jobs:
185198
evomaster-${{env.evomaster-version}}.dmg
186199
evomaster_${{env.evomaster-version}}_amd64.deb
187200
# JDK 17 and 21 use different suffixes... doesn't seem configurable :(
201+
202+
publish-python:
203+
needs: build-base
204+
name: Build Python Distribution and Publish on PyPi
205+
runs-on: ubuntu-latest
206+
207+
steps:
208+
- uses: actions/checkout@v6
209+
210+
- name: Set up Python
211+
uses: actions/setup-python@v6
212+
with:
213+
python-version: "3.11"
214+
215+
- name: Install 'build'
216+
shell: bash
217+
run: |
218+
pip install build
219+
220+
- name: Build Python Wheel
221+
shell: bash
222+
working-directory: ./pypi-distribution
223+
run: |
224+
rm -fr dist
225+
python -m build
226+
227+
- uses: actions/upload-artifact@v7
228+
with:
229+
path: ./pypi-distribution/dist/*.whl
230+
retention-days: ${{env.retention-days}}
231+
232+
- name: Publish to PyPI
233+
uses: pypa/gh-action-pypi-publish@release/v1
234+
with:
235+
packages-dir: ./pypi-distribution/dist
236+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,10 @@ core-tests/e2e-tests/spring/spring-rest-mysql/target
165165
/core-tests/jdk-8/spring-rest-openapi-v2-driver/target/
166166
/core-tests/jdk-8/spring-rest-openapi-v2-sut/target/
167167
/core-tests/jdk-8/spring-rest-openapi-v2-tests/target/
168+
/pypi-distribution/dist/
169+
/pypi-distribution/src/evomaster.egg-info/
170+
/build/
171+
/pypi-distribution/dmg/
172+
/pypi-distribution/src/evomaster/dmg/
173+
/pypi-distribution/src/evomaster/release/
174+
/pypi-distribution/em.yaml

buildAll.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

client-java/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<build>
6767
<!--
6868
When we make a release, the client-java must be published on Maven Central.
69-
This requires to create jars for sources and javadocs.
70-
As the javadocs build might fail, we force its creation at each build,
69+
This requires creating jars for sources and Javadocs.
70+
As the Javadocs build might fail, we force its creation at each build
7171
so that any issue can be fixed as soon as it is introduced.
7272
-->
7373
<plugins>
@@ -88,7 +88,7 @@
8888
<plugin>
8989
<groupId>org.apache.maven.plugins</groupId>
9090
<artifactId>maven-javadoc-plugin</artifactId>
91-
<version>3.1.1</version>
91+
<version>3.12.0</version>
9292
<configuration>
9393
<source>8</source>
9494
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.foo.rest.examples.spring.openapi.v3.httporacle.misleadingcreateput
2+
3+
import org.springframework.boot.SpringApplication
4+
import org.springframework.boot.autoconfigure.SpringBootApplication
5+
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
6+
import org.springframework.http.ResponseEntity
7+
import org.springframework.web.bind.annotation.GetMapping
8+
import org.springframework.web.bind.annotation.PathVariable
9+
import org.springframework.web.bind.annotation.PostMapping
10+
import org.springframework.web.bind.annotation.PutMapping
11+
import org.springframework.web.bind.annotation.RequestBody
12+
import org.springframework.web.bind.annotation.RequestMapping
13+
import org.springframework.web.bind.annotation.RestController
14+
15+
@SpringBootApplication(exclude = [SecurityAutoConfiguration::class])
16+
@RequestMapping(path = ["/api/resources"])
17+
@RestController
18+
open class MisleadingCreatePutApplication {
19+
20+
companion object {
21+
@JvmStatic
22+
fun main(args: Array<String>) {
23+
SpringApplication.run(MisleadingCreatePutApplication::class.java, *args)
24+
}
25+
26+
private val data = mutableMapOf<Int, ResourceData>()
27+
28+
fun reset(){
29+
data.clear()
30+
data[0] = ResourceData("existing", 42)
31+
}
32+
}
33+
34+
data class ResourceData(
35+
var name: String,
36+
var value: Int
37+
)
38+
39+
data class UpdateRequest(
40+
val name: String,
41+
val value: Int
42+
)
43+
44+
@GetMapping(path = ["/{id}"])
45+
open fun get(@PathVariable("id") id: Int): ResponseEntity<ResourceData> {
46+
val resource = data[id]
47+
?: return ResponseEntity.status(404).build()
48+
return ResponseEntity.status(200).body(resource)
49+
}
50+
51+
@PutMapping(path = ["/{id}"])
52+
open fun put(
53+
@PathVariable("id") id: Int,
54+
@RequestBody body: UpdateRequest
55+
): ResponseEntity<Any> {
56+
57+
val resource = data[id]
58+
59+
if(resource == null) {
60+
val created = ResourceData(body.name, body.value)
61+
data[id] = created
62+
return ResponseEntity.status(201).body(created)
63+
}
64+
65+
// bug: returns 201 even when resource already exists
66+
resource.name = body.name
67+
resource.value = body.value
68+
return ResponseEntity.status(201).body(resource)
69+
}
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.foo.rest.examples.spring.openapi.v3.httporacle.misleadingcreateput
2+
3+
import com.foo.rest.examples.spring.openapi.v3.SpringController
4+
5+
6+
class HttpMisleadingCreatePutController: SpringController(MisleadingCreatePutApplication::class.java){
7+
8+
override fun resetStateOfSUT() {
9+
MisleadingCreatePutApplication.reset()
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package org.evomaster.e2etests.spring.openapi.v3.httporacle.misleadingcreateput
2+
3+
import com.foo.rest.examples.spring.openapi.v3.httporacle.misleadingcreateput.HttpMisleadingCreatePutController
4+
import com.foo.rest.examples.spring.openapi.v3.httporacle.partialupdateput.HttpPartialUpdatePutController
5+
import org.evomaster.core.problem.enterprise.DetectedFaultUtils
6+
import org.evomaster.core.problem.enterprise.ExperimentalFaultCategory
7+
import org.evomaster.core.problem.rest.data.HttpVerb
8+
import org.evomaster.e2etests.spring.openapi.v3.SpringTestBase
9+
import org.junit.jupiter.api.Assertions.assertEquals
10+
import org.junit.jupiter.api.Assertions.assertTrue
11+
import org.junit.jupiter.api.BeforeAll
12+
import org.junit.jupiter.api.Test
13+
14+
class MisleadingCreatePutEMTest : SpringTestBase(){
15+
16+
companion object {
17+
@BeforeAll
18+
@JvmStatic
19+
fun init() {
20+
initClass(HttpMisleadingCreatePutController())
21+
}
22+
}
23+
24+
25+
@Test
26+
fun testRunEM() {
27+
28+
runTestHandlingFlakyAndCompilation(
29+
"HttpMisleadingCreatePutPutEM",
30+
3000
31+
) { args: MutableList<String> ->
32+
33+
setOption(args, "security", "false")
34+
setOption(args, "schemaOracles", "false")
35+
setOption(args, "httpOracles", "true")
36+
setOption(args, "useExperimentalOracles", "true")
37+
38+
val solution = initAndRun(args)
39+
40+
assertTrue(solution.individuals.size >= 1)
41+
42+
assertHasAtLeastOne(solution, HttpVerb.PUT, 201, "/api/resources/{id}", null)
43+
44+
val faultsCategories = DetectedFaultUtils.getDetectedFaultCategories(solution)
45+
assertTrue(ExperimentalFaultCategory.HTTP_MISLEADING_CREATE_PUT in faultsCategories)
46+
47+
}
48+
}
49+
}

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
<Specification-Title>${project.name}</Specification-Title>
417417
<Specification-Version>${project.version}</Specification-Version>
418418
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
419-
<!-- Keep this in sync with JdkIssue -->
419+
<!-- Keep this in sync with JdkIssue and makeExecutable.sh -->
420420
<Add-Opens>java.base/java.net java.base/java.util</Add-Opens>
421421
</manifestEntries>
422422
</transformer>

core/src/main/kotlin/org/evomaster/core/JdkIssue.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object JdkIssue {
2222
return true
2323
}catch (e: Exception){
2424

25-
//This needs to be kept in sync with core/pom.xml -> maven-assembly-plugin
25+
//This needs to be kept in sync with core/pom.xml -> maven-assembly-plugin and makeExecutable.sh
2626
val command = "--add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED"
2727

2828
LoggingUtil.getInfoLogger().error(inRed("It looks like you are running EvoMaster with JDK 17+," +

0 commit comments

Comments
 (0)