-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from modelix/MODELIX-813-add-options-to-specif…
…y-mps-plugins-for-run-configuration feat: add options to specify MPS plugins for run configuration
- Loading branch information
Showing
6 changed files
with
127 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
build-tools-lib/src/test/kotlin/org/modelix/buildtools/runner/MPSRunnerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.modelix.buildtools.runner | ||
|
||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.assertThrows | ||
import java.io.File | ||
|
||
class MPSRunnerTest { | ||
val mpsVersion = "2023.3.1" | ||
val buildDir = File("/buildDir") | ||
val mpsHome = File("/mpsHome") | ||
|
||
@Test | ||
fun `generate config with bundled plugins`() { | ||
val plugins = listOf(PluginConfig("aPluginId", BundledPluginPath(File("plugins/aPluginFolder")))) | ||
val config = MPSRunnerConfig(buildDir = buildDir, mpsHome = mpsHome, plugins = plugins) | ||
val runner = MPSRunner(config) | ||
|
||
val antScriptText = runner.generateAntScriptText(mpsVersion) | ||
|
||
assertThat(antScriptText) | ||
.contains("""<plugin id="aPluginId" path="${'$'}{artifacts.mps}/plugins/aPluginFolder"/>""") | ||
} | ||
|
||
@Test | ||
fun `bundled plugin cannot be created with an absolute path`() { | ||
val exception = assertThrows<IllegalArgumentException> { | ||
BundledPluginPath(File("/plugins/aPluginFolder")) | ||
} | ||
|
||
assertThat(exception) | ||
.hasMessage("The path `/plugins/aPluginFolder` to a bundled plugin must be a relative path.") | ||
} | ||
|
||
@Test | ||
fun `generate config with external plugins`() { | ||
val plugins = listOf(PluginConfig("aPluginId", ExternalPluginPath(File("/aPluginFolder")))) | ||
val config = MPSRunnerConfig(buildDir = buildDir, mpsHome = mpsHome, plugins = plugins) | ||
val runner = MPSRunner(config) | ||
|
||
val antScriptText = runner.generateAntScriptText(mpsVersion) | ||
|
||
assertThat(antScriptText) | ||
.contains("""<plugin id="aPluginId" path="/aPluginFolder"/>""") | ||
} | ||
|
||
@Test | ||
fun `generate config with enabled autoPluginDiscovery`() { | ||
val config = MPSRunnerConfig(buildDir = buildDir, mpsHome = mpsHome, autoPluginDiscovery = true) | ||
val runner = MPSRunner(config) | ||
|
||
val antScriptText = runner.generateAntScriptText(mpsVersion) | ||
|
||
assertThat(antScriptText) | ||
.contains("""<runMPS autoPluginDiscovery="true" solution="null(runMPS_null.solution)" startClass="Main" startMethod="main">""") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters