From f97b5b401ec158ec55145fc7211500881bd2cf55 Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Wed, 28 Sep 2022 01:09:15 -0300 Subject: [PATCH 01/12] feature: unit tests Signed-off-by: Matheus Ferreira --- build.gradle.kts | 21 ++- gradle.properties | 6 +- .../intellij/commands/git/GitBranch.kt | 5 +- .../intellij/commands/git/GitConfig.kt | 4 +- .../intellij/services/CreateProjectService.kt | 39 ++-- .../services/GetDocumentationService.kt | 7 +- .../panels/StackSpotGitConfigErrorPanel.kt | 4 +- src/main/kotlin/com/stackspot/model/Stack.kt | 4 +- .../services/CreateProjectServiceTest.kt | 174 +++++++++++++----- src/test/resources/junit-platform.properties | 1 + 10 files changed, 196 insertions(+), 69 deletions(-) create mode 100644 src/test/resources/junit-platform.properties diff --git a/build.gradle.kts b/build.gradle.kts index ce544e9..4c0a1be 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.changelog.date fun properties(key: String) = project.findProperty(key).toString() @@ -27,8 +28,11 @@ repositories { } dependencies { - testImplementation(platform("org.junit:junit-bom:5.9.0")) + testImplementation(platform("org.junit:junit-bom:5.9.1")) testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation("io.mockk:mockk:1.13.1") + testImplementation("io.kotest:kotest-assertions-core:5.4.2") + testImplementation("org.awaitility:awaitility-kotlin:4.2.0") } kotlin { @@ -107,7 +111,7 @@ tasks { test { useJUnitPlatform() testLogging { - events("passed", "skipped", "failed") + events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) } finalizedBy(jacocoTestReport) } @@ -117,5 +121,18 @@ tasks { reports { xml.required.set(true) } + classDirectories.setFrom( + files(classDirectories.files.map { + fileTree(it) { + exclude( + "**/com/stackspot/constants/**", + "**/com/stackspot/exceptions/**", + "**/com/stackspot/intellij/actions/**", + "**/com/stackspot/intellij/messaging/**", + "**/com/stackspot/intellij/ui/**" + ) + } + }) + ) } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 3f4c29b..8a9dcfe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,8 +25,10 @@ platformType = IC platformVersion = 2022.1 platformPlugins = org.jetbrains.plugins.terminal, com.intellij.gradle, org.jetbrains.idea.maven -gradleVersion = 7.5.1 +gradleVersion = 7.4 # Opt-out flag for bundling Kotlin standard library -> https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library # suppress inspection "UnusedProperty" -kotlin.stdlib.default.dependency = false \ No newline at end of file +kotlin.stdlib.default.dependency = false + +org.gradle.jvmargs=-Xmx2048M \ No newline at end of file diff --git a/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt b/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt index 3138956..3dd7f3d 100644 --- a/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt +++ b/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt @@ -18,10 +18,9 @@ package com.stackspot.intellij.commands.git import com.stackspot.intellij.commands.BackgroundCommandRunner import com.stackspot.intellij.commands.BaseCommand -import com.stackspot.model.Stack -class GitBranch(stack: Stack, private val flags: Array) : - BaseCommand(BackgroundCommandRunner(stack.location.toPath().toString())) { +class GitBranch(workingDir: String, private val flags: Array) : + BaseCommand(BackgroundCommandRunner(workingDir)) { override fun commandLine(): List { return listOf("git", "branch", *flags) diff --git a/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt b/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt index 0bdbf18..789d74c 100644 --- a/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt +++ b/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt @@ -19,9 +19,11 @@ package com.stackspot.intellij.commands.git import com.stackspot.intellij.commands.BackgroundCommandRunner import com.stackspot.intellij.commands.BaseCommand -class GitConfig(workingDirectory: String, private val flags: Array) : +class GitConfig(workingDirectory: String) : BaseCommand(BackgroundCommandRunner(workingDirectory)) { + var flags: Array = arrayOf() + override fun commandLine(): List { return listOf("git", "config", *flags) } diff --git a/src/main/kotlin/com/stackspot/intellij/services/CreateProjectService.kt b/src/main/kotlin/com/stackspot/intellij/services/CreateProjectService.kt index ac4e1ad..b62d0bc 100644 --- a/src/main/kotlin/com/stackspot/intellij/services/CreateProjectService.kt +++ b/src/main/kotlin/com/stackspot/intellij/services/CreateProjectService.kt @@ -29,15 +29,15 @@ import java.util.concurrent.Executors import java.util.concurrent.TimeUnit @Service -class CreateProjectService { +class CreateProjectService() { var stack: Stack? = null var stackfile: Stackfile? = null val state: ProjectWizardState get() { - return if (!Constants.Paths.STK_BIN.exists()) { + return if (!isInstalled) { ProjectWizardState.NOT_INSTALLED - } else if (!ImportedStacks().hasStackFiles()) { + } else if (!importedStacks.hasStackFiles()) { ProjectWizardState.STACKFILES_EMPTY } else if (!isGitConfigOk()) { ProjectWizardState.GIT_CONFIG_NOT_OK @@ -45,6 +45,19 @@ class CreateProjectService { ProjectWizardState.OK } } + private var isInstalled = Constants.Paths.STK_BIN.exists() + private var importedStacks = ImportedStacks() + private var gitConfigCmd = GitConfig(Constants.Paths.STK_HOME.toString()) + + constructor( + importedStacks: ImportedStacks = ImportedStacks(), + isInstalled: Boolean = Constants.Paths.STK_BIN.exists(), + gitConfigCmd: GitConfig = GitConfig(Constants.Paths.STK_HOME.toString()) + ) : this() { + this.importedStacks = importedStacks + this.isInstalled = isInstalled + this.gitConfigCmd = gitConfigCmd + } fun isStackfileSelected(): Boolean = stack != null && stackfile != null @@ -62,9 +75,11 @@ class CreateProjectService { fun addGitConfig(username: String, email: String) { val executor = Executors.newSingleThreadExecutor() executor.submit { - val workingDir = Constants.Paths.STK_HOME.toString() - GitConfig(workingDir, arrayOf("--global", "user.name", "\"$username\"")).run() - GitConfig(workingDir, arrayOf("--global", "user.email", "\"$email\"")).run() + gitConfigCmd.flags = arrayOf("--global", "user.name", "\"$username\"") + gitConfigCmd.run() + + gitConfigCmd.flags = arrayOf("--global", "user.email", "\"$email\"") + gitConfigCmd.run() } executor.shutdown() } @@ -87,14 +102,14 @@ class CreateProjectService { } private fun getEmailGitConfig(): String { - val gitConfigUserEmail = GitConfig(Constants.Paths.STK_HOME.toString(), arrayOf("--get", "user.email")) - gitConfigUserEmail.run() - return (gitConfigUserEmail.runner as BackgroundCommandRunner).stdout + gitConfigCmd.flags = arrayOf("--get", "user.email") + gitConfigCmd.run() + return (gitConfigCmd.runner as BackgroundCommandRunner).stdout } private fun getUsernameGitConfig(): String { - val gitConfigUserName = GitConfig(Constants.Paths.STK_HOME.toString(), arrayOf("--get", "user.name")) - gitConfigUserName.run() - return (gitConfigUserName.runner as BackgroundCommandRunner).stdout + gitConfigCmd.flags = arrayOf("--get", "user.name") + gitConfigCmd.run() + return (gitConfigCmd.runner as BackgroundCommandRunner).stdout } } \ No newline at end of file diff --git a/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt b/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt index da43280..0718b67 100644 --- a/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt +++ b/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt @@ -29,7 +29,7 @@ import java.util.logging.Logger @Service class GetDocumentationService { - companion object { + private companion object { val LOGGER: Logger = Logger.getLogger(GetDocumentationService::class.java.name) val REMOTE_URL_SSH_REGEX = Regex("(?i)(git@).*?.git") } @@ -71,13 +71,14 @@ class GetDocumentationService { } private fun getRemoteUrl(stack: Stack): String { - val gitRemoteCmd = GitConfig(stack.location.toPath().toString(), arrayOf("--get", "remote.origin.url")) + val gitRemoteCmd = GitConfig(stack.location.toPath().toString()) + gitRemoteCmd.flags = arrayOf("--get", "remote.origin.url") gitRemoteCmd.run() return (gitRemoteCmd.runner as BackgroundCommandRunner).stdout } private fun getCurrentBranchName(stack: Stack): String { - val gitBranchCmd = GitBranch(stack, arrayOf("--show-current")) + val gitBranchCmd = GitBranch(stack.location.toPath().toString(), arrayOf("--show-current")) gitBranchCmd.run() return (gitBranchCmd.runner as BackgroundCommandRunner).stdout } diff --git a/src/main/kotlin/com/stackspot/intellij/ui/project_wizard/panels/StackSpotGitConfigErrorPanel.kt b/src/main/kotlin/com/stackspot/intellij/ui/project_wizard/panels/StackSpotGitConfigErrorPanel.kt index 9f43f31..98554b2 100644 --- a/src/main/kotlin/com/stackspot/intellij/ui/project_wizard/panels/StackSpotGitConfigErrorPanel.kt +++ b/src/main/kotlin/com/stackspot/intellij/ui/project_wizard/panels/StackSpotGitConfigErrorPanel.kt @@ -26,8 +26,8 @@ import javax.swing.JComponent class StackSpotGitConfigErrorPanel(private val parentPanel: StackSpotParentPanel) { - lateinit var username: Cell - lateinit var email: Cell + private lateinit var username: Cell + private lateinit var email: Cell fun getComponent(): JComponent { return panel { diff --git a/src/main/kotlin/com/stackspot/model/Stack.kt b/src/main/kotlin/com/stackspot/model/Stack.kt index c423cc8..c195d47 100644 --- a/src/main/kotlin/com/stackspot/model/Stack.kt +++ b/src/main/kotlin/com/stackspot/model/Stack.kt @@ -87,9 +87,7 @@ data class Stack( it.isDirectory }.filter { val template = it.parseTemplateYaml(this) - template != null && (template.types.contains(TemplateType.APP.pluginType) || template.types.contains( - TemplateType.APP.pluginType - )) + template != null && (template.types.contains(TemplateType.APP.pluginType)) }.mapNotNull { it.parsePluginYaml(this) }.toList() diff --git a/src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt b/src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt index 4c1a97e..7bc3178 100644 --- a/src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt +++ b/src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt @@ -14,71 +14,163 @@ * limitations under the License. */ -package com.stackspot.services +package com.stackspot.intellij.services -import com.stackspot.intellij.services.CreateProjectService +import com.stackspot.intellij.commands.git.GitConfig +import com.stackspot.intellij.services.enums.ProjectWizardState +import com.stackspot.model.ImportedStacks import com.stackspot.model.Stack import com.stackspot.model.Stackfile +import io.kotest.assertions.asClue +import io.kotest.matchers.shouldBe +import io.mockk.* +import org.awaitility.kotlin.await import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource +import java.util.concurrent.TimeUnit import java.util.stream.Stream -class CreateProjectServiceTest { +internal class CreateProjectServiceTest { - @ParameterizedTest - @MethodSource("saveInfoArgs") - fun `should saveInfo when args are nullable and when they don't`(stack: Stack?, stackfile: Stackfile?) { - val service = CreateProjectService().saveInfo(stack, stackfile) - Assertions.assertEquals(stack, service.stack) - Assertions.assertEquals(stackfile, service.stackfile) + private val importedStacks: ImportedStacks = mockk() + + @BeforeEach + fun init() { + clearAllMocks() } - @ParameterizedTest - @MethodSource("stackfileIsSelectedArgs") - fun `should check if stackfile is selected and when it don't`( - stack: Stack?, - stackfile: Stackfile?, - expected: Boolean - ) { - val service = CreateProjectService().saveInfo(stack, stackfile) - Assertions.assertEquals(service.isStackfileSelected(), expected) + @Nested + inner class FailureCases { + @Test + fun `service state should be STACKFILES_EMPTY`() { + every { importedStacks.hasStackFiles() } returns false + val service = CreateProjectService(importedStacks) + service.state shouldBe ProjectWizardState.STACKFILES_EMPTY + verify { importedStacks.hasStackFiles() } + confirmVerified(importedStacks) + } + + @Test + fun `service state should be NOT_INSTALLED`() { + val service = CreateProjectService(isInstalled = false) + service.state shouldBe ProjectWizardState.NOT_INSTALLED + } + + @ParameterizedTest + @MethodSource("stackfileIsSelectNullArgs") + fun `should check if stackfile isn't selected`( + stack: Stack?, + stackfile: Stackfile?, + expected: Boolean + ) { + val service = CreateProjectService().saveInfo(stack, stackfile) + Assertions.assertEquals(service.isStackfileSelected(), expected) + } + + private fun stackfileIsSelectNullArgs(): Stream = + Stream.of( + Arguments.of(null, null, false), + Arguments.of(createStack(), null, false), + Arguments.of(null, createStackfile(), false) + ) } - private companion object { - @JvmStatic - fun stackfileIsSelectedArgs(): Stream = + @Nested + inner class SuccessCases { + @Test + fun `should clear service attributes`() { + val service = CreateProjectService().saveInfo(createStack(), createStackfile()) + service.clearInfo() + + service.asClue { + it.stack shouldBe null + it.stackfile shouldBe null + } + } + + @Test + fun `service state should be OK`() { + every { importedStacks.hasStackFiles() } returns true + val service = CreateProjectService(importedStacks) + service.state shouldBe ProjectWizardState.OK + verify { importedStacks.hasStackFiles() } + confirmVerified(importedStacks) + } + + @Test + fun `should add git config`() { + val gitConfigCmd: GitConfig = mockk(relaxUnitFun = true) + every { gitConfigCmd.run() } just runs + val service = CreateProjectService(gitConfigCmd = gitConfigCmd) + service.addGitConfig("aaa", "b@b.com") + await.atMost(500, TimeUnit.MILLISECONDS) + .untilAsserted { + verify(exactly = 2) { gitConfigCmd.run() } + } + } + + @ParameterizedTest + @MethodSource("saveInfoArgs") + fun `should saveInfo when args aren't null`(stack: Stack?, stackfile: Stackfile?) { + val service = CreateProjectService().saveInfo(stack, stackfile) + service.asClue { + it.stack shouldBe stack + it.stackfile shouldBe stackfile + } + } + + @ParameterizedTest + @MethodSource("saveInfoNullArgs") + fun `should saveInfo when args are null`(stack: Stack?, stackfile: Stackfile?) { + val service = CreateProjectService().saveInfo(stack, stackfile) + service.asClue { + it.stack shouldBe stack + it.stackfile shouldBe stackfile + } + } + + @ParameterizedTest + @MethodSource("stackfileIsSelectedArgs") + fun `should check if stackfile is selected`( + stack: Stack?, + stackfile: Stackfile?, + expected: Boolean + ) { + val service = CreateProjectService().saveInfo(stack, stackfile) + Assertions.assertEquals(service.isStackfileSelected(), expected) + } + + private fun stackfileIsSelectedArgs(): Stream = + Stream.of( + Arguments.of(createStack(), createStackfile(), true) + ) + + private fun saveInfoArgs(): Stream = Stream.of( Arguments.of( - null, null, false - ), - Arguments.of( - createStack(), - createStackfile(), - true + null, null ) ) - @JvmStatic - fun saveInfoArgs(): Stream = + private fun saveInfoNullArgs(): Stream = Stream.of( Arguments.of( null, null - ), - Arguments.of( - createStack(), - createStackfile() ) ) + } - private fun createStack(name: String = "stack-for-test", description: String = "stack test description") = - Stack(name, description) + private fun createStack(name: String = "stack-for-test", description: String = "stack test description") = + Stack(name, description) - private fun createStackfile( - type: String = "app", - description: String = "stackfile test description", - template: String = "test-tempalte" - ) = Stackfile(type, description, template) - } + private fun createStackfile( + type: String = "app", + description: String = "stackfile test description", + template: String = "test-template" + ) = Stackfile(type, description, template) } \ No newline at end of file diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties new file mode 100644 index 0000000..e6d55f8 --- /dev/null +++ b/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.testinstance.lifecycle.default = per_class \ No newline at end of file From 262d9793458294e0b2890d6cf3d095862ddc08bf Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Thu, 29 Sep 2022 19:25:03 -0300 Subject: [PATCH 02/12] chore: unit tests Signed-off-by: Matheus Ferreira --- build.gradle.kts | 29 +++++- .../com/stackspot/constants/Constants.kt | 1 - .../commands/BackgroundCommandRunner.kt | 8 +- .../intellij/commands/git/GitBranch.kt | 2 +- .../intellij/commands/git/GitConfig.kt | 2 +- .../services/GetDocumentationService.kt | 24 +++-- .../services/enums/RepositoryUriGenerator.kt | 7 +- .../intellij/ui/StackSpotTerminalRunner.kt | 5 - .../ui/toolwindow/StackSpotToolWindow.kt | 1 - .../com/stackspot/yaml/YamlExtensions.kt | 13 +++ .../com/stackspot/yaml/YamlNotFoundError.kt | 19 ---- .../commands/BackgroundCommandRunnerTest.kt | 44 +++++++++ .../commons/UrlDialogExtensionTest.kt | 35 +++++++ .../services/CreateProjectServiceTest.kt | 14 ++- .../services/GetDocumentationServiceTest.kt | 56 +++++++++++ .../services/enums/ProjectWizardStateTest.kt | 28 ++++++ .../enums/RepositoryUriGeneratorTest.kt | 96 +++++++++++++++++++ .../com/stackspot/yaml/YamlExtensionsTest.kt | 14 +++ src/test/resources/yaml/empty.json | 0 .../yaml/stacks/default-stack/stack.yaml | 7 ++ .../yaml/stacks/default-stack/use-case.md | 6 ++ src/test/resources/yaml/stacks/empty.json | 0 22 files changed, 367 insertions(+), 44 deletions(-) delete mode 100644 src/main/kotlin/com/stackspot/yaml/YamlNotFoundError.kt create mode 100644 src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt create mode 100644 src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt rename src/test/kotlin/com/stackspot/{ => intellij}/services/CreateProjectServiceTest.kt (90%) create mode 100644 src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt create mode 100644 src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt create mode 100644 src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt create mode 100644 src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt create mode 100644 src/test/resources/yaml/empty.json create mode 100644 src/test/resources/yaml/stacks/default-stack/stack.yaml create mode 100644 src/test/resources/yaml/stacks/default-stack/use-case.md create mode 100644 src/test/resources/yaml/stacks/empty.json diff --git a/build.gradle.kts b/build.gradle.kts index 4c0a1be..33bce1d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -56,8 +56,22 @@ intellij { } sonarqube { + val exclusions = listOf( + "**/com/stackspot/constants/**", + "**/com/stackspot/exceptions/*", + "**/com/stackspot/intellij/actions/*", + "**/com/stackspot/intellij/commands/git/*", + "**/com/stackspot/intellij/commands/listeners/*", + "**/com/stackspot/intellij/commands/stk/*", + "**/com/stackspot/intellij/listeners/*", + "**/com/stackspot/intellij/messaging/*", + "**/com/stackspot/intellij/ui/*", + "**/com/stackspot/model/*", + ) + properties { property("sonar.projectName", "ide-intellij-plugin") + property("sonar.coverage.exclusions", exclusions) } } @@ -125,11 +139,16 @@ tasks { files(classDirectories.files.map { fileTree(it) { exclude( - "**/com/stackspot/constants/**", - "**/com/stackspot/exceptions/**", - "**/com/stackspot/intellij/actions/**", - "**/com/stackspot/intellij/messaging/**", - "**/com/stackspot/intellij/ui/**" + "com/stackspot/constants/*", + "com/stackspot/exceptions/*", + "com/stackspot/intellij/actions/*", + "com/stackspot/intellij/commands/git/*", + "com/stackspot/intellij/commands/listeners/*", + "com/stackspot/intellij/commands/stk/*", + "com/stackspot/intellij/listeners/*", + "com/stackspot/intellij/messaging/*", + "com/stackspot/intellij/ui/*", + "com/stackspot/model/*", ) } }) diff --git a/src/main/kotlin/com/stackspot/constants/Constants.kt b/src/main/kotlin/com/stackspot/constants/Constants.kt index 501d492..6f03228 100644 --- a/src/main/kotlin/com/stackspot/constants/Constants.kt +++ b/src/main/kotlin/com/stackspot/constants/Constants.kt @@ -18,7 +18,6 @@ package com.stackspot.constants import java.nio.file.Path import kotlin.io.path.Path -import kotlin.io.path.exists object Constants { const val MODULE_TYPE = "STACK_SPOT_TYPE" diff --git a/src/main/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunner.kt b/src/main/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunner.kt index 26d5d06..7c91d90 100644 --- a/src/main/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunner.kt +++ b/src/main/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunner.kt @@ -20,13 +20,16 @@ import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.util.ExecUtil.execAndGetOutput import java.nio.charset.Charset -class BackgroundCommandRunner(private val workingDir: String) : CommandRunner { +class BackgroundCommandRunner(private var workingDir: String) : CommandRunner { var stdout: String = "" get() { return field.replace("\\n".toRegex(), "") } lateinit var stderr: String + var exitCode: Int = 0 + var timeout: Boolean = false + var cancelled: Boolean = false override fun run(commandLine: List, listener: CommandRunner.CommandEndedListener?) { val generalCommandLine = GeneralCommandLine(commandLine) @@ -36,6 +39,9 @@ class BackgroundCommandRunner(private val workingDir: String) : CommandRunner { val processOutput = execAndGetOutput(generalCommandLine) stdout = processOutput.stdout stderr = processOutput.stderr + exitCode = processOutput.exitCode + timeout = processOutput.isTimeout + cancelled = processOutput.isCancelled listener?.notifyEnded() } } \ No newline at end of file diff --git a/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt b/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt index 3dd7f3d..5007193 100644 --- a/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt +++ b/src/main/kotlin/com/stackspot/intellij/commands/git/GitBranch.kt @@ -19,7 +19,7 @@ package com.stackspot.intellij.commands.git import com.stackspot.intellij.commands.BackgroundCommandRunner import com.stackspot.intellij.commands.BaseCommand -class GitBranch(workingDir: String, private val flags: Array) : +class GitBranch(var workingDir: String, private val flags: Array) : BaseCommand(BackgroundCommandRunner(workingDir)) { override fun commandLine(): List { diff --git a/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt b/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt index 789d74c..11be2ba 100644 --- a/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt +++ b/src/main/kotlin/com/stackspot/intellij/commands/git/GitConfig.kt @@ -19,7 +19,7 @@ package com.stackspot.intellij.commands.git import com.stackspot.intellij.commands.BackgroundCommandRunner import com.stackspot.intellij.commands.BaseCommand -class GitConfig(workingDirectory: String) : +class GitConfig(var workingDirectory: String) : BaseCommand(BackgroundCommandRunner(workingDirectory)) { var flags: Array = arrayOf() diff --git a/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt b/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt index 0718b67..f28d65d 100644 --- a/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt +++ b/src/main/kotlin/com/stackspot/intellij/services/GetDocumentationService.kt @@ -18,6 +18,7 @@ package com.stackspot.intellij.services import com.intellij.openapi.components.Service import com.intellij.util.containers.isNullOrEmpty +import com.stackspot.constants.Constants import com.stackspot.intellij.commands.BackgroundCommandRunner import com.stackspot.intellij.commands.git.GitBranch import com.stackspot.intellij.commands.git.GitConfig @@ -27,7 +28,18 @@ import java.util.logging.Level import java.util.logging.Logger @Service -class GetDocumentationService { +class GetDocumentationService() { + + private var gitConfigCmd = GitConfig(Constants.Paths.STK_HOME.toString()) + private var gitBranchCmd = GitBranch(Constants.Paths.STK_HOME.toString(), arrayOf("--show-current")) + + constructor( + gitConfigCmd: GitConfig = GitConfig(Constants.Paths.STK_HOME.toString()), + gitBranchCmd: GitBranch = GitBranch(Constants.Paths.STK_HOME.toString(), arrayOf("--show-current")) + ) : this() { + this.gitConfigCmd = gitConfigCmd + this.gitBranchCmd = gitBranchCmd + } private companion object { val LOGGER: Logger = Logger.getLogger(GetDocumentationService::class.java.name) @@ -71,14 +83,14 @@ class GetDocumentationService { } private fun getRemoteUrl(stack: Stack): String { - val gitRemoteCmd = GitConfig(stack.location.toPath().toString()) - gitRemoteCmd.flags = arrayOf("--get", "remote.origin.url") - gitRemoteCmd.run() - return (gitRemoteCmd.runner as BackgroundCommandRunner).stdout + gitConfigCmd.workingDirectory = stack.location.toPath().toString() + gitConfigCmd.flags = arrayOf("--get", "remote.origin.url") + gitConfigCmd.run() + return (gitConfigCmd.runner as BackgroundCommandRunner).stdout } private fun getCurrentBranchName(stack: Stack): String { - val gitBranchCmd = GitBranch(stack.location.toPath().toString(), arrayOf("--show-current")) + gitBranchCmd.workingDir = stack.location.toPath().toString() gitBranchCmd.run() return (gitBranchCmd.runner as BackgroundCommandRunner).stdout } diff --git a/src/main/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGenerator.kt b/src/main/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGenerator.kt index 2f5a8d5..e154374 100644 --- a/src/main/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGenerator.kt +++ b/src/main/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGenerator.kt @@ -41,9 +41,12 @@ enum class RepositoryUriGenerator(private val domainName: Array? = null) } }; + abstract fun generateUri(branchName: String): String + companion object { fun findByName(name: String): RepositoryUriGenerator = - RepositoryUriGenerator.values().find { enum -> enum.name.contains(name, ignoreCase = true) } ?: UNKNOWN + RepositoryUriGenerator.values() + .find { enum -> name.isNotEmpty() && enum.name.contains(name, ignoreCase = true) } ?: UNKNOWN fun findByDomainName(domainName: String): RepositoryUriGenerator { var repository: RepositoryUriGenerator = UNKNOWN @@ -56,6 +59,4 @@ enum class RepositoryUriGenerator(private val domainName: Array? = null) } } - abstract fun generateUri(branchName: String): String - } \ No newline at end of file diff --git a/src/main/kotlin/com/stackspot/intellij/ui/StackSpotTerminalRunner.kt b/src/main/kotlin/com/stackspot/intellij/ui/StackSpotTerminalRunner.kt index b7a7a19..8cff883 100644 --- a/src/main/kotlin/com/stackspot/intellij/ui/StackSpotTerminalRunner.kt +++ b/src/main/kotlin/com/stackspot/intellij/ui/StackSpotTerminalRunner.kt @@ -24,7 +24,6 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowManager -import com.intellij.ui.content.Content import com.intellij.ui.content.ContentManager import com.jediterm.terminal.model.TerminalModelListener import com.stackspot.constants.Constants @@ -65,10 +64,6 @@ class StackSpotTerminalCommandMonitoringTask( } widget.terminalTextBuffer.removeModelListener(this) } - - private fun hasRunningCommand(): Boolean { - return widget.ttyConnector != null && widget.hasRunningCommands() - } } class StackSpotTerminalRunner(private val project: Project, private val workingDir: String? = null) : CommandRunner { diff --git a/src/main/kotlin/com/stackspot/intellij/ui/toolwindow/StackSpotToolWindow.kt b/src/main/kotlin/com/stackspot/intellij/ui/toolwindow/StackSpotToolWindow.kt index 538df26..7443f0b 100644 --- a/src/main/kotlin/com/stackspot/intellij/ui/toolwindow/StackSpotToolWindow.kt +++ b/src/main/kotlin/com/stackspot/intellij/ui/toolwindow/StackSpotToolWindow.kt @@ -22,7 +22,6 @@ import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.openapi.vfs.newvfs.BulkFileListener import com.intellij.openapi.vfs.newvfs.events.VFileEvent import com.intellij.ui.components.JBScrollPane -import com.intellij.ui.dsl.builder.BottomGap import com.intellij.ui.dsl.builder.Row import com.intellij.ui.dsl.builder.TopGap import com.intellij.ui.dsl.builder.panel diff --git a/src/main/kotlin/com/stackspot/yaml/YamlExtensions.kt b/src/main/kotlin/com/stackspot/yaml/YamlExtensions.kt index 908ccbf..d21383b 100644 --- a/src/main/kotlin/com/stackspot/yaml/YamlExtensions.kt +++ b/src/main/kotlin/com/stackspot/yaml/YamlExtensions.kt @@ -24,6 +24,7 @@ import com.fasterxml.jackson.module.kotlin.KotlinModule import com.stackspot.constants.Constants import com.stackspot.model.* import java.io.File +import java.io.InputStream object YamlExtensions { @@ -119,4 +120,16 @@ fun File.parseStackfile(): Stackfile { val sf = this.parseYaml(Stackfile::class.java) sf.name = this.name.split(".").first() return sf +} + +fun InputStream.yamlToObject(clazz: Class): T = + YamlExtensions.objectMapper.readValue(this, clazz) + +object YamlResourceUtils { + + fun readYaml(resourcePath: String, clazz: Class): T? { + val resourceAsStream = javaClass.classLoader.getResourceAsStream(resourcePath) + return resourceAsStream?.yamlToObject(clazz) + } + } \ No newline at end of file diff --git a/src/main/kotlin/com/stackspot/yaml/YamlNotFoundError.kt b/src/main/kotlin/com/stackspot/yaml/YamlNotFoundError.kt deleted file mode 100644 index ed6343a..0000000 --- a/src/main/kotlin/com/stackspot/yaml/YamlNotFoundError.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.stackspot.yaml - -class YamlNotFoundError(message: String) : RuntimeException(message) \ No newline at end of file diff --git a/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt b/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt new file mode 100644 index 0000000..5249182 --- /dev/null +++ b/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt @@ -0,0 +1,44 @@ +package com.stackspot.intellij.commands + +import com.intellij.execution.process.ProcessOutput +import com.intellij.execution.util.ExecUtil +import io.kotest.matchers.shouldBe +import io.kotest.matchers.shouldNotBe +import io.mockk.confirmVerified +import io.mockk.every +import io.mockk.mockkStatic +import io.mockk.verify +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.MethodSource +import java.util.stream.Stream + +internal class BackgroundCommandRunnerTest { + + @ParameterizedTest + @MethodSource("args") + fun bla(commandLine: List, listener: CommandRunner.CommandEndedListener?) { + //Arrange + mockkStatic(ExecUtil::class) + every { ExecUtil.execAndGetOutput(any()) } returns ProcessOutput("OK", "", 0, false, false) + + //Act + val backgroundCommandRunner = BackgroundCommandRunner("") + backgroundCommandRunner.run(commandLine, listener) + + //Assert + backgroundCommandRunner.stdout shouldNotBe "" + backgroundCommandRunner.stderr shouldBe "" + backgroundCommandRunner.exitCode shouldBe 0 + backgroundCommandRunner.timeout shouldBe false + backgroundCommandRunner.cancelled shouldBe false + + verify { ExecUtil.execAndGetOutput(any()) } + } + + private fun args(): Stream = + Stream.of( + Arguments.of(listOf("git", "config", "--get", "user.name"), null) + ) + +} \ No newline at end of file diff --git a/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt b/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt new file mode 100644 index 0000000..6f1774b --- /dev/null +++ b/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt @@ -0,0 +1,35 @@ +package com.stackspot.intellij.commons + +import io.kotest.matchers.shouldBe +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.NullAndEmptySource +import org.junit.jupiter.params.provider.ValueSource + +internal class UrlDialogExtensionTest { + + @ParameterizedTest + @NullAndEmptySource + fun `url should be invalid when is null or empty string`(url: String?) { + url.isUrlValid() shouldBe false + } + + @ParameterizedTest + @ValueSource( + strings = [ + "git@github.com:bla/bla.git", + "git@gitlab.com:bla/bla.git", + "git@gitcorp.prod.aws.cloud.ihf:bla/bla", + "https://github.com/bla/bla.git" + ] + ) + fun `url should be valid`(url: String) { + url.isUrlValid() shouldBe true + } + + @ParameterizedTest + @ValueSource(strings = ["aaa", "aa@aa"]) + fun `url should be invalid`(url: String) { + url.isUrlValid() shouldBe false + } + +} \ No newline at end of file diff --git a/src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt similarity index 90% rename from src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt rename to src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt index 7bc3178..5e9500b 100644 --- a/src/test/kotlin/com/stackspot/services/CreateProjectServiceTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt @@ -16,6 +16,7 @@ package com.stackspot.intellij.services +import com.stackspot.intellij.commands.BackgroundCommandRunner import com.stackspot.intellij.commands.git.GitConfig import com.stackspot.intellij.services.enums.ProjectWizardState import com.stackspot.model.ImportedStacks @@ -38,6 +39,7 @@ import java.util.stream.Stream internal class CreateProjectServiceTest { private val importedStacks: ImportedStacks = mockk() + private val gitConfigCmd: GitConfig = mockk(relaxUnitFun = true) @BeforeEach fun init() { @@ -61,6 +63,17 @@ internal class CreateProjectServiceTest { service.state shouldBe ProjectWizardState.NOT_INSTALLED } + @Test + fun `service state should be GIT_CONFIG_NOT_OK`() { + every { importedStacks.hasStackFiles() } returns true + every { (gitConfigCmd.runner as BackgroundCommandRunner).stdout } returns "" + val service = CreateProjectService(importedStacks, gitConfigCmd = gitConfigCmd) + service.state shouldBe ProjectWizardState.GIT_CONFIG_NOT_OK + verify { importedStacks.hasStackFiles() } + verify { gitConfigCmd.run() } + confirmVerified(importedStacks) + } + @ParameterizedTest @MethodSource("stackfileIsSelectNullArgs") fun `should check if stackfile isn't selected`( @@ -104,7 +117,6 @@ internal class CreateProjectServiceTest { @Test fun `should add git config`() { - val gitConfigCmd: GitConfig = mockk(relaxUnitFun = true) every { gitConfigCmd.run() } just runs val service = CreateProjectService(gitConfigCmd = gitConfigCmd) service.addGitConfig("aaa", "b@b.com") diff --git a/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt new file mode 100644 index 0000000..0ad74ab --- /dev/null +++ b/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt @@ -0,0 +1,56 @@ +package com.stackspot.intellij.services + +import com.stackspot.intellij.commands.git.GitBranch +import com.stackspot.intellij.commands.git.GitConfig +import com.stackspot.model.Stack +import com.stackspot.yaml.YamlResourceUtils +import io.kotest.matchers.shouldBe +import io.mockk.* +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.NullSource +import java.io.File +import kotlin.io.path.Path + +internal class GetDocumentationServiceTest { + + private val gitConfigCmd: GitConfig = mockk() + private val gitBranchCmd: GitBranch = mockk() + +// @Nested +// inner class SuccessCases { +// +// @Test +// fun `should `() { +// every { gitConfigCmd.run() } just runs +// every { gitBranchCmd.run() } just runs +// val stack = YamlResourceUtils.readYaml("yaml/stacks/default-stack/stack.yaml", Stack::class.java) +// stack?.location = File(javaClass.getResource("yaml/stacks/default-stack/stack.yaml")?.file ?: "") +// +// val service = GetDocumentationService(gitConfigCmd, gitBranchCmd) +// val docUrl = service.getDocumentationUrl(stack) +// +// docUrl shouldBe "" +// verify { +// gitConfigCmd.run() +// gitBranchCmd.run() +// } +// } +// +// } + + @Nested + inner class FailureCases { + + @ParameterizedTest + @NullSource + fun `should return empty string when stack is null`(stack: Stack?) { + val service = GetDocumentationService() + val docUrl = service.getDocumentationUrl(stack) + docUrl shouldBe "" + } + + } + +} \ No newline at end of file diff --git a/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt b/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt new file mode 100644 index 0000000..7fba5a1 --- /dev/null +++ b/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt @@ -0,0 +1,28 @@ +package com.stackspot.intellij.services.enums + +import io.kotest.matchers.shouldBe +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.MethodSource +import java.util.stream.Stream + +internal class ProjectWizardStateTest { + + @ParameterizedTest + @MethodSource("rightMessageArs") + fun `should enum have the right message`(enum: ProjectWizardState, expected: String?) { + enum.message shouldBe expected + } + + private fun rightMessageArs(): Stream = + Stream.of( + Arguments.of(ProjectWizardState.NOT_INSTALLED, "Please install STK CLI before continue."), + Arguments.of(ProjectWizardState.STACKFILES_EMPTY, "Please import a stack with stackfiles before continue."), + Arguments.of( + ProjectWizardState.GIT_CONFIG_NOT_OK, + "Please insert git config username and e-mail before continue." + ), + Arguments.of(ProjectWizardState.OK, null) + ) + +} \ No newline at end of file diff --git a/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt b/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt new file mode 100644 index 0000000..a62dbd0 --- /dev/null +++ b/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt @@ -0,0 +1,96 @@ +package com.stackspot.intellij.services.enums + +import com.stackspot.exceptions.NotFoundException +import com.stackspot.intellij.services.enums.RepositoryUriGenerator +import io.kotest.assertions.throwables.shouldThrow +import io.kotest.matchers.shouldBe +import org.junit.jupiter.api.Nested +import org.junit.jupiter.api.Test +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.EmptySource +import org.junit.jupiter.params.provider.MethodSource +import org.junit.jupiter.params.provider.ValueSource +import java.util.stream.Stream + +internal class RepositoryUriGeneratorTest { + + private val branchName = "main" + + @Nested + inner class SuccessCases { + + @ParameterizedTest + @MethodSource("findByNameArgs") + fun `should find by name`(name: String, expected: RepositoryUriGenerator) { + val enum = RepositoryUriGenerator.findByName(name) + enum shouldBe expected + } + + @ParameterizedTest + @MethodSource("findByDomainNameArgs") + fun `should find by domain name`(domainName: String, expected: RepositoryUriGenerator) { + val enum = RepositoryUriGenerator.findByDomainName(domainName) + enum shouldBe expected + } + + @ParameterizedTest + @MethodSource("generateRepoUriArgs") + fun `should generate repository uri`(actual: RepositoryUriGenerator, expected: String) { + actual.generateUri(branchName) shouldBe expected + } + + private fun findByNameArgs(): Stream = + Stream.of( + Arguments.of("github", RepositoryUriGenerator.GITHUB), + Arguments.of("gitlab", RepositoryUriGenerator.GITLAB), + Arguments.of("bitbucket", RepositoryUriGenerator.BITBUCKET) + ) + + private fun findByDomainNameArgs(): Stream = + Stream.of( + Arguments.of("github.com", RepositoryUriGenerator.GITHUB), + Arguments.of("gitlab.com", RepositoryUriGenerator.GITLAB), + Arguments.of("gitcorp.prod.aws.cloud.ihf", RepositoryUriGenerator.GITLAB), + Arguments.of("bitbucket.org", RepositoryUriGenerator.BITBUCKET) + ) + + private fun generateRepoUriArgs(): Stream = + Stream.of( + Arguments.of(RepositoryUriGenerator.GITHUB, "/blob/main"), + Arguments.of(RepositoryUriGenerator.GITLAB, "/~/blob/main"), + Arguments.of(RepositoryUriGenerator.BITBUCKET, "/src/main") + ) + } + + @Nested + inner class FailureCases { + + @ParameterizedTest + @EmptySource + fun `should return UNKNOWN enum when is empty string`(name: String) { + val enum = RepositoryUriGenerator.findByName(name) + enum shouldBe RepositoryUriGenerator.UNKNOWN + } + + @ParameterizedTest + @ValueSource(strings = ["anything"]) + fun `should return UNKNOWN enum when there isn't match`(name: String) { + val enum = RepositoryUriGenerator.findByName(name) + enum shouldBe RepositoryUriGenerator.UNKNOWN + } + + @Test + fun `should throw NotFoundException when UNKNOWN try to generate uri`() { + shouldThrow { RepositoryUriGenerator.UNKNOWN.generateUri(branchName) } + } + + @ParameterizedTest + @EmptySource + fun `should return UNKNOWN when domain name is empty string`(domainName: String) { + val enum = RepositoryUriGenerator.findByDomainName(domainName) + enum shouldBe RepositoryUriGenerator.UNKNOWN + } + } + +} \ No newline at end of file diff --git a/src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt b/src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt new file mode 100644 index 0000000..aa3847e --- /dev/null +++ b/src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt @@ -0,0 +1,14 @@ +package com.stackspot.yaml + +import org.junit.jupiter.api.Nested + +internal class YamlExtensionsTest { + + @Nested + inner class SuccessCases { + + + + } + +} \ No newline at end of file diff --git a/src/test/resources/yaml/empty.json b/src/test/resources/yaml/empty.json new file mode 100644 index 0000000..e69de29 diff --git a/src/test/resources/yaml/stacks/default-stack/stack.yaml b/src/test/resources/yaml/stacks/default-stack/stack.yaml new file mode 100644 index 0000000..4ebf365 --- /dev/null +++ b/src/test/resources/yaml/stacks/default-stack/stack.yaml @@ -0,0 +1,7 @@ +name: default-stack +description: Default Stack YAML +displayName: Default Stack +category: Backend +useCases: + - title: Default Stack Use Case + content: use-case.md \ No newline at end of file diff --git a/src/test/resources/yaml/stacks/default-stack/use-case.md b/src/test/resources/yaml/stacks/default-stack/use-case.md new file mode 100644 index 0000000..87e0f1d --- /dev/null +++ b/src/test/resources/yaml/stacks/default-stack/use-case.md @@ -0,0 +1,6 @@ +## Default Stack Use Case + +### Other Topic + +- Test 1 +- Test 2 \ No newline at end of file diff --git a/src/test/resources/yaml/stacks/empty.json b/src/test/resources/yaml/stacks/empty.json new file mode 100644 index 0000000..e69de29 From d5cf195aa1a676d552d681310f892d02f215c867 Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Fri, 30 Sep 2022 10:27:04 -0300 Subject: [PATCH 03/12] chore: unit tests Signed-off-by: Matheus Ferreira --- build.gradle.kts | 28 +++++---- .../commands/BackgroundCommandRunnerTest.kt | 60 ++++++++++++++++--- 2 files changed, 70 insertions(+), 18 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 33bce1d..5a19920 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -58,15 +58,19 @@ intellij { sonarqube { val exclusions = listOf( "**/com/stackspot/constants/**", - "**/com/stackspot/exceptions/*", - "**/com/stackspot/intellij/actions/*", - "**/com/stackspot/intellij/commands/git/*", - "**/com/stackspot/intellij/commands/listeners/*", - "**/com/stackspot/intellij/commands/stk/*", - "**/com/stackspot/intellij/listeners/*", - "**/com/stackspot/intellij/messaging/*", - "**/com/stackspot/intellij/ui/*", - "**/com/stackspot/model/*", + "**/com/stackspot/exceptions/**", + "**/com/stackspot/intellij/actions/**", + "**/com/stackspot/intellij/commands/git/**", + "**/com/stackspot/intellij/commands/listeners/**", + "**/com/stackspot/intellij/commands/stk/**", + "**/com/stackspot/intellij/listeners/**", + "**/com/stackspot/intellij/messaging/**", + "**/com/stackspot/intellij/ui/**", + "**/com/stackspot/model/Plugin.kt", + "**/com/stackspot/model/Stackfile.kt", + "**/com/stackspot/model/StackfilePlugin.kt", + "**/com/stackspot/model/StackfileUseCase.kt", + "**/com/stackspot/model/TemplateType.kt", ) properties { @@ -148,7 +152,11 @@ tasks { "com/stackspot/intellij/listeners/*", "com/stackspot/intellij/messaging/*", "com/stackspot/intellij/ui/*", - "com/stackspot/model/*", + "com/stackspot/model/Plugin.kt", + "com/stackspot/model/Stackfile.kt", + "com/stackspot/model/StackfilePlugin.kt", + "com/stackspot/model/StackfileUseCase.kt", + "com/stackspot/model/TemplateType.kt", ) } }) diff --git a/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt b/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt index 5249182..4633603 100644 --- a/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt @@ -4,10 +4,7 @@ import com.intellij.execution.process.ProcessOutput import com.intellij.execution.util.ExecUtil import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe -import io.mockk.confirmVerified -import io.mockk.every -import io.mockk.mockkStatic -import io.mockk.verify +import io.mockk.* import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource @@ -16,12 +13,35 @@ import java.util.stream.Stream internal class BackgroundCommandRunnerTest { @ParameterizedTest - @MethodSource("args") - fun bla(commandLine: List, listener: CommandRunner.CommandEndedListener?) { + @MethodSource("runCommandArgs") + fun `should run command`(commandLine: List) { //Arrange mockkStatic(ExecUtil::class) every { ExecUtil.execAndGetOutput(any()) } returns ProcessOutput("OK", "", 0, false, false) + //Act + val backgroundCommandRunner = BackgroundCommandRunner("") + backgroundCommandRunner.run(commandLine) + + //Assert + backgroundCommandRunner.stdout shouldNotBe "" + backgroundCommandRunner.stderr shouldBe "" + backgroundCommandRunner.exitCode shouldBe 0 + backgroundCommandRunner.timeout shouldBe false + backgroundCommandRunner.cancelled shouldBe false + + verify { ExecUtil.execAndGetOutput(any()) } + } + + @ParameterizedTest + @MethodSource("runCommandArgs") + fun `should run command with listener`(commandLine: List) { + //Arrange + val listener: CommandRunner.CommandEndedListener = mockk() + mockkStatic(ExecUtil::class) + every { ExecUtil.execAndGetOutput(any()) } returns ProcessOutput("OK", "", 0, false, false) + every { listener.notifyEnded() } just Runs + //Act val backgroundCommandRunner = BackgroundCommandRunner("") backgroundCommandRunner.run(commandLine, listener) @@ -33,12 +53,36 @@ internal class BackgroundCommandRunnerTest { backgroundCommandRunner.timeout shouldBe false backgroundCommandRunner.cancelled shouldBe false + verify { ExecUtil.execAndGetOutput(any()) } + verify { listener.notifyEnded() } + + confirmVerified(listener) + } + + @ParameterizedTest + @MethodSource("runCommandArgs") + fun `should run command error`(commandLine: List) { + //Arrange + mockkStatic(ExecUtil::class) + every { ExecUtil.execAndGetOutput(any()) } returns ProcessOutput("", "ERROR", 1, false, false) + + //Act + val backgroundCommandRunner = BackgroundCommandRunner("") + backgroundCommandRunner.run(commandLine) + + //Assert + backgroundCommandRunner.stdout shouldBe "" + backgroundCommandRunner.stderr shouldNotBe "" + backgroundCommandRunner.exitCode shouldBe 1 + backgroundCommandRunner.timeout shouldBe false + backgroundCommandRunner.cancelled shouldBe false + verify { ExecUtil.execAndGetOutput(any()) } } - private fun args(): Stream = + private fun runCommandArgs(): Stream = Stream.of( - Arguments.of(listOf("git", "config", "--get", "user.name"), null) + Arguments.of(listOf("git", "config", "--get", "user.name")) ) } \ No newline at end of file From c62d0c847e7f7e23fb8c6c8c0dc19d17cd1e3051 Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Fri, 30 Sep 2022 10:28:24 -0300 Subject: [PATCH 04/12] chore: remove unfinished test Signed-off-by: Matheus Ferreira --- .../com/stackspot/yaml/YamlExtensionsTest.kt | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt diff --git a/src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt b/src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt deleted file mode 100644 index aa3847e..0000000 --- a/src/test/kotlin/com/stackspot/yaml/YamlExtensionsTest.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.stackspot.yaml - -import org.junit.jupiter.api.Nested - -internal class YamlExtensionsTest { - - @Nested - inner class SuccessCases { - - - - } - -} \ No newline at end of file From fd4d86adb3a78301afe0b7a74649b03b4dcef1da Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Fri, 30 Sep 2022 10:30:01 -0300 Subject: [PATCH 05/12] chore: add todo in comment test Signed-off-by: Matheus Ferreira --- .../stackspot/intellij/services/GetDocumentationServiceTest.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt index 0ad74ab..2cdec61 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt @@ -18,6 +18,7 @@ internal class GetDocumentationServiceTest { private val gitConfigCmd: GitConfig = mockk() private val gitBranchCmd: GitBranch = mockk() + //TODO(Save it to complete later - Needs to add stack file location) // @Nested // inner class SuccessCases { // From 4aba22a9eab436217fad82be6bc69726885454af Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Fri, 30 Sep 2022 10:48:47 -0300 Subject: [PATCH 06/12] chore: add headers Signed-off-by: Matheus Ferreira --- .../commands/BackgroundCommandRunnerTest.kt | 16 ++++++++++++++++ .../intellij/commons/UrlDialogExtensionTest.kt | 16 ++++++++++++++++ .../services/GetDocumentationServiceTest.kt | 16 ++++++++++++++++ .../services/enums/ProjectWizardStateTest.kt | 16 ++++++++++++++++ .../services/enums/RepositoryUriGeneratorTest.kt | 16 ++++++++++++++++ src/test/kotlin/com/stackspot/model/empty.json | 0 src/test/kotlin/com/stackspot/yaml/empty.json | 0 7 files changed, 80 insertions(+) create mode 100644 src/test/kotlin/com/stackspot/model/empty.json create mode 100644 src/test/kotlin/com/stackspot/yaml/empty.json diff --git a/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt b/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt index 4633603..b57aaaa 100644 --- a/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/commands/BackgroundCommandRunnerTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.stackspot.intellij.commands import com.intellij.execution.process.ProcessOutput diff --git a/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt b/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt index 6f1774b..c418aa6 100644 --- a/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/commons/UrlDialogExtensionTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.stackspot.intellij.commons import io.kotest.matchers.shouldBe diff --git a/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt index 2cdec61..eb980f1 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/GetDocumentationServiceTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.stackspot.intellij.services import com.stackspot.intellij.commands.git.GitBranch diff --git a/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt b/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt index 7fba5a1..539301d 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.stackspot.intellij.services.enums import io.kotest.matchers.shouldBe diff --git a/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt b/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt index a62dbd0..3a0075d 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/enums/RepositoryUriGeneratorTest.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.stackspot.intellij.services.enums import com.stackspot.exceptions.NotFoundException diff --git a/src/test/kotlin/com/stackspot/model/empty.json b/src/test/kotlin/com/stackspot/model/empty.json new file mode 100644 index 0000000..e69de29 diff --git a/src/test/kotlin/com/stackspot/yaml/empty.json b/src/test/kotlin/com/stackspot/yaml/empty.json new file mode 100644 index 0000000..e69de29 From f60cc8cea6f8a16cadd8799c6da4dfe99e1fee70 Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Mon, 3 Oct 2022 09:16:55 -0300 Subject: [PATCH 07/12] fix: mock isInstalled attribute for some unit tests Signed-off-by: Matheus Ferreira --- .../stackspot/intellij/services/CreateProjectServiceTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt index 5e9500b..e80fdb5 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt @@ -51,7 +51,7 @@ internal class CreateProjectServiceTest { @Test fun `service state should be STACKFILES_EMPTY`() { every { importedStacks.hasStackFiles() } returns false - val service = CreateProjectService(importedStacks) + val service = CreateProjectService(importedStacks, isInstalled = true) service.state shouldBe ProjectWizardState.STACKFILES_EMPTY verify { importedStacks.hasStackFiles() } confirmVerified(importedStacks) @@ -67,7 +67,7 @@ internal class CreateProjectServiceTest { fun `service state should be GIT_CONFIG_NOT_OK`() { every { importedStacks.hasStackFiles() } returns true every { (gitConfigCmd.runner as BackgroundCommandRunner).stdout } returns "" - val service = CreateProjectService(importedStacks, gitConfigCmd = gitConfigCmd) + val service = CreateProjectService(importedStacks, gitConfigCmd = gitConfigCmd, isInstalled = true) service.state shouldBe ProjectWizardState.GIT_CONFIG_NOT_OK verify { importedStacks.hasStackFiles() } verify { gitConfigCmd.run() } From 127fe2e93fe75bccc7dc2ff88ef12e54a37fe64f Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Mon, 3 Oct 2022 09:21:42 -0300 Subject: [PATCH 08/12] fix: mock isInstalled attribute for some unit tests Signed-off-by: Matheus Ferreira --- .../stackspot/intellij/services/CreateProjectServiceTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt index e80fdb5..e80145f 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt @@ -109,7 +109,7 @@ internal class CreateProjectServiceTest { @Test fun `service state should be OK`() { every { importedStacks.hasStackFiles() } returns true - val service = CreateProjectService(importedStacks) + val service = CreateProjectService(importedStacks, isInstalled = true) service.state shouldBe ProjectWizardState.OK verify { importedStacks.hasStackFiles() } confirmVerified(importedStacks) @@ -118,7 +118,7 @@ internal class CreateProjectServiceTest { @Test fun `should add git config`() { every { gitConfigCmd.run() } just runs - val service = CreateProjectService(gitConfigCmd = gitConfigCmd) + val service = CreateProjectService(gitConfigCmd = gitConfigCmd, isInstalled = true) service.addGitConfig("aaa", "b@b.com") await.atMost(500, TimeUnit.MILLISECONDS) .untilAsserted { From a9dcb4d5615d77c3507c7a247f0a8e711a4888cc Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Mon, 3 Oct 2022 14:09:46 -0300 Subject: [PATCH 09/12] fix: renamed method source function Signed-off-by: Matheus Ferreira --- .../intellij/services/enums/ProjectWizardStateTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt b/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt index 539301d..be47c29 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/enums/ProjectWizardStateTest.kt @@ -25,12 +25,12 @@ import java.util.stream.Stream internal class ProjectWizardStateTest { @ParameterizedTest - @MethodSource("rightMessageArs") + @MethodSource("rightMessageArgs") fun `should enum have the right message`(enum: ProjectWizardState, expected: String?) { enum.message shouldBe expected } - private fun rightMessageArs(): Stream = + private fun rightMessageArgs(): Stream = Stream.of( Arguments.of(ProjectWizardState.NOT_INSTALLED, "Please install STK CLI before continue."), Arguments.of(ProjectWizardState.STACKFILES_EMPTY, "Please import a stack with stackfiles before continue."), From f5cd0bfee029e70fc6607f83d286a0fefe871f08 Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Mon, 3 Oct 2022 14:27:37 -0300 Subject: [PATCH 10/12] chore: folders Signed-off-by: Matheus Ferreira --- src/test/resources/yaml/{ => plugins}/empty.json | 0 src/test/resources/yaml/stackfiles/empty.json | 0 src/test/resources/yaml/templates/empty.json | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/test/resources/yaml/{ => plugins}/empty.json (100%) create mode 100644 src/test/resources/yaml/stackfiles/empty.json create mode 100644 src/test/resources/yaml/templates/empty.json diff --git a/src/test/resources/yaml/empty.json b/src/test/resources/yaml/plugins/empty.json similarity index 100% rename from src/test/resources/yaml/empty.json rename to src/test/resources/yaml/plugins/empty.json diff --git a/src/test/resources/yaml/stackfiles/empty.json b/src/test/resources/yaml/stackfiles/empty.json new file mode 100644 index 0000000..e69de29 diff --git a/src/test/resources/yaml/templates/empty.json b/src/test/resources/yaml/templates/empty.json new file mode 100644 index 0000000..e69de29 From a57989f624fa6952e579fa7e58823735353eeb34 Mon Sep 17 00:00:00 2001 From: Matheus Ferreira Date: Tue, 4 Oct 2022 10:56:52 -0300 Subject: [PATCH 11/12] fix: add mock for git cmd Signed-off-by: Matheus Ferreira --- .../stackspot/intellij/services/CreateProjectServiceTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt index e80145f..1882405 100644 --- a/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt +++ b/src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt @@ -48,6 +48,7 @@ internal class CreateProjectServiceTest { @Nested inner class FailureCases { + @Test fun `service state should be STACKFILES_EMPTY`() { every { importedStacks.hasStackFiles() } returns false @@ -95,6 +96,7 @@ internal class CreateProjectServiceTest { @Nested inner class SuccessCases { + @Test fun `should clear service attributes`() { val service = CreateProjectService().saveInfo(createStack(), createStackfile()) @@ -109,9 +111,11 @@ internal class CreateProjectServiceTest { @Test fun `service state should be OK`() { every { importedStacks.hasStackFiles() } returns true - val service = CreateProjectService(importedStacks, isInstalled = true) + every { (gitConfigCmd.runner as BackgroundCommandRunner).stdout } returns "ok" + val service = CreateProjectService(importedStacks, isInstalled = true, gitConfigCmd = gitConfigCmd) service.state shouldBe ProjectWizardState.OK verify { importedStacks.hasStackFiles() } + verify(exactly = 2) { gitConfigCmd.run() } confirmVerified(importedStacks) } From e25c9e714df27c6d1861ab2ae9b037a8a54c526b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 6 Oct 2022 12:56:23 +0000 Subject: [PATCH 12/12] Changelog update - v1.0.0 Signed-off-by: GitHub Action --- CHANGELOG.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b592e4..59330b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,25 @@ ## Releases +## [v1.0.0] - 2022-10-06 + + +### Exciting New Features 🎉 +* Feature: Improve code coverage with unit tests by @matheusferreirazup in https://github.com/stack-spot/stackspot-intellij-extension/pull/48 +### Bug Fixes 🛠 +* Bug Fix: Add mock for git config command runner by @matheusferreirazup in https://github.com/stack-spot/stackspot-intellij-extension/pull/53 + + +Full Changelog: https://github.com/stack-spot/stackspot-intellij-extension/compare/v0.1.4...v1.0.0 + ## [v0.1.4] - 2022-09-21 - ### Exciting New Features 🎉 * Feature: Improve plugin description in marketplace page by @matheusferreirazup in https://github.com/stack-spot/stackspot-intellij-extension/pull/19 * Feature: changed the documentation url inside the readme by @adroaldonetozup in https://github.com/stack-spot/stackspot-intellij-extension/pull/22 * Feature: Created workflow to generate release notes and publish plugin by @adroaldonetozup in https://github.com/stack-spot/stackspot-intellij-extension/pull/23 * Feature: Add Sonarqube and first unit tests by @matheusferreirazup in https://github.com/stack-spot/stackspot-intellij-extension/pull/33 + ### Bug Fixes 🛠 * Bug fix: Project wizard always stuck in "no stackfiles panel" by @matheusferreirazup in https://github.com/stack-spot/stackspot-intellij-extension/pull/17 * Bug fix: Stack url dialog by @adroaldonetozup in https://github.com/stack-spot/stackspot-intellij-extension/pull/18 @@ -19,7 +30,8 @@ * Bug Fix: Moved changelog jobs into deploy prod workflow by @adroaldonetozup in https://github.com/stack-spot/stackspot-intellij-extension/pull/28 * Bug Fix: Changed changelog extension in build gradle and disable buildSearchableOptions by @adroaldonetozup in https://github.com/stack-spot/stackspot-intellij-extension/pull/29 * Bug Fix: Added project version property in update changelog command by @adroaldonetozup in https://github.com/stack-spot/stackspot-intellij-extension/pull/30 + ### Other Changes * Refactor: Change reusable workflows to use the main branch instead of release branch by @matheusferreirazup in https://github.com/stack-spot/stackspot-intellij-extension/pull/24 -Full Changelog: https://github.com/stack-spot/stackspot-intellij-extension/compare/v0.0.3...v0.1.4 +Full Changelog: https://github.com/stack-spot/stackspot-intellij-extension/compare/v0.0.3...v0.1.4 \ No newline at end of file