Skip to content

Commit

Permalink
Deprecated API removal
Browse files Browse the repository at this point in the history
Test case updates
  • Loading branch information
MalarsriA committed Oct 4, 2024
1 parent 67f6efc commit fe546e9
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 54 deletions.
12 changes: 2 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask


fun properties(key: String) = project.findProperty(key).toString()

Expand Down Expand Up @@ -41,15 +41,6 @@ dependencies {
testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.vintage:junit-vintage-engine:$junitVersion")

/*testCompileOnly("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testCompileOnly("org.junit.jupiter:junit-jupiter-params:$junitVersion")
testCompileOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testCompileOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")*/
intellijPlatform {

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
Expand Down Expand Up @@ -169,6 +160,7 @@ tasks {
events("passed", "skipped", "failed")
}
}

wrapper {
gradleVersion = providers.gradleProperty("gradleVersion").get()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ class AddAnyServiceSSDKModuleAction : DumbAwareAction() {

actionEventDependencies(project, file, e.dataContext, libraries)
val mavenProjectManager = MavenProjectsManager.getInstance(project)
mavenProjectManager.forceUpdateProjects(mavenProjectManager.projects)

mavenProjectManager.waitForPostImportTasksCompletion()
mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles()
}

private fun actionEventDependencies(project: Project, file: VirtualFile, dataContext: DataContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.intellij.ide.fileTemplates.FileTemplate
import com.intellij.ide.fileTemplates.FileTemplateManager
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.LangDataKeys
Expand Down Expand Up @@ -42,10 +43,7 @@ class AddPersistenceSupportAction : DumbAwareAction(){

actionAddPersistenceDependencies(project, file, e.dataContext)
val mavenProjectManager = MavenProjectsManager.getInstance(project)
mavenProjectManager.forceUpdateProjects(mavenProjectManager.projects)

mavenProjectManager.waitForPostImportTasksCompletion()

mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles()
}

if(persistenceDialog.addLiquibaseFile){
Expand Down Expand Up @@ -127,5 +125,9 @@ class AddPersistenceSupportAction : DumbAwareAction(){
}
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}


}
20 changes: 6 additions & 14 deletions src/main/kotlin/com/backbase/bst/actions/DefineEventAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DefineEventAction : DumbAwareAction(){

val pluginId = MavenId("com.backbase.codegen", "jsonschema-events-maven-plugin", "")
if(!MavenTools.findPluginOnBom(project, file, pluginId)) {
addingMavenPlugin(project, file, e)
addingMavenPlugin(project, file)
Notification("Backbase notification group", "Define an Event", "Adding plugin jsonschema-events-maven-plugin on pom.xml",
NotificationType.INFORMATION).notify(project)
}
Expand All @@ -84,25 +84,19 @@ class DefineEventAction : DumbAwareAction(){
file: VirtualFile,
e: AnActionEvent
) {

actionEventDependencies(project, file, e.dataContext)
val mavenProjectManager = MavenProjectsManager.getInstance(project)
mavenProjectManager.forceUpdateProjects(mavenProjectManager.projects)

mavenProjectManager.waitForPostImportTasksCompletion()
mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles()
}

private fun addingMavenPlugin(
project: @Nullable Project,
file: VirtualFile,
e: AnActionEvent
file: VirtualFile
) {

actionEventPlugin(project, file, e.dataContext)
actionEventPlugin(project, file)
val mavenProjectManager = MavenProjectsManager.getInstance(project)
mavenProjectManager.forceUpdateProjects(mavenProjectManager.projects)

mavenProjectManager.waitForPostImportTasksCompletion()
mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles()
}

private fun actionEventDependencies(project: Project, file: VirtualFile, dataContext: DataContext) {
Expand All @@ -116,11 +110,9 @@ class DefineEventAction : DumbAwareAction(){
}
}

private fun actionEventPlugin(project: Project, file: VirtualFile, dataContext: DataContext) {
private fun actionEventPlugin(project: Project, file: VirtualFile) {
val mavenModel = MavenDomUtil
.getMavenDomProjectModel(project, file)


WriteCommandAction.runWriteCommandAction(project) {
createDomPlugin(mavenModel!!.build.plugins, project)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class GenerateClientAction : DumbAwareAction() {
WriteCommandAction.runWriteCommandAction(project) {
createDomPlugin(
MavenDomUtil
.getMavenDomProjectModel(project, projectPomFile)!!.build.plugins, project, dialog
.getMavenDomProjectModel(project, projectPomFile)!!.build.plugins, dialog
)

}
Expand Down Expand Up @@ -101,16 +101,15 @@ class GenerateClientAction : DumbAwareAction() {
}

WriteCommandAction.runWriteCommandAction(project) {
createPluginExecution(plugin!!, project, dialog)
createPluginExecution(plugin!!, dialog)
}
}
val mavenProjectManager = MavenProjectsManager.getInstance(project)
mavenProjectManager.forceUpdateProjects(mavenProjectManager.projects)

mavenProjectManager.waitForPostImportTasksCompletion()
mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles()

if (dialog.addRestClientConfiguration) {
addRestClientConfigClass(selectedModule, project, "restClientConfiguration", dialog)

val gotIt = GotItMessage.createMessage(
BackbaseBundle.message("action.add.define.event.dialog.gotit.title"),
BackbaseBundle.message("action.add.openapi.client.gotit.message")
Expand All @@ -124,19 +123,18 @@ class GenerateClientAction : DumbAwareAction() {

}

private fun createDomPlugin(plugins: MavenDomPlugins?, project: Project, dialog: GenerateClientDialog): MavenDomPlugin {
private fun createDomPlugin(plugins: MavenDomPlugins?, dialog: GenerateClientDialog): MavenDomPlugin {
val plugin = plugins!!.addPlugin()
plugin!!.groupId.stringValue = "com.backbase.oss"
plugin.artifactId.stringValue = "boat-maven-plugin"

createPluginExecution(plugin, project, dialog)
createPluginExecution(plugin, dialog)

return plugin
}

private fun createPluginExecution(
plugin: MavenDomPlugin,
project: Project,
dialog: GenerateClientDialog
): MavenDomPlugin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class GenerateServerApiAction : DumbAwareAction() {
createDomPlugin(
MavenDomUtil
.getMavenDomProjectModel(project, projectPomFile)!!.build.plugins,
project,
dialog,
selectedSpecFile
)
Expand Down Expand Up @@ -103,34 +102,31 @@ class GenerateServerApiAction : DumbAwareAction() {
}

WriteCommandAction.runWriteCommandAction(project) {
createPluginExecution(plugin!!, project, dialog, selectedSpecFile)
createPluginExecution(plugin!!, dialog, selectedSpecFile)
}
}
val mavenProjectManager = MavenProjectsManager.getInstance(project)
mavenProjectManager.forceUpdateProjects(mavenProjectManager.projects)
mavenProjectManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles()

mavenProjectManager.waitForPostImportTasksCompletion()

}

private fun createDomPlugin(
plugins: MavenDomPlugins?,
project: Project,
dialog: GenerateServerApiDialog,
selectedSpecFile: VirtualFile
): MavenDomPlugin {
val plugin = plugins!!.addPlugin()
plugin!!.groupId.stringValue = "com.backbase.oss"
plugin.artifactId.stringValue = "boat-maven-plugin"

createPluginExecution(plugin, project, dialog, selectedSpecFile)
createPluginExecution(plugin, dialog, selectedSpecFile)

return plugin
}

private fun createPluginExecution(
plugin: MavenDomPlugin,
project: Project,
dialog: GenerateServerApiDialog,
selectedSpecFile: VirtualFile
): MavenDomPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.intellij.ide.fileTemplates.FileTemplateUtil
import com.intellij.ide.fileTemplates.actions.CreateFromTemplateActionBase
import com.intellij.ide.util.EditorHelper
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.fileEditor.FileEditorManager
Expand Down Expand Up @@ -95,7 +94,7 @@ class BackbaseMavenModuleBuilder(private val myProjectId: MavenId, private val m
MavenProjectsManager.getInstance(project).forceUpdateAllProjectsOrFindAllAvailablePomFiles()

// execute when current dialog is closed (e.g. Project Structure)
MavenUtil.invokeLater(project, ModalityState.NON_MODAL) {
MavenUtil.invokeLater(project) {
if (!pom.isValid) {
showError(project, RuntimeException("Project is not valid"))
return@invokeLater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.backbase.bst.wizard.extensions

import com.backbase.bst.BackbaseBundle
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.project.Project
Expand Down Expand Up @@ -83,7 +82,7 @@ class BackbaseExtensionProjectBuilder(
MavenProjectsManager.getInstance(project).forceUpdateAllProjectsOrFindAllAvailablePomFiles()

// execute when current dialog is closed (e.g. Project Structure)
MavenUtil.invokeLater(project, ModalityState.NON_MODAL) {
MavenUtil.invokeLater(project) {


}
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/com/backbase/bst/common/MavenToolsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MavenToolsTest : BasePlatformTestCase() {
rootTag.assertArtifact("thisisfun", "com.backbase", "1.0.0")

rootTag.findFirstSubTag("parent")!!
.assertArtifact("service-sdk-starter-core", "com.backbase.buildingblocks", "12.3.0")
.assertArtifact("service-sdk-starter-core", "com.backbase.buildingblocks", "17.0.0")

rootTag.findFirstSubTag("dependencies")!!.findFirstSubTag("dependency")!!
.assertArtifact("test", "com.backbase")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class BackbaseMavenModuleBuilderTest : BasePlatformTestCase() {

fun testCreateProject() {
val myProjectId = MavenId(GROUP_ID,project.name,VERSION)
val ssdkMavenId = MavenId("com.backbase.buildingblocks", "service-sdk-starter-core", "12.3.0")
val ssdkMavenId = MavenId("com.backbase.buildingblocks", "service-sdk-starter-core", "17.0.0")
val builder = BackbaseMavenModuleBuilder(myProjectId, ssdkMavenId)
val root: VirtualFile? = createAndGetContentEntry()

Expand Down Expand Up @@ -54,7 +54,7 @@ internal class BackbaseMavenModuleBuilderTest : BasePlatformTestCase() {
rootTag.assertArtifact(project.name, GROUP_ID, VERSION)

rootTag.findFirstSubTag("parent")!!
.assertArtifact("service-sdk-starter-core", "com.backbase.buildingblocks", "12.3.0")
.assertArtifact("service-sdk-starter-core", "com.backbase.buildingblocks", "17.0.0")

rootTag.findFirstSubTag("dependencies")!!.findFirstSubTag("dependency")!!
.assertArtifact("service-sdk-starter-test", "com.backbase.buildingblocks", null, "test")
Expand Down
2 changes: 1 addition & 1 deletion src/test/testData/addDependencyToPom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>service-sdk-starter-core</artifactId>
<groupId>com.backbase.buildingblocks</groupId>
<version>12.3.0</version>
<version>17.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit fe546e9

Please sign in to comment.