Skip to content

Commit a5533ed

Browse files
committed
Rebase onto main
1 parent 65d0b84 commit a5533ed

File tree

9 files changed

+32
-27
lines changed

9 files changed

+32
-27
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/process/generated/EngineProcessModel.Generated.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EngineProcessModel private constructor(
2727
private val _obtainClassId: RdCall<String, ByteArray>,
2828
private val _findMethodsInClassMatchingSelected: RdCall<FindMethodsInClassMatchingSelectedArguments, FindMethodsInClassMatchingSelectedResult>,
2929
private val _findMethodParamNames: RdCall<FindMethodParamNamesArguments, FindMethodParamNamesResult>,
30-
private val _writeSarifReport: RdCall<WriteSarifReportArguments, Unit>,
30+
private val _writeSarifReport: RdCall<WriteSarifReportArguments, String>,
3131
private val _generateTestReport: RdCall<GenerateTestReportArgs, GenerateTestReportResult>
3232
) : RdExtBase() {
3333
//companion
@@ -73,7 +73,7 @@ class EngineProcessModel private constructor(
7373
}
7474

7575

76-
const val serializationHash = 3907671513584285891L
76+
const val serializationHash = -621732450296355904L
7777

7878
}
7979
override val serializersOwner: ISerializersOwner get() = EngineProcessModel
@@ -89,7 +89,7 @@ class EngineProcessModel private constructor(
8989
val obtainClassId: RdCall<String, ByteArray> get() = _obtainClassId
9090
val findMethodsInClassMatchingSelected: RdCall<FindMethodsInClassMatchingSelectedArguments, FindMethodsInClassMatchingSelectedResult> get() = _findMethodsInClassMatchingSelected
9191
val findMethodParamNames: RdCall<FindMethodParamNamesArguments, FindMethodParamNamesResult> get() = _findMethodParamNames
92-
val writeSarifReport: RdCall<WriteSarifReportArguments, Unit> get() = _writeSarifReport
92+
val writeSarifReport: RdCall<WriteSarifReportArguments, String> get() = _writeSarifReport
9393
val generateTestReport: RdCall<GenerateTestReportArgs, GenerateTestReportResult> get() = _generateTestReport
9494
//methods
9595
//initializer
@@ -133,7 +133,7 @@ class EngineProcessModel private constructor(
133133
RdCall<String, ByteArray>(FrameworkMarshallers.String, FrameworkMarshallers.ByteArray),
134134
RdCall<FindMethodsInClassMatchingSelectedArguments, FindMethodsInClassMatchingSelectedResult>(FindMethodsInClassMatchingSelectedArguments, FindMethodsInClassMatchingSelectedResult),
135135
RdCall<FindMethodParamNamesArguments, FindMethodParamNamesResult>(FindMethodParamNamesArguments, FindMethodParamNamesResult),
136-
RdCall<WriteSarifReportArguments, Unit>(WriteSarifReportArguments, FrameworkMarshallers.Void),
136+
RdCall<WriteSarifReportArguments, String>(WriteSarifReportArguments, FrameworkMarshallers.String),
137137
RdCall<GenerateTestReportArgs, GenerateTestReportResult>(GenerateTestReportArgs, GenerateTestReportResult)
138138
)
139139

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/CodeGenerationController.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ import org.utbot.framework.codegen.model.UtilClassKind
5252
import org.utbot.framework.codegen.model.UtilClassKind.Companion.UT_UTILS_CLASS_NAME
5353
import org.utbot.framework.plugin.api.ClassId
5454
import org.utbot.framework.plugin.api.CodegenLanguage
55-
import org.utbot.intellij.plugin.inspection.UTBotInspectionManager
55+
import org.utbot.intellij.plugin.inspection.UnitTestBotInspectionManager
5656
import org.utbot.intellij.plugin.models.GenerateTestsModel
5757
import org.utbot.intellij.plugin.models.packageName
5858
import org.utbot.intellij.plugin.process.EngineProcess
5959
import org.utbot.intellij.plugin.process.RdTestGenerationResult
6060
import org.utbot.intellij.plugin.sarif.SarifReportIdea
61-
import org.utbot.intellij.plugin.sarif.SourceFindingStrategyIdea
6261
import org.utbot.intellij.plugin.ui.*
6362
import org.utbot.intellij.plugin.ui.utils.getOrCreateSarifReportsPath
6463
import org.utbot.intellij.plugin.ui.utils.showErrorDialogLater
@@ -158,7 +157,7 @@ object CodeGenerationController {
158157
if (!sarifHasResults) {
159158
return
160159
}
161-
UTBotInspectionManager
160+
UnitTestBotInspectionManager
162161
.getInstance(project, srcClassPathToSarifReport)
163162
.createNewGlobalContext()
164163
.doInspections(AnalysisScope(project))

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UTBotInspectionContext.kt renamed to utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UnitTestBotInspectionContext.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import java.util.concurrent.ConcurrentHashMap
1111
import java.util.concurrent.ConcurrentMap
1212

1313
/**
14-
* Overrides some methods of [GlobalInspectionContextImpl] to satisfy the logic of [UTBotInspectionTool].
14+
* Overrides some methods of [GlobalInspectionContextImpl] to satisfy the logic of [UnitTestBotInspectionTool].
1515
*/
16-
class UTBotInspectionContext(
16+
class UnitTestBotInspectionContext(
1717
project: Project,
1818
contentManager: NotNullLazyValue<out ContentManager>,
19-
val srcClassPathToSarifReport: MutableMap<Path, Sarif>
19+
private val srcClassPathToSarifReport: MutableMap<Path, Sarif>
2020
) : GlobalInspectionContextImpl(project, contentManager) {
2121

2222
/**
@@ -26,14 +26,14 @@ class UTBotInspectionContext(
2626
ConcurrentHashMap()
2727

2828
private val globalInspectionToolWrapper by lazy {
29-
val utbotInspectionTool = UTBotInspectionTool.getInstance(srcClassPathToSarifReport)
29+
val utbotInspectionTool = UnitTestBotInspectionTool.getInstance(srcClassPathToSarifReport)
3030
GlobalInspectionToolWrapper(utbotInspectionTool).also {
3131
it.initialize(/* context = */ this)
3232
}
3333
}
3434

3535
/**
36-
* Returns [InspectionProfileImpl] with only one inspection tool - [UTBotInspectionTool].
36+
* Returns [InspectionProfileImpl] with only one inspection tool - [UnitTestBotInspectionTool].
3737
*/
3838
override fun getCurrentProfile(): InspectionProfileImpl {
3939
val supplier = InspectionToolsSupplier.Simple(listOf(globalInspectionToolWrapper))
@@ -51,12 +51,12 @@ class UTBotInspectionContext(
5151
}
5252

5353
/**
54-
* Overriding is needed to provide [UTBotInspectionToolPresentation]
54+
* Overriding is needed to provide [UnitTestBotInspectionToolPresentation]
5555
* instead of the standard implementation of the [InspectionToolPresentation].
5656
*/
5757
override fun getPresentation(toolWrapper: InspectionToolWrapper<*, *>): InspectionToolPresentation {
5858
return myPresentationMap.computeIfAbsent(toolWrapper) {
59-
UTBotInspectionToolPresentation(globalInspectionToolWrapper, context = this)
59+
UnitTestBotInspectionToolPresentation(globalInspectionToolWrapper, context = this)
6060
}
6161
}
6262
}

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UTBotInspectionManager.kt renamed to utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UnitTestBotInspectionManager.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import org.utbot.sarif.Sarif
99
import java.nio.file.Path
1010

1111
/**
12-
* Overrides some methods of [InspectionManagerEx] to satisfy the logic of [UTBotInspectionTool].
12+
* Overrides some methods of [InspectionManagerEx] to satisfy the logic of [UnitTestBotInspectionTool].
1313
*/
14-
class UTBotInspectionManager(project: Project) : InspectionManagerEx(project) {
14+
class UnitTestBotInspectionManager(project: Project) : InspectionManagerEx(project) {
1515

1616
private var srcClassPathToSarifReport: MutableMap<Path, Sarif> = mutableMapOf()
1717

1818
companion object {
1919
fun getInstance(project: Project, srcClassPathToSarifReport: MutableMap<Path, Sarif>) =
20-
UTBotInspectionManager(project).also {
20+
UnitTestBotInspectionManager(project).also {
2121
it.srcClassPathToSarifReport = srcClassPathToSarifReport
2222
}
2323
}
@@ -32,8 +32,8 @@ class UTBotInspectionManager(project: Project) : InspectionManagerEx(project) {
3232
}
3333

3434
/**
35-
* Overriding is needed to provide [UTBotInspectionContext] instead of [GlobalInspectionContextImpl].
35+
* Overriding is needed to provide [UnitTestBotInspectionContext] instead of [GlobalInspectionContextImpl].
3636
*/
3737
override fun createNewGlobalContext(): GlobalInspectionContextImpl =
38-
UTBotInspectionContext(project, myContentManager, srcClassPathToSarifReport)
38+
UnitTestBotInspectionContext(project, myContentManager, srcClassPathToSarifReport)
3939
}

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UTBotInspectionTool.kt renamed to utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UnitTestBotInspectionTool.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import java.nio.file.Path
1313
/**
1414
* Global inspection tool that displays detected errors from the SARIF report.
1515
*/
16-
class UTBotInspectionTool : GlobalSimpleInspectionTool() {
16+
class UnitTestBotInspectionTool : GlobalSimpleInspectionTool() {
1717

1818
/**
1919
* Map from the path to the class under test to [Sarif] for it.
@@ -22,7 +22,7 @@ class UTBotInspectionTool : GlobalSimpleInspectionTool() {
2222

2323
companion object {
2424
fun getInstance(srcClassPathToSarifReport: MutableMap<Path, Sarif>) =
25-
UTBotInspectionTool().also {
25+
UnitTestBotInspectionTool().also {
2626
it.srcClassPathToSarifReport = srcClassPathToSarifReport
2727
}
2828
}

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UTBotInspectionToolPresentation.kt renamed to utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection/UnitTestBotInspectionToolPresentation.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import com.intellij.codeInspection.ui.DefaultInspectionToolPresentation
77
/**
88
* Overrides [resolveProblem] to avoid suppressing quick fix buttons.
99
*/
10-
class UTBotInspectionToolPresentation(
10+
class UnitTestBotInspectionToolPresentation(
1111
toolWrapper: InspectionToolWrapper<*, *>,
12-
context: UTBotInspectionContext
12+
context: UnitTestBotInspectionContext
1313
) : DefaultInspectionToolPresentation(toolWrapper, context) {
1414

1515
/**
1616
* This method is called when the user clicks on the quick fix button.
17-
* In the case of [UTBotInspectionTool] we do not want to remove the button after applying the fix.
17+
* In the case of [UnitTestBotInspectionTool] we do not want to remove the button after applying the fix.
1818
*
1919
* See [DefaultInspectionToolPresentation.resolveProblem] for more details.
2020
*/

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.intellij.psi.PsiMethod
77
import com.intellij.psi.impl.file.impl.JavaFileManager
88
import com.intellij.psi.search.GlobalSearchScope
99
import com.intellij.refactoring.util.classMembers.MemberInfo
10+
import com.jetbrains.rd.framework.util.asCompletableFuture
1011
import com.jetbrains.rd.util.Logger
1112
import com.jetbrains.rd.util.lifetime.Lifetime
1213
import com.jetbrains.rd.util.lifetime.throwIfNotAlive
@@ -37,6 +38,7 @@ import org.utbot.rd.ProcessWithRdServer
3738
import org.utbot.rd.loggers.UtRdKLoggerFactory
3839
import org.utbot.rd.rdPortArgument
3940
import org.utbot.rd.startUtProcessWithRdServer
41+
import org.utbot.sarif.Sarif
4042
import org.utbot.sarif.SourceFindingStrategy
4143
import java.io.File
4244
import java.nio.file.Path
@@ -349,7 +351,9 @@ class EngineProcess(parent: Lifetime, val project: Project) {
349351
}
350352
}
351353
}
352-
engineModel().writeSarifReport.start(WriteSarifReportArguments(testSetsId, reportFilePath.pathString, generatedTestsCode))
354+
engineModel().writeSarifReport.startSuspending(
355+
WriteSarifReportArguments(testSetsId, reportFilePath.pathString, generatedTestsCode)
356+
)
353357
}
354358

355359
fun generateTestsReport(model: GenerateTestsModel, eventLogMessage: String?): Triple<String, String?, Boolean> = runBlocking {

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/sarif/SarifReportIdea.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ object SarifReportIdea {
2626
): Sarif {
2727
// building the path to the report file
2828
val classFqn = classId.name
29-
val (sarifReportsPath, sourceFinding) = WriteAction.computeAndWait<Pair<Path, SourceFindingStrategyIdea>, Exception> { model.testModule.getOrCreateSarifReportsPath(model.testSourceRoot) to SourceFindingStrategyIdea(psiClass) }
29+
val (sarifReportsPath, sourceFinding) = WriteAction.computeAndWait<Pair<Path, SourceFindingStrategyIdea>, Exception> {
30+
model.testModule.getOrCreateSarifReportsPath(model.testSourceRoot) to SourceFindingStrategyIdea(psiClass)
31+
}
3032
val reportFilePath = sarifReportsPath.resolve("${classFqnToPath(classFqn)}Report.sarif")
3133

3234
val sarifReportAsJson = proc.writeSarif(reportFilePath, testSetsId, generatedTestsCode, sourceFinding)

utbot-intellij/src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
groupKey="group.names.probable.bugs"
9797
enabledByDefault="true"
9898
level="ERROR"
99-
implementationClass="org.utbot.intellij.plugin.inspection.UTBotInspectionTool"/>
99+
implementationClass="org.utbot.intellij.plugin.inspection.UnitTestBotInspectionTool"/>
100100
</extensions>
101101

102102
</idea-plugin>

0 commit comments

Comments
 (0)