From c27a5d3164e5bb7762b95c0bc98664c3466f762f Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 22 Aug 2023 20:09:48 +0300 Subject: [PATCH] Read a couple of classes takes up to minutes each time #2516 --- .../intellij/plugin/generator/UtTestsDialogProcessor.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt index ffd59fe240..5224b33d43 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt @@ -82,7 +82,8 @@ object UtTestsDialogProcessor { private val logger = KotlinLogging.logger {} enum class ProgressRange(val from : Double, val to: Double) { - SOLVING(from = 0.0, to = 0.9), + INITIALIZATION(from = 0.01, to = 0.1), + SOLVING(from = 0.1, to = 0.9), CODEGEN(from = 0.9, to = 0.95), SARIF(from = 0.95, to = 1.0) } @@ -218,7 +219,7 @@ object UtTestsDialogProcessor { val secondsTimeout = TimeUnit.MILLISECONDS.toSeconds(model.timeout) indicator.isIndeterminate = false - updateIndicator(indicator, ProgressRange.SOLVING, "Generate tests: read classes", 0.0) + updateIndicator(indicator, ProgressRange.INITIALIZATION, "Generate tests: starting engine", 0.0) // TODO sometimes preClasspathCollectionPromises get stuck, even though all // needed dependencies get installed, we need to figure out why that happens @@ -259,6 +260,7 @@ object UtTestsDialogProcessor { val staticMockingConfigured = model.staticsMocking.isConfigured val process = EngineProcess.createBlocking(project, classNameToPath) + updateIndicator(indicator, ProgressRange.INITIALIZATION, fraction = 0.2) process.terminateOnException { _ -> val classpathForClassLoader = buildDirs + classpathList @@ -291,6 +293,7 @@ object UtTestsDialogProcessor { } else -> simpleApplicationContext } + updateIndicator(indicator, ProgressRange.INITIALIZATION, fraction = 0.25) process.createTestGenerator( buildDirs, classpath, @@ -302,6 +305,7 @@ object UtTestsDialogProcessor { indicator.isCanceled }) } + updateIndicator(indicator, ProgressRange.INITIALIZATION, fraction = 1.0) for (srcClass in model.srcClasses) { if (indicator.isCanceled) {