11package org.utbot.framework.plugin.api
22
3- import kotlinx.coroutines.CoroutineScope
4- import kotlinx.coroutines.GlobalScope
5- import kotlinx.coroutines.cancel
6- import kotlinx.coroutines.flow.Flow
7- import kotlinx.coroutines.flow.collect
8- import kotlinx.coroutines.flow.flattenConcat
9- import kotlinx.coroutines.flow.flowOf
10- import kotlinx.coroutines.isActive
11- import kotlinx.coroutines.launch
12- import kotlinx.coroutines.runBlocking
13- import kotlinx.coroutines.yield
14- import mu.KotlinLogging
153import org.utbot.common.FileUtil
164import org.utbot.common.bracket
175import org.utbot.common.runBlockingWithCancellationPredicate
186import org.utbot.common.runIgnoringCancellationException
197import org.utbot.common.trace
208import org.utbot.engine.EngineController
219import org.utbot.engine.Mocker
22- import org.utbot.engine.canRetrieveBody
23- import org.utbot.engine.jimpleBody
24- import org.utbot.engine.pureJavaSignature
2510import org.utbot.framework.TestSelectionStrategyType
2611import org.utbot.framework.UtSettings
2712import org.utbot.framework.UtSettings.checkSolverTimeoutMillis
@@ -36,17 +21,13 @@ import org.utbot.framework.minimization.minimizeTestCase
3621import org.utbot.framework.plugin.api.util.UtContext
3722import org.utbot.framework.plugin.api.util.id
3823import org.utbot.framework.plugin.api.util.intArrayClassId
39- import org.utbot.framework.plugin.api.util.signature
4024import org.utbot.framework.plugin.api.util.utContext
4125import org.utbot.framework.plugin.api.util.withUtContext
42- import org.utbot.framework.util.graph
4326import org.utbot.framework.util.jimpleBody
4427import org.utbot.framework.util.runSoot
4528import org.utbot.framework.util.toModel
4629import org.utbot.instrumentation.ConcreteExecutor
4730import org.utbot.instrumentation.warmup.Warmup
48- import soot.Scene
49- import soot.toolkits.graph.ExceptionalUnitGraph
5031import java.io.File
5132import java.nio.file.Path
5233import java.util.*
@@ -66,9 +47,6 @@ import kotlinx.coroutines.runBlocking
6647import kotlinx.coroutines.yield
6748import mu.KotlinLogging
6849import org.utbot.engine.UtBotSymbolicEngine
69- import soot.Scene
70- import soot.jimple.JimpleBody
71- import soot.toolkits.graph.ExceptionalUnitGraph
7250
7351object UtBotTestCaseGenerator {
7452
@@ -382,31 +360,6 @@ object UtBotTestCaseGenerator {
382360 } else {
383361 minimizeTestCase(executions) { it.result::class .java }
384362 }
385-
386-
387- fun apiToModel (mockStrategyApi : MockStrategyApi ): MockStrategy =
388- when (mockStrategyApi) {
389- MockStrategyApi .NO_MOCKS -> MockStrategy .NO_MOCKS
390- MockStrategyApi .OTHER_PACKAGES -> MockStrategy .OTHER_PACKAGES
391- MockStrategyApi .OTHER_CLASSES -> MockStrategy .OTHER_CLASSES
392- else -> error(" Cannot map API Mock Strategy model to Engine model: $mockStrategyApi " )
393- }
394-
395- }
396-
397- fun graph (method : UtMethod <* >): ExceptionalUnitGraph {
398- val methodBody = jimpleBody(method)
399- return methodBody.graph()
400363}
401364
402- fun jimpleBody (method : UtMethod <* >): JimpleBody {
403- val className = method.clazz.java.name
404- val clazz = Scene .v().classes.singleOrNull { it.name == className }
405- ? : error(" No such $className found in the Scene" )
406- val signature = method.callable.signature
407- val sootMethod = clazz.methods.singleOrNull { it.pureJavaSignature == signature }
408- ? : error(" No such $signature found" )
409-
410- return sootMethod.jimpleBody()
411- }
412365
0 commit comments