Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
629a053
initial attempt at showing multiple diff patches, need to sync chat w…
ntarakad-aws Nov 3, 2024
6ef2c1a
adding support for different json format
ntarakad-aws Nov 6, 2024
853b40c
adding new UI messaging for patch descriptions and removing redundant…
ntarakad-aws Nov 14, 2024
0429617
added in forms for one or multiple diffs and made manifest changes ac…
ntarakad-aws Nov 15, 2024
5f7c508
removing old multiple patches description
ntarakad-aws Nov 15, 2024
80e5b8f
fixing patch descriptions message
ntarakad-aws Nov 16, 2024
9b6c1d4
fixed issue with undefined in changes applied message and addressing …
ntarakad-aws Nov 17, 2024
61b088b
updated messaging for one or multiple diffs when job success/partial …
ntarakad-aws Nov 18, 2024
f89c49f
fixing one diff and off by one error for multiple diffs and addressin…
ntarakad-aws Nov 18, 2024
7c961ba
added unit tests and fixing off by one logic and detekt errors
ntarakad-aws Nov 18, 2024
89a8bb5
adding test zip
ntarakad-aws Nov 18, 2024
a667cc4
removing sample diff zip
ntarakad-aws Nov 18, 2024
1a1fdb8
adding sample diff zip
ntarakad-aws Nov 18, 2024
77fb5b9
adding simple back
ntarakad-aws Nov 18, 2024
f5bef5e
Merge branch 'main' into selective-transform
ntarakad-aws Nov 18, 2024
f2ff3d4
fixing detekt and adding patch applied notification and updating unit…
ntarakad-aws Nov 19, 2024
b07c148
addressing comments on PR, detekt issues, and adding feature flag
ntarakad-aws Nov 19, 2024
14992ff
adding feature flag and telemetry
ntarakad-aws Nov 20, 2024
6fb6f3f
fixing telemetry and readValue
ntarakad-aws Nov 20, 2024
98c9eab
fixing failed test and lint
ntarakad-aws Nov 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import com.intellij.openapi.vcs.changes.patch.ApplyPatchMode
import com.intellij.openapi.vcs.changes.patch.ImportToShelfExecutor
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.time.Instant
import java.util.concurrent.atomic.AtomicBoolean
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import software.amazon.awssdk.services.codewhispererstreaming.model.TransformationDownloadArtifactType
Expand All @@ -30,8 +35,9 @@ import software.aws.toolkits.jetbrains.services.amazonq.CODE_TRANSFORM_TROUBLESH
import software.aws.toolkits.jetbrains.services.amazonq.CODE_TRANSFORM_TROUBLESHOOT_DOC_DOWNLOAD_EXPIRED
import software.aws.toolkits.jetbrains.services.codemodernizer.client.GumbyClient
import software.aws.toolkits.jetbrains.services.codemodernizer.commands.CodeTransformMessageListener
import software.aws.toolkits.jetbrains.services.codemodernizer.constants.getDownloadedArtifactTextFromType
import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildStartNewTransformFollowup
import software.aws.toolkits.jetbrains.services.codemodernizer.constants.createViewDiffButton
import software.aws.toolkits.jetbrains.services.codemodernizer.constants.getDownloadedArtifactTextFromType
import software.aws.toolkits.jetbrains.services.codemodernizer.constants.viewSummaryButton
import software.aws.toolkits.jetbrains.services.codemodernizer.controller.CodeTransformChatHelper
import software.aws.toolkits.jetbrains.services.codemodernizer.messages.CodeTransformChatMessageContent
Expand All @@ -54,12 +60,6 @@ import software.aws.toolkits.jetbrains.utils.notifyStickyWarn
import software.aws.toolkits.resources.message
import software.aws.toolkits.telemetry.CodeTransformArtifactType
import software.aws.toolkits.telemetry.CodeTransformVCSViewerSrcComponents
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.time.Instant
import java.util.concurrent.atomic.AtomicBoolean
import software.aws.toolkits.jetbrains.services.codemodernizer.constants.buildStartNewTransformFollowup

const val DOWNLOAD_PROXY_WILDCARD_ERROR: String = "Dangling meta character '*' near index 0"
const val DOWNLOAD_SSL_HANDSHAKE_ERROR: String = "Unable to execute HTTP request: javax.net.ssl.SSLHandshakeException"
Expand All @@ -78,23 +78,25 @@ val patchDescriptions: Map<String, String> = mapOf(
"Upgrade Deprecated API" to ""
)

class ArtifactHandler(private val project: Project, private val clientAdaptor: GumbyClient,
private val codeTransformChatHelper: CodeTransformChatHelper? = null) {
class ArtifactHandler(
private val project: Project,
private val clientAdaptor: GumbyClient,
private val codeTransformChatHelper: CodeTransformChatHelper? = null,
) {
private val telemetry = CodeTransformTelemetryManager.getInstance(project)
private val downloadedArtifacts = mutableMapOf<JobId, Path>()
private val downloadedSummaries = mutableMapOf<JobId, TransformationSummary>()
private val downloadedBuildLogPath = mutableMapOf<JobId, Path>()
private var isCurrentlyDownloading = AtomicBoolean(false)
private var totalPatchFiles: Int = 0


internal suspend fun displayDiff(job: JobId, source: CodeTransformVCSViewerSrcComponents) {
if (isCurrentlyDownloading.get()) return
when (val result = downloadArtifact(job, TransformationDownloadArtifactType.CLIENT_INSTRUCTIONS)) {
is DownloadArtifactResult.Success -> {
if (result.artifact !is CodeModernizerArtifact) return notifyUnableToApplyPatch("")
totalPatchFiles = result.artifact.patches.size
if (result.artifact.description == null){
if (result.artifact.description == null) {
displayDiffUsingPatch(result.artifact.patches.first(), totalPatchFiles, null, job, source)
} else {
val diffDescription = result.artifact.description[getCurrentPatchIndex()]
Expand Down Expand Up @@ -275,8 +277,13 @@ class ArtifactHandler(private val project: Project, private val clientAdaptor: G
/**
* Opens the built-in patch dialog to display the diff and allowing users to apply the changes locally.
*/
internal suspend fun displayDiffUsingPatch(patchFile: VirtualFile, totalPatchFiles: Int, diffDescription: PatchInfo?, jobId: JobId,
source: CodeTransformVCSViewerSrcComponents) {
internal fun displayDiffUsingPatch(
patchFile: VirtualFile,
totalPatchFiles: Int,
diffDescription: PatchInfo?,
jobId: JobId,
source: CodeTransformVCSViewerSrcComponents,
) {
runInEdt {
val dialog = ApplyPatchDifferentiatedDialog(
project,
Expand All @@ -292,7 +299,8 @@ class ArtifactHandler(private val project: Project, private val clientAdaptor: G
} else {
patchFile.name
},
""),
""
),
null,
null,
null,
Expand All @@ -315,19 +323,26 @@ class ArtifactHandler(private val project: Project, private val clientAdaptor: G
if (getCurrentPatchIndex() < totalPatchFiles) {
val message = "I applied the changes in diff patch ${getCurrentPatchIndex() + 1} of $totalPatchFiles. " +
"${patchDescriptions[diffDescription.name]}"
val notificationMessage = "Amazon Q applied the changes in diff patch ${getCurrentPatchIndex() + 1} of $totalPatchFiles " +
"to your project."
val notificationTitle = "Diff patch ${getCurrentPatchIndex() + 1} of $totalPatchFiles applied"
setCurrentPatchIndex(getCurrentPatchIndex() + 1)
notifyStickyInfo(notificationTitle, notificationMessage, project)
if (getCurrentPatchIndex() == totalPatchFiles) {
codeTransformChatHelper?.updateLastPendingMessage(CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.PendingAnswer,
message = message,
))
codeTransformChatHelper?.updateLastPendingMessage(
CodeTransformChatMessageContent(type = CodeTransformChatMessageType.PendingAnswer, message = message)
)
} else {
codeTransformChatHelper?.updateLastPendingMessage(CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.PendingAnswer,
message = message,
buttons = listOf(createViewDiffButton("View diff ${getCurrentPatchIndex() + 1}/${totalPatchFiles}"),
viewSummaryButton),
))
codeTransformChatHelper?.updateLastPendingMessage(
CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.PendingAnswer,
message = message,
buttons = listOf(
createViewDiffButton("View diff ${getCurrentPatchIndex() + 1}/$totalPatchFiles"),
viewSummaryButton
)
)
)
}
} else {
codeTransformChatHelper?.addNewMessage(buildStartNewTransformFollowup())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import java.util.concurrent.atomic.AtomicBoolean
import javax.net.ssl.SSLHandshakeException

const val MAX_ZIP_SIZE = 2000000000 // 2GB
const val HIL_1P_UPGRADE_CAPABILITY = "HIL_1pDependency_VersionUpgrade"
const val EXPLAINABILITY_V1 = "EXPLAINABILITY_V1"
const val SELECTIVE_TRANSFORMATION_V1 = "SELECTIVE_TRANSFORMATION_V1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@
keepCardAfterClick = true,
)

fun createViewDiffButton(buttonLabel: String): Button {
return Button(id = CodeTransformButtonId.ViewDiff.id, text = buttonLabel, keepCardAfterClick = true)
}
fun createViewDiffButton(buttonLabel: String): Button = Button(
id = CodeTransformButtonId.ViewDiff.id,
text = buttonLabel,
keepCardAfterClick = true
)

val viewSummaryButton = Button(
id = CodeTransformButtonId.ViewSummary.id,
Expand All @@ -114,7 +116,7 @@

private val viewBuildLog = Button(
id = CodeTransformButtonId.ViewBuildLog.id,
text = message("codemodernizer.chat.message.button.view_failure_build_log"),

Check warning on line 119 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
keepCardAfterClick = true,
)

Expand Down Expand Up @@ -382,7 +384,7 @@

fun buildModuleSchemaFormIntroChatContent() = CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.FinalizedAnswer,
message = message("codemodernizer.chat.message.sql_module_schema_prompt"),

Check warning on line 387 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
)

fun buildSQLMetadataValidationSuccessIntroChatContent() = CodeTransformChatMessageContent(
Expand Down Expand Up @@ -416,7 +418,7 @@

fun buildUserStopTransformChatContent() = CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.Prompt,
message = message("codemodernizer.chat.prompt.stop_transform"),

Check warning on line 421 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
)

fun buildTransformStoppingChatContent() = CodeTransformChatMessageContent(
Expand All @@ -441,7 +443,7 @@

fun buildCompileLocalInProgressChatContent() = CodeTransformChatMessageContent(
type = CodeTransformChatMessageType.PendingAnswer,
message = message("codemodernizer.chat.message.local_build_begin"),

Check warning on line 446 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
buttons = listOf(
openMvnBuildButton,
),
Expand Down Expand Up @@ -471,7 +473,7 @@
val resultMessage = when (failureReason) {
is UploadFailureReason.PRESIGNED_URL_EXPIRED -> "${message(
"codemodernizer.chat.message.upload_failed_url_expired"
)}\n\n${message(

Check warning on line 476 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
"codemodernizer.chat.message.validation.error.more_info",
CODE_TRANSFORM_TROUBLESHOOT_DOC_ALLOW_S3_ACCESS
)}"
Expand Down Expand Up @@ -587,7 +589,7 @@
type = CodeTransformChatMessageType.FinalizedAnswer,
message = resultMessage,
buttons = if (result is CodeModernizerJobCompletedResult.JobPartiallySucceeded || result is CodeModernizerJobCompletedResult.JobCompletedSuccessfully) {
listOf(createViewDiffButton(if (totalPatchFiles == 1) "View diff" else "View diff 1/${totalPatchFiles}"), viewSummaryButton)
listOf(createViewDiffButton(if (totalPatchFiles == 1) "View diff" else "View diff 1/$totalPatchFiles"), viewSummaryButton)
} else if (result is CodeModernizerJobCompletedResult.JobFailedInitialBuild && result.hasBuildLog) {
listOf(viewBuildLog)
} else {
Expand Down Expand Up @@ -635,7 +637,7 @@
hilDownloadArtifact: CodeTransformHilDownloadArtifact,
showButton: Boolean = true,
) = CodeTransformChatMessageContent(
message = message("codemodernizer.chat.message.hil.pom_snippet_title") +

Check warning on line 640 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/constants/CodeTransformChatItems.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
"\n\n```xml" +
"\n" +
"<dependencies>\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.intellij.openapi.vfs.VirtualFile
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import software.amazon.awssdk.services.codewhispererstreaming.model.TransformationDownloadArtifactType
import kotlinx.coroutines.withContext
import software.amazon.awssdk.services.codewhispererstreaming.model.TransformationDownloadArtifactType
import software.aws.toolkits.core.utils.debug
import software.aws.toolkits.core.utils.error
import software.aws.toolkits.core.utils.getLogger
Expand All @@ -29,7 +29,6 @@
import software.aws.toolkits.jetbrains.services.codemodernizer.EXPLAINABILITY_V1
import software.aws.toolkits.jetbrains.services.codemodernizer.HilTelemetryMetaData
import software.aws.toolkits.jetbrains.services.codemodernizer.InboundAppMessagesHandler
import software.aws.toolkits.jetbrains.services.codemodernizer.SELECTIVE_TRANSFORMATION_V1
import software.aws.toolkits.jetbrains.services.codemodernizer.client.GumbyClient
import software.aws.toolkits.jetbrains.services.codemodernizer.commands.CodeTransformActionMessage
import software.aws.toolkits.jetbrains.services.codemodernizer.commands.CodeTransformCommand
Expand Down Expand Up @@ -99,6 +98,7 @@
import software.aws.toolkits.jetbrains.services.codemodernizer.model.UploadFailureReason
import software.aws.toolkits.jetbrains.services.codemodernizer.model.ValidationResult
import software.aws.toolkits.jetbrains.services.codemodernizer.panels.managers.CodeModernizerBottomWindowPanelManager
import software.aws.toolkits.jetbrains.services.codemodernizer.SELECTIVE_TRANSFORMATION_V1
import software.aws.toolkits.jetbrains.services.codemodernizer.session.ChatSessionStorage
import software.aws.toolkits.jetbrains.services.codemodernizer.session.Session
import software.aws.toolkits.jetbrains.services.codemodernizer.state.CodeModernizerSessionState
Expand Down Expand Up @@ -792,7 +792,7 @@

val copyDependencyResult = codeModernizerManager.copyDependencyForHil(selectedVersion)
if (copyDependencyResult == MavenCopyCommandsResult.Failure) {
hilTryResumeAfterError(message("codemodernizer.chat.message.hil.error.cannot_upload"))

Check warning on line 795 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/controller/CodeTransformChatController.kt

View workflow job for this annotation

GitHub Actions / qodana

Usage of redundant or deprecated syntax or deprecated symbols

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
return
} else if (copyDependencyResult == MavenCopyCommandsResult.Cancelled) {
hilTryResumeAfterError(message("codemodernizer.chat.message.hil.error.cancel_upload"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
}
}

@OptIn(ExperimentalPathApi::class)

Check notice on line 120 in plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerArtifact.kt

View workflow job for this annotation

GitHub Actions / qodana

Unnecessary '@OptIn' annotation

The opt-in annotation is redundant: no matching experimental API is used
private fun extractPatches(manifest: CodeModernizerManifest, description: List<PatchInfo>?): List<VirtualFile> {
if (description == null) {
return extractSinglePatch(manifest)
Expand Down Expand Up @@ -150,7 +150,6 @@
.toList()
}

@OptIn(ExperimentalPathApi::class)
private fun loadDescription(manifest: CodeModernizerManifest): List<PatchInfo>? {
val patchesDir = tempDir.toPath().resolve(manifest.patchesRoot).toFile()
if (!patchesDir.isDirectory) {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,14 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa
assertFalse(roots.isEmpty() || roots.size > 1)
assert(rootManager.dependencies.isEmpty())
val root = roots[0]
val context = CodeModernizerSessionContext(project, root.children[0], JavaSdkVersion.JDK_1_8, JavaSdkVersion.JDK_11,
listOf(EXPLAINABILITY_V1, SELECTIVE_TRANSFORMATION_V1), MAVEN_BUILD_SKIP_UNIT_TESTS)
val context = CodeModernizerSessionContext(
project,
root.children[0],
JavaSdkVersion.JDK_1_8,
JavaSdkVersion.JDK_11,
listOf(EXPLAINABILITY_V1, SELECTIVE_TRANSFORMATION_V1),
MAVEN_BUILD_SKIP_UNIT_TESTS
)
val mockFile = mock(File::class.java)
val mockStringBuilder = mock(StringBuilder::class.java)
val file = runInEdtAndGet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,13 @@ class CodeWhispererCodeModernizerTest : CodeWhispererCodeModernizerTestBase() {
doReturn(result).whenever(handler).downloadArtifact(any(), eq(TransformationDownloadArtifactType.CLIENT_INSTRUCTIONS), eq(false))
handler.displayDiff(jobId, CodeTransformVCSViewerSrcComponents.Chat)
verify(handler, never()).notifyUnableToApplyPatch(any())
verify(handler, times(1)).displayDiffUsingPatch(testCodeModernizerArtifact.patches[0], testCodeModernizerArtifact.patches.size,
testCodeModernizerArtifact.description?.get(0), jobId, CodeTransformVCSViewerSrcComponents.Chat)
verify(handler, times(1)).displayDiffUsingPatch(
testCodeModernizerArtifact.patches[0],
testCodeModernizerArtifact.patches.size,
testCodeModernizerArtifact.description?.get(0),
jobId,
CodeTransformVCSViewerSrcComponents.Chat
)
}

@Test
Expand All @@ -154,11 +159,18 @@ class CodeWhispererCodeModernizerTest : CodeWhispererCodeModernizerTestBase() {
@Test
fun `CodeModernizerArtifact can process a valid zip file`() {
val artifact = CodeModernizerArtifact.create(exampleZipPath.toAbsolutePath().toString())
assertEquals(1, artifact.patches.size)
assertEquals(validManifest, artifact.manifest)
assertEquals(validMetrics.linesOfCodeChanged, artifact.metrics?.linesOfCodeChanged)
}

@Test
fun `CodeModernizerArtifact can process a valid zip file with multiple diffs`() {
val artifact = CodeModernizerArtifact.create(multipleDiffZipPath.toAbsolutePath().toString())
assertEquals(4, artifact.patches.size)
assertEquals(validManifest, artifact.manifest)
assertEquals(validMetricsMultipleDiffs.linesOfCodeChanged, artifact.metrics?.linesOfCodeChanged)
}

@Test
fun `can unzip a file`() {
val tempDir = createTempDirectory()
Expand All @@ -168,6 +180,15 @@ class CodeWhispererCodeModernizerTest : CodeWhispererCodeModernizerTestBase() {
assert(tempDir.resolve(validZipPatchFilePath).exists())
}

@Test
fun `can unzip a file with multiple diffs`() {
val tempDir = createTempDirectory()
val result = unzipFile(multipleDiffZipPath, tempDir)
assert(result)
assert(tempDir.resolve(validZipManifestPath).exists())
assert(tempDir.resolve(validZipPatchFilePath).exists())
}

@Test
fun `returns False when unable to unzip file`() {
assertFalse(unzipFile(Path("dummy1"), Path("dummy2")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ open class CodeWhispererCodeModernizerTestBase(
internal lateinit var testCodeModernizerArtifact: CodeModernizerArtifact
internal lateinit var testTransformFailureBuildLog: CodeTransformFailureBuildLog
internal val exampleZipPath = "simple.zip".toResourceFile().toPath()
internal val multipleDiffZipPath = "multiple-diff.zip".toResourceFile().toPath()
internal val expectedFilePath = "expectedFile".toResourceFile().toPath()
internal val overwrittenFilePath = "overwrittenFile".toResourceFile().toPath()
internal val testRequestId = "test_aws_request_id"
Expand Down Expand Up @@ -150,6 +151,14 @@ open class CodeWhispererCodeModernizerTestBase(
programmingLanguage = "JAVA",
)

internal val validMetricsMultipleDiffs =
CodeModernizerMetrics(
charactersOfCodeChanged = 83,
linesOfCodeChanged = 3,
linesOfCodeSubmitted = 567,
programmingLanguage = "JAVA",
)

internal val exampleCreateUploadUrlResponse =
CreateUploadUrlResponse.builder()
.uploadUrl("https://smth.com")
Expand Down Expand Up @@ -290,8 +299,14 @@ open class CodeWhispererCodeModernizerTestBase(
val summaryFileMock = Mockito.mock(File::class.java)
val logFileMock = Mockito.mock(File::class.java)
doReturn("dummy/path").whenever(virtualFileMock).path
testSessionContextSpy = spy(CodeModernizerSessionContext(project, virtualFileMock, JavaSdkVersion.JDK_1_8, JavaSdkVersion.JDK_11,
listOf("EXPLAINABILITY_V1", "SELECTIVE_TRANSFORMATION_V1"), "test"))
testSessionContextSpy = spy(CodeModernizerSessionContext(
project,
virtualFileMock,
JavaSdkVersion.JDK_1_8,
JavaSdkVersion.JDK_11,
listOf("EXPLAINABILITY_V1", "SELECTIVE_TRANSFORMATION_V1"),
"test")
)

testSessionSpy = spy(CodeModernizerSession(testSessionContextSpy, 0, 0))
doNothing().whenever(testSessionSpy).deleteUploadArtifact(any())
Expand Down
Loading