Skip to content

Commit f2be4b3

Browse files
committed
candidate fix
1 parent cb042e3 commit f2be4b3

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

core/src/main/kotlin/org/evomaster/core/problem/rest/service/CallGraphService.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CallGraphService {
6565
/**
6666
* Check in the schema if there is any action which is a direct child of [a] and last path element is a parameter
6767
*/
68-
fun hasParameterChild(a: RestCallAction): Boolean {
68+
fun isThereChildActionWithParameter(a: RestCallAction): Boolean {
6969
return sampler.seeAvailableActions()
7070
.filterIsInstance<RestCallAction>()
7171
.map { it.path }
@@ -81,9 +81,9 @@ class CallGraphService {
8181

8282
fun resolveLocationForParentOfChildOperationUsingCreatedResource(create: RestCallAction): String? {
8383

84-
if(hasParameterChild(create)) {
84+
if(isThereChildActionWithParameter(create)) {
8585
//simple case
86-
return create.resolvedPath()
86+
return create.resolvedOnlyPath()
8787
}
8888

8989
/*

core/src/main/kotlin/org/evomaster/core/problem/rest/service/fitness/AbstractRestFitness.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,10 @@ abstract class AbstractRestFitness : HttpWsFitness<RestIndividual>() {
877877
it is or not a valid char.
878878
Furthermore, likely needed to be done in resolveLocation,
879879
or at least check how RestAssured would behave
880+
TODO update RestPathTest, check TODO there, once fixed
880881
*/
881882
//it.replace("\"", "")
883+
//FIXME outputFormat shouldn't really be used here
882884
GeneUtils.applyEscapes(it, GeneUtils.EscapeMode.URI, configuration.outputFormat)
883885
}
884886

core/src/test/kotlin/org/evomaster/core/problem/rest/RestPathTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.evomaster.core.problem.rest
22

33
import io.swagger.v3.oas.models.parameters.Parameter
4+
import org.evomaster.core.output.OutputFormat
45
import org.evomaster.core.problem.rest.builder.RestActionBuilderV3
56
import org.evomaster.core.problem.rest.data.HttpVerb
67
import org.evomaster.core.problem.rest.data.RestPath
@@ -10,13 +11,15 @@ import org.evomaster.core.search.gene.collection.ArrayGene
1011
import org.evomaster.core.search.gene.wrapper.CustomMutationRateGene
1112
import org.evomaster.core.search.gene.numeric.IntegerGene
1213
import org.evomaster.core.search.gene.string.StringGene
14+
import org.evomaster.core.search.gene.utils.GeneUtils
1315
import org.glassfish.jersey.uri.internal.JerseyUriBuilder
1416
import org.junit.jupiter.api.Assertions.*
1517
import org.junit.jupiter.api.Test
1618
import org.junit.jupiter.params.ParameterizedTest
1719
import org.junit.jupiter.params.provider.ValueSource
1820
import java.net.URISyntaxException
1921
import org.junit.jupiter.api.assertThrows
22+
import org.mockserver.configuration.Configuration.configuration
2023

2124
internal class RestPathTest{
2225

@@ -35,6 +38,15 @@ internal class RestPathTest{
3538
assertNotEquals(x, uri)
3639

3740
JerseyUriBuilder.fromUri(uri).build()
41+
42+
// check escape
43+
//TODO update once fixing AbstractRestFitness
44+
val y = "/api/satsendring/kjorsatsendring/Trigget satsendring for fagsakene []"
45+
JerseyUriBuilder.fromUri(y).build()
46+
47+
val e = GeneUtils.applyEscapes(y, GeneUtils.EscapeMode.URI, OutputFormat.JAVA_JUNIT_4)
48+
//FIXME spaces are not escaped
49+
//assertNotEquals(y,e)
3850
}
3951

4052

0 commit comments

Comments
 (0)