Skip to content

Vassiliy kudryashov/1021 plugin support idea 20222 new #1094

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ kotlin.code.style=official
# IU, IC, PC, PY, WS...
ideType=IC

pythonCommunityPluginVersion=212.5457.59
pythonCommunityPluginVersion=222.4167.37
#Version numbers: https://plugins.jetbrains.com/plugin/631-python/versions
pythonUltimatePluginVersion=212.5457.59
pythonUltimatePluginVersion=222.4167.37

junit5Version=5.8.0-RC1
junit4Version=4.13.2
junit4PlatformVersion=1.9.0
mockitoVersion=3.5.13
z3Version=4.8.9.1
z3JavaApiVersion=4.8.9
sootCommitHash=1f34746
kotlinVersion=1.7.10
sootCommitHash=3adf23c3
kotlinVersion=1.7.20
log4j2Version=2.13.3
coroutinesVersion=1.6.3
collectionsVersion=0.3.4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.utbot.framework.plugin.api

import com.google.protobuf.compiler.PluginProtos
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.cancel
Expand Down Expand Up @@ -124,10 +125,15 @@ open class TestCaseGenerator(
chosenClassesToMockAlways: Set<ClassId> = Mocker.javaDefaultClasses.mapTo(mutableSetOf()) { it.id },
executionTimeEstimator: ExecutionTimeEstimator = ExecutionTimeEstimator(utBotGenerationTimeoutInMillis, 1)
): Flow<UtResult> {
val engine = createSymbolicEngine(controller, method, mockStrategy, chosenClassesToMockAlways, executionTimeEstimator)
engineActions.map { engine.apply(it) }
engineActions.clear()
return defaultTestFlow(engine, executionTimeEstimator.userTimeout)
try {
val engine = createSymbolicEngine(controller, method, mockStrategy, chosenClassesToMockAlways, executionTimeEstimator)
engineActions.map { engine.apply(it) }
engineActions.clear()
return defaultTestFlow(engine, executionTimeEstimator.userTimeout)
} catch (e: Exception) {
logger.error(e) {"Generate async failed"}
throw e
}
}

fun generate(
Expand All @@ -154,29 +160,33 @@ open class TestCaseGenerator(
controller.job = launch(currentUtContext) {
if (!isActive) return@launch

//yield one to
yield()
try {
//yield one to
yield()

val engine: UtBotSymbolicEngine = createSymbolicEngine(
controller,
method,
mockStrategy,
chosenClassesToMockAlways,
executionTimeEstimator
)
val engine: UtBotSymbolicEngine = createSymbolicEngine(
controller,
method,
mockStrategy,
chosenClassesToMockAlways,
executionTimeEstimator
)

engineActions.map { engine.apply(it) }
engineActions.map { engine.apply(it) }

generate(engine)
.catch {
logger.error(it) { "Error in flow" }
}
.collect {
when (it) {
is UtExecution -> method2executions.getValue(method) += it
is UtError -> method2errors.getValue(method).merge(it.description, 1, Int::plus)
generate(engine)
.catch {
logger.error(it) { "Error in flow" }
}
}
.collect {
when (it) {
is UtExecution -> method2executions.getValue(method) += it
is UtError -> method2errors.getValue(method).merge(it.description, 1, Int::plus)
}
}
} catch (e: Exception) {
logger.error(e) {"Error in engine"}
}
}
controller.paused = true
}
Expand Down
6 changes: 3 additions & 3 deletions utbot-intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ intellij {

val jvmPlugins = listOf(
"java",
"org.jetbrains.kotlin:212-1.7.10-release-333-IJ5457.46"
"org.jetbrains.kotlin:222-1.7.20-release-201-IJ4167.29"
)

val pythonCommunityPlugins = listOf(
Expand All @@ -41,7 +41,7 @@ intellij {
}
)

version.set("212.5712.43")
version.set("222.4167.29")
type.set(ideType)
}

Expand All @@ -65,7 +65,7 @@ tasks {

patchPluginXml {
sinceBuild.set("212")
untilBuild.set("221.*")
untilBuild.set("222.*")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.SmartPsiElementPointer
import com.intellij.psi.util.childrenOfType
import mu.KotlinLogging
import org.jetbrains.plugins.groovy.lang.psi.util.childrenOfType
import org.utbot.intellij.plugin.models.GenerateTestsModel
import org.utbot.intellij.plugin.util.IntelliJApiHelper.run

Expand Down