diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/CodeGenerator.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/CodeGenerator.kt index f11ddd6d65..1ecf3d8818 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/CodeGenerator.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/CodeGenerator.kt @@ -4,6 +4,8 @@ import mu.KotlinLogging import org.utbot.framework.codegen.domain.ForceStaticMocking import org.utbot.framework.codegen.domain.HangingTestsTimeout import org.utbot.framework.codegen.domain.ParametrizedTestSource +import org.utbot.framework.codegen.domain.ProjectType +import org.utbot.framework.codegen.domain.ProjectType.* import org.utbot.framework.codegen.domain.RuntimeExceptionTestsBehaviour import org.utbot.framework.codegen.domain.StaticsMocking import org.utbot.framework.codegen.domain.TestFramework @@ -28,6 +30,8 @@ import java.time.format.DateTimeFormatter open class CodeGenerator( val classUnderTest: ClassId, + //TODO: support setting `projectType` in Sarif plugins, UtBotJava api, etc. + val projectType: ProjectType = PureJvm, paramNames: MutableMap> = mutableMapOf(), generateUtilClassFile: Boolean = false, testFramework: TestFramework = TestFramework.defaultItem, @@ -48,6 +52,7 @@ open class CodeGenerator( open var context: CgContext = CgContext( classUnderTest = classUnderTest, + projectType = projectType, generateUtilClassFile = generateUtilClassFile, paramNames = paramNames, testFramework = testFramework, @@ -76,10 +81,11 @@ open class CodeGenerator( val cgTestSets = testSets.map { CgMethodTestSet(it) }.toList() return withCustomContext(testClassCustomName) { context.withTestClassFileScope { - if (context.isSpringClass) { - generateForSpringClass(cgTestSets) - } else { - generateForSimpleClass(cgTestSets) + when (context.projectType) { + PureJvm, + Python, + JavaScript -> generateForSimpleClass(cgTestSets) + Spring -> generateForSpringClass(cgTestSets) } } } diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt index 0ca7e3ff75..79403dbdda 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt @@ -714,14 +714,24 @@ enum class ParametrizedTestSource( enum class ProjectType { /** - * Standard JVM application without DI frameworks. + * Standard JVM project without DI frameworks */ - PURE_JVM, + PureJvm, /** - * Spring or Spring Boot application. + * Spring or Spring Boot project */ - SPRING_APPLICATION, + Spring, + + /** + * Python project + */ + Python, + + /** + * JavaScript project + */ + JavaScript, } enum class TypeReplacementApproach { diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt index 7a7ebc5309..8245fc2119 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt @@ -22,6 +22,7 @@ import kotlinx.collections.immutable.PersistentSet import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.persistentSetOf +import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.models.CgMethodTestSet import org.utbot.framework.codegen.domain.builtin.TestClassUtilMethodProvider import org.utbot.framework.codegen.domain.builtin.UtilClassFileMethodProvider @@ -66,8 +67,8 @@ interface CgContextOwner { // current class under test val classUnderTest: ClassId - // If test class is configured with Spring, we should do some extra analysis - val isSpringClass: Boolean + // If project under test is configured with Spring, we should do some extra analysis + val projectType: ProjectType // test class currently being generated (if series of nested classes is generated, it is the outermost one) val outerMostTestClass: ClassId @@ -434,7 +435,7 @@ interface CgContextOwner { */ data class CgContext( override val classUnderTest: ClassId, - override val isSpringClass: Boolean = false, + override val projectType: ProjectType, val generateUtilClassFile: Boolean = false, override var currentExecutable: ExecutableId? = null, override val collectedExceptions: MutableSet = mutableSetOf(), diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt index 47dbf40cca..f0ac645d73 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt @@ -12,6 +12,7 @@ import org.utbot.framework.codegen.domain.HangingTestsTimeout import org.utbot.framework.codegen.domain.MockitoStaticMocking import org.utbot.framework.codegen.domain.NoStaticMocking import org.utbot.framework.codegen.domain.ParametrizedTestSource +import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.RuntimeExceptionTestsBehaviour import org.utbot.framework.codegen.domain.testFrameworkByName import org.utbot.framework.codegen.reports.TestsGenerationReport @@ -135,6 +136,7 @@ private fun EngineProcessModel.setup(kryoHelper: KryoHelper, watchdog: IdleWatch val testSetsId: Long = params.testSetsId val codeGenerator = CodeGenerator( classUnderTest = classId, + projectType = ProjectType.valueOf(params.projectType), generateUtilClassFile = params.generateUtilClassFile, paramNames = kryoHelper.readObject(params.paramNames), testFramework = testFramework, diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/EngineProcessModel.Generated.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/EngineProcessModel.Generated.kt index 420bb476f8..6c6579a42b 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/EngineProcessModel.Generated.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/EngineProcessModel.Generated.kt @@ -72,7 +72,7 @@ class EngineProcessModel private constructor( } - const val serializationHash = -120710112541549600L + const val serializationHash = -2087034443345538396L } override val serializersOwner: ISerializersOwner get() = EngineProcessModel @@ -173,7 +173,7 @@ val IProtocol.engineProcessModel get() = getOrCreateExtension(EngineProcessModel /** - * #### Generated from [EngineProcessModel.kt:98] + * #### Generated from [EngineProcessModel.kt:99] */ data class FindMethodParamNamesArguments ( val classId: ByteArray, @@ -236,7 +236,7 @@ data class FindMethodParamNamesArguments ( /** - * #### Generated from [EngineProcessModel.kt:102] + * #### Generated from [EngineProcessModel.kt:103] */ data class FindMethodParamNamesResult ( val paramNames: ByteArray @@ -293,7 +293,7 @@ data class FindMethodParamNamesResult ( /** - * #### Generated from [EngineProcessModel.kt:91] + * #### Generated from [EngineProcessModel.kt:92] */ data class FindMethodsInClassMatchingSelectedArguments ( val classId: ByteArray, @@ -356,7 +356,7 @@ data class FindMethodsInClassMatchingSelectedArguments ( /** - * #### Generated from [EngineProcessModel.kt:95] + * #### Generated from [EngineProcessModel.kt:96] */ data class FindMethodsInClassMatchingSelectedResult ( val executableIds: ByteArray @@ -581,7 +581,7 @@ data class GenerateResult ( /** - * #### Generated from [EngineProcessModel.kt:110] + * #### Generated from [EngineProcessModel.kt:111] */ data class GenerateTestReportArgs ( val eventLogMessage: String?, @@ -674,7 +674,7 @@ data class GenerateTestReportArgs ( /** - * #### Generated from [EngineProcessModel.kt:119] + * #### Generated from [EngineProcessModel.kt:120] */ data class GenerateTestReportResult ( val notifyMessage: String, @@ -806,7 +806,7 @@ data class JdkInfo ( /** - * #### Generated from [EngineProcessModel.kt:86] + * #### Generated from [EngineProcessModel.kt:87] */ data class MethodDescription ( val name: String, @@ -880,6 +880,7 @@ data class MethodDescription ( data class RenderParams ( val testSetsId: Long, val classUnderTest: ByteArray, + val projectType: String, val paramNames: ByteArray, val generateUtilClassFile: Boolean, val testFramework: String, @@ -903,6 +904,7 @@ data class RenderParams ( override fun read(ctx: SerializationCtx, buffer: AbstractBuffer): RenderParams { val testSetsId = buffer.readLong() val classUnderTest = buffer.readByteArray() + val projectType = buffer.readString() val paramNames = buffer.readByteArray() val generateUtilClassFile = buffer.readBool() val testFramework = buffer.readString() @@ -916,12 +918,13 @@ data class RenderParams ( val hangingTestsTimeout = buffer.readLong() val enableTestsTimeout = buffer.readBool() val testClassPackageName = buffer.readString() - return RenderParams(testSetsId, classUnderTest, paramNames, generateUtilClassFile, testFramework, mockFramework, codegenLanguage, parameterizedTestSource, staticsMocking, forceStaticMocking, generateWarningsForStaticMocking, runtimeExceptionTestsBehaviour, hangingTestsTimeout, enableTestsTimeout, testClassPackageName) + return RenderParams(testSetsId, classUnderTest, projectType, paramNames, generateUtilClassFile, testFramework, mockFramework, codegenLanguage, parameterizedTestSource, staticsMocking, forceStaticMocking, generateWarningsForStaticMocking, runtimeExceptionTestsBehaviour, hangingTestsTimeout, enableTestsTimeout, testClassPackageName) } override fun write(ctx: SerializationCtx, buffer: AbstractBuffer, value: RenderParams) { buffer.writeLong(value.testSetsId) buffer.writeByteArray(value.classUnderTest) + buffer.writeString(value.projectType) buffer.writeByteArray(value.paramNames) buffer.writeBool(value.generateUtilClassFile) buffer.writeString(value.testFramework) @@ -952,6 +955,7 @@ data class RenderParams ( if (testSetsId != other.testSetsId) return false if (!(classUnderTest contentEquals other.classUnderTest)) return false + if (projectType != other.projectType) return false if (!(paramNames contentEquals other.paramNames)) return false if (generateUtilClassFile != other.generateUtilClassFile) return false if (testFramework != other.testFramework) return false @@ -973,6 +977,7 @@ data class RenderParams ( var __r = 0 __r = __r*31 + testSetsId.hashCode() __r = __r*31 + classUnderTest.contentHashCode() + __r = __r*31 + projectType.hashCode() __r = __r*31 + paramNames.contentHashCode() __r = __r*31 + generateUtilClassFile.hashCode() __r = __r*31 + testFramework.hashCode() @@ -994,6 +999,7 @@ data class RenderParams ( printer.indent { print("testSetsId = "); testSetsId.print(printer); println() print("classUnderTest = "); classUnderTest.print(printer); println() + print("projectType = "); projectType.print(printer); println() print("paramNames = "); paramNames.print(printer); println() print("generateUtilClassFile = "); generateUtilClassFile.print(printer); println() print("testFramework = "); testFramework.print(printer); println() @@ -1016,7 +1022,7 @@ data class RenderParams ( /** - * #### Generated from [EngineProcessModel.kt:79] + * #### Generated from [EngineProcessModel.kt:80] */ data class RenderResult ( val generatedCode: String, @@ -1079,7 +1085,7 @@ data class RenderResult ( /** - * #### Generated from [EngineProcessModel.kt:83] + * #### Generated from [EngineProcessModel.kt:84] */ data class SetupContextParams ( val classpathForUrlsClassloader: List @@ -1217,7 +1223,7 @@ data class TestGeneratorParams ( /** - * #### Generated from [EngineProcessModel.kt:105] + * #### Generated from [EngineProcessModel.kt:106] */ data class WriteSarifReportArguments ( val testSetsId: Long, diff --git a/utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/PythonDialogWindow.kt b/utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/PythonDialogWindow.kt index 375bc3fa86..d8d417880c 100644 --- a/utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/PythonDialogWindow.kt +++ b/utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/PythonDialogWindow.kt @@ -15,6 +15,7 @@ import com.jetbrains.python.refactoring.classes.PyMemberInfoStorage import com.jetbrains.python.refactoring.classes.membersManager.PyMemberInfo import com.jetbrains.python.refactoring.classes.ui.PyMemberSelectionTable import org.utbot.framework.UtSettings +import org.utbot.framework.codegen.domain.ProjectType import org.utbot.intellij.plugin.settings.Settings import java.awt.BorderLayout import java.util.concurrent.TimeUnit @@ -171,6 +172,7 @@ class PythonDialogWindow(val model: PythonTestsModel) : DialogWrapper(model.proj model.testFramework = testFrameworks.item model.timeout = TimeUnit.SECONDS.toMillis(timeoutSpinnerForTotalTimeout.number.toLong()) model.testSourceRootPath = testSourceFolderField.text + model.projectType = ProjectType.Python val settings = model.project.service() with(settings) { diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt index 089c104f22..e58d4216da 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt @@ -8,7 +8,6 @@ import com.intellij.ide.fileTemplates.FileTemplateUtil import com.intellij.ide.fileTemplates.JavaTemplateUtil import com.intellij.ide.highlighter.JavaFileType import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.readAction import com.intellij.openapi.application.runReadAction import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction @@ -686,6 +685,7 @@ object CodeGenerationController { proc.render( testSetsId, classUnderTest, + model.projectType, paramNames.toMutableMap(), generateUtilClassFile = true, model.testFramework, 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 e5f3539596..6840bc3a11 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 @@ -25,6 +25,7 @@ import org.utbot.framework.CancellationStrategyType.CANCEL_EVERYTHING import org.utbot.framework.CancellationStrategyType.NONE import org.utbot.framework.CancellationStrategyType.SAVE_PROCESSED_RESULTS import org.utbot.framework.UtSettings +import org.utbot.framework.codegen.domain.ProjectType.* import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.TypeReplacementApproach import org.utbot.framework.plugin.api.ClassId @@ -177,8 +178,10 @@ object UtTestsDialogProcessor { val staticMockingConfigured = model.staticsMocking.isConfigured val applicationContext = when (model.projectType) { - ProjectType.PURE_JVM -> ApplicationContext(mockFrameworkInstalled, staticMockingConfigured) - ProjectType.SPRING_APPLICATION -> { + PureJvm, + Python, + JavaScript -> ApplicationContext(mockFrameworkInstalled, staticMockingConfigured) + Spring -> { val shouldUseImplementors = when (model.typeReplacementApproach) { TypeReplacementApproach.DO_NOT_REPLACE -> false TypeReplacementApproach.REPLACE_IF_POSSIBLE -> true diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/models/GenerateTestsModel.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/models/GenerateTestsModel.kt index 0f3e7bc59e..ca30e87370 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/models/GenerateTestsModel.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/models/GenerateTestsModel.kt @@ -18,7 +18,6 @@ import com.intellij.refactoring.util.classMembers.MemberInfo import org.jetbrains.kotlin.psi.KtFile import org.utbot.framework.SummariesGenerationType import org.utbot.framework.UtSettings -import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.TypeReplacementApproach import org.utbot.framework.plugin.api.JavaDocCommentStyle import org.utbot.framework.util.ConflictTriggers @@ -43,8 +42,6 @@ class GenerateTestsModel( override var sourceRootHistory = project.service().sourceRootHistory override var codegenLanguage = project.service().codegenLanguage - lateinit var projectType: ProjectType - lateinit var testFramework: TestFramework lateinit var mockStrategy: MockStrategyApi lateinit var mockFramework: MockFramework diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt index 49416cce9e..6ce0c11c32 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt @@ -278,6 +278,7 @@ class EngineProcess private constructor(val project: Project, private val classN fun render( testSetsId: Long, classUnderTest: ClassId, + projectType: ProjectType, paramNames: MutableMap>, generateUtilClassFile: Boolean, testFramework: TestFramework, @@ -296,6 +297,7 @@ class EngineProcess private constructor(val project: Project, private val classN val params = RenderParams( testSetsId, kryoHelper.writeObject(classUnderTest), + projectType.toString(), kryoHelper.writeObject(paramNames), generateUtilClassFile, testFramework.id.lowercase(), diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt index 84bf37f6de..72ef532b62 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/ui/GenerateTestsDialogWindow.kt @@ -247,9 +247,8 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m DependencyInjectionFramework.allItems.forEach { it.isInstalled = findDependencyInjectionLibrary(model.project, model.testModule, it) != null } - model.projectType = - if (SpringBeans.isInstalled) ProjectType.SPRING_APPLICATION - else ProjectType.PURE_JVM + model.projectType = if (SpringBeans.isInstalled) ProjectType.Spring else ProjectType.PureJvm + StaticsMocking.allItems.forEach { it.isConfigured = staticsMockingConfigured() } @@ -289,7 +288,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m null ) } - if (model.projectType == ProjectType.SPRING_APPLICATION) { + if (model.projectType == ProjectType.Spring) { row("Spring configuration:") { makePanelWithHelpTooltip( springConfig, @@ -1041,7 +1040,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m val mockStrategyIsSupported = mockStrategies.item == MockStrategyApi.NO_MOCKS // We do not support PUT in Spring projects - val isSupportedProjectType = model.projectType == ProjectType.PURE_JVM + val isSupportedProjectType = model.projectType == ProjectType.PureJvm parametrizedTestSources.isEnabled = isSupportedProjectType && languageIsSupported && frameworkIsSupported && mockStrategyIsSupported @@ -1077,7 +1076,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m private fun updateSpringConfigurationEnabled() { // We check for > 1 because there is already extra-dummy NO_SPRING_CONFIGURATION_OPTION option - springConfig.isEnabled = model.projectType == ProjectType.SPRING_APPLICATION + springConfig.isEnabled = model.projectType == ProjectType.Spring && modelSpringConfigs.size > 1 if (!springConfig.isEnabled) { diff --git a/utbot-js/src/main/kotlin/codegen/JsCodeGenerator.kt b/utbot-js/src/main/kotlin/codegen/JsCodeGenerator.kt index ae67e0f929..eda076d581 100644 --- a/utbot-js/src/main/kotlin/codegen/JsCodeGenerator.kt +++ b/utbot-js/src/main/kotlin/codegen/JsCodeGenerator.kt @@ -33,6 +33,7 @@ class JsCodeGenerator( ) { private var context: CgContext = CgContext( classUnderTest = classUnderTest, + projectType = ProjectType.JavaScript, paramNames = paramNames, testFramework = testFramework, mockFramework = MockFramework.MOCKITO, diff --git a/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/PythonCodeGenerator.kt b/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/PythonCodeGenerator.kt index 74f52a6795..519234c3fb 100644 --- a/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/PythonCodeGenerator.kt +++ b/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/PythonCodeGenerator.kt @@ -5,6 +5,7 @@ import org.utbot.framework.codegen.CodeGeneratorResult import org.utbot.framework.codegen.domain.ForceStaticMocking import org.utbot.framework.codegen.domain.HangingTestsTimeout import org.utbot.framework.codegen.domain.ParametrizedTestSource +import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.RuntimeExceptionTestsBehaviour import org.utbot.framework.codegen.domain.StaticsMocking import org.utbot.framework.codegen.domain.TestFramework @@ -42,7 +43,6 @@ import org.utbot.python.newtyping.pythonAnyType import org.utbot.python.newtyping.pythonModules import org.utbot.python.newtyping.pythonTypeRepresentation import org.utbot.python.framework.codegen.toPythonRawString -import org.utbot.python.newtyping.pythonDescription import org.utbot.python.newtyping.pythonName class PythonCodeGenerator( @@ -60,6 +60,7 @@ class PythonCodeGenerator( testClassPackageName: String = classUnderTest.packageName ) : CodeGenerator( classUnderTest = classUnderTest, + projectType = ProjectType.Python, paramNames = paramNames, generateUtilClassFile = true, testFramework = testFramework, diff --git a/utbot-rd/src/main/rdgen/org/utbot/rd/models/EngineProcessModel.kt b/utbot-rd/src/main/rdgen/org/utbot/rd/models/EngineProcessModel.kt index be656c25d1..bbfe08a25a 100644 --- a/utbot-rd/src/main/rdgen/org/utbot/rd/models/EngineProcessModel.kt +++ b/utbot-rd/src/main/rdgen/org/utbot/rd/models/EngineProcessModel.kt @@ -62,6 +62,7 @@ object EngineProcessModel : Ext(EngineProcessRoot) { val renderParams = structdef { field("testSetsId", PredefinedType.long) field("classUnderTest", array(PredefinedType.byte)) + field("projectType", PredefinedType.string) field("paramNames", array(PredefinedType.byte)) field("generateUtilClassFile", PredefinedType.bool) field("testFramework", PredefinedType.string) diff --git a/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/models/BaseTestModel.kt b/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/models/BaseTestModel.kt index 96591426fd..2f24a10cc5 100644 --- a/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/models/BaseTestModel.kt +++ b/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/models/BaseTestModel.kt @@ -11,12 +11,11 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.searches.AnnotatedElementsSearch -import com.intellij.util.containers.mapSmart import org.jetbrains.kotlin.idea.core.getPackage -import org.jetbrains.kotlin.idea.refactoring.memberInfo.qualifiedClassNameForRendering import org.jetbrains.kotlin.idea.util.projectStructure.allModules import org.jetbrains.kotlin.idea.util.rootManager import org.jetbrains.kotlin.idea.util.sourceRoot +import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.intellij.plugin.ui.utils.ITestSourceRoot import org.utbot.intellij.plugin.ui.utils.getSortedTestRoots @@ -40,6 +39,7 @@ open class BaseTestsModel( var testPackageName: String? = null open var sourceRootHistory : MutableList = mutableListOf() open lateinit var codegenLanguage: CodegenLanguage + open lateinit var projectType: ProjectType fun setSourceRootAndFindTestModule(newTestSourceRoot: VirtualFile?) { requireNotNull(newTestSourceRoot)