-
Notifications
You must be signed in to change notification settings - Fork 86
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' of https://github.com/EMResearch/EvoMaster into…
… wrong-summary
- Loading branch information
Showing
26 changed files
with
1,384 additions
and
80 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
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
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
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
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
48 changes: 48 additions & 0 deletions
48
core/src/main/kotlin/org/evomaster/core/problem/rest/EndpointFilter.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,48 @@ | ||
package org.evomaster.core.problem.rest | ||
|
||
import io.swagger.v3.oas.models.OpenAPI | ||
import org.evomaster.client.java.controller.api.dto.SutInfoDto | ||
import org.evomaster.core.EMConfig | ||
|
||
object EndpointFilter { | ||
|
||
fun getEndPointsToSkip(config: EMConfig, swagger: OpenAPI):List<String> { | ||
if(config.endpointFocus.isNullOrBlank() | ||
&& config.endpointPrefix.isNullOrBlank()){ | ||
return listOf() | ||
} | ||
|
||
val all = swagger.paths.map{it.key} | ||
|
||
val selection = if(config.endpointFocus != null) { | ||
all.filter { it != config.endpointFocus } | ||
} else if(config.endpointPrefix != null){ | ||
all.filter { ! it.startsWith(config.endpointPrefix!!) } | ||
} else { | ||
//should never happens | ||
throw IllegalStateException("Invalid endpoint to skip configuration") | ||
} | ||
|
||
return selection | ||
} | ||
|
||
|
||
|
||
fun getEndpointsToSkip(config: EMConfig, swagger: OpenAPI, infoDto: SutInfoDto) | ||
: List<String>{ | ||
|
||
/* | ||
If we are debugging, and focusing on a single endpoint, we skip | ||
everything but it. | ||
Otherwise, we just look at what configured in the SUT EM Driver. | ||
*/ | ||
|
||
val endpointsToSkip = getEndPointsToSkip(config, swagger) | ||
if(endpointsToSkip.isNotEmpty()){ | ||
return endpointsToSkip | ||
} | ||
|
||
//this has less priority | ||
return infoDto.restProblem?.endpointsToSkip ?: listOf() | ||
} | ||
} |
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
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
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
Oops, something went wrong.