1
1
package org.utbot.framework.plugin.api
2
2
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
15
3
import org.utbot.common.FileUtil
16
4
import org.utbot.common.bracket
17
5
import org.utbot.common.runBlockingWithCancellationPredicate
18
6
import org.utbot.common.runIgnoringCancellationException
19
7
import org.utbot.common.trace
20
8
import org.utbot.engine.EngineController
21
9
import org.utbot.engine.Mocker
22
- import org.utbot.engine.canRetrieveBody
23
- import org.utbot.engine.jimpleBody
24
- import org.utbot.engine.pureJavaSignature
25
10
import org.utbot.framework.TestSelectionStrategyType
26
11
import org.utbot.framework.UtSettings
27
12
import org.utbot.framework.UtSettings.checkSolverTimeoutMillis
@@ -36,17 +21,13 @@ import org.utbot.framework.minimization.minimizeTestCase
36
21
import org.utbot.framework.plugin.api.util.UtContext
37
22
import org.utbot.framework.plugin.api.util.id
38
23
import org.utbot.framework.plugin.api.util.intArrayClassId
39
- import org.utbot.framework.plugin.api.util.signature
40
24
import org.utbot.framework.plugin.api.util.utContext
41
25
import org.utbot.framework.plugin.api.util.withUtContext
42
- import org.utbot.framework.util.graph
43
26
import org.utbot.framework.util.jimpleBody
44
27
import org.utbot.framework.util.runSoot
45
28
import org.utbot.framework.util.toModel
46
29
import org.utbot.instrumentation.ConcreteExecutor
47
30
import org.utbot.instrumentation.warmup.Warmup
48
- import soot.Scene
49
- import soot.toolkits.graph.ExceptionalUnitGraph
50
31
import java.io.File
51
32
import java.nio.file.Path
52
33
import java.util.*
@@ -66,9 +47,6 @@ import kotlinx.coroutines.runBlocking
66
47
import kotlinx.coroutines.yield
67
48
import mu.KotlinLogging
68
49
import org.utbot.engine.UtBotSymbolicEngine
69
- import soot.Scene
70
- import soot.jimple.JimpleBody
71
- import soot.toolkits.graph.ExceptionalUnitGraph
72
50
73
51
object UtBotTestCaseGenerator {
74
52
@@ -382,31 +360,6 @@ object UtBotTestCaseGenerator {
382
360
} else {
383
361
minimizeTestCase(executions) { it.result::class .java }
384
362
}
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()
400
363
}
401
364
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
- }
412
365
0 commit comments