From 5f57605b814347e93a8eca5cc6e7dd0401e68e78 Mon Sep 17 00:00:00 2001 From: Michael Nedzelsky Date: Tue, 2 Dec 2014 03:07:35 +0300 Subject: [PATCH] add tests for js-maven projects --- .../jet/generators/tests/GenerateTests.kt | 1 + .../js-maven/libraryMissed/pom.xml | 33 +++++++++ .../js-maven/libraryMissed/pom_after.xml | 40 ++++++++++ .../js-maven/pluginMissed/pom.xml | 22 ++++++ .../js-maven/pluginMissed/pom_after.xml | 45 +++++++++++ .../js-maven/simpleProject/pom.xml | 12 +++ .../js-maven/simpleProject/pom_after.xml | 45 +++++++++++ .../js-maven/simpleProjectSnapshot/pom.xml | 15 ++++ .../simpleProjectSnapshot/pom_after.xml | 74 +++++++++++++++++++ ...actConfigureProjectByChangingFileTest.java | 5 ++ ...ureProjectByChangingFileTestGenerated.java | 35 ++++++++- 11 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 idea/testData/configuration/js-maven/libraryMissed/pom.xml create mode 100644 idea/testData/configuration/js-maven/libraryMissed/pom_after.xml create mode 100644 idea/testData/configuration/js-maven/pluginMissed/pom.xml create mode 100644 idea/testData/configuration/js-maven/pluginMissed/pom_after.xml create mode 100644 idea/testData/configuration/js-maven/simpleProject/pom.xml create mode 100644 idea/testData/configuration/js-maven/simpleProject/pom_after.xml create mode 100644 idea/testData/configuration/js-maven/simpleProjectSnapshot/pom.xml create mode 100644 idea/testData/configuration/js-maven/simpleProjectSnapshot/pom_after.xml diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index 117927f25d8..cc05cf028fd 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -527,6 +527,7 @@ fun main(args: Array) { model("configuration/android-gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestAndroidGradle") model("configuration/gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestGradle") model("configuration/maven", extension = null, recursive = false, testMethod = "doTestWithMaven") + model("configuration/js-maven", extension = null, recursive = false, testMethod = "doTestWithJSMaven") } testClass(javaClass()) { diff --git a/idea/testData/configuration/js-maven/libraryMissed/pom.xml b/idea/testData/configuration/js-maven/libraryMissed/pom.xml new file mode 100644 index 00000000000..f651c8a4765 --- /dev/null +++ b/idea/testData/configuration/js-maven/libraryMissed/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + js + compile + + js + + + + + + + + $VERSION$ + + + + \ No newline at end of file diff --git a/idea/testData/configuration/js-maven/libraryMissed/pom_after.xml b/idea/testData/configuration/js-maven/libraryMissed/pom_after.xml new file mode 100644 index 00000000000..6eaa12da828 --- /dev/null +++ b/idea/testData/configuration/js-maven/libraryMissed/pom_after.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + js + compile + + js + + + + + + + + + org.jetbrains.kotlin + kotlin-js-library + ${kotlin.version} + + + + $VERSION$ + + + + \ No newline at end of file diff --git a/idea/testData/configuration/js-maven/pluginMissed/pom.xml b/idea/testData/configuration/js-maven/pluginMissed/pom.xml new file mode 100644 index 00000000000..4dc874818b3 --- /dev/null +++ b/idea/testData/configuration/js-maven/pluginMissed/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + $VERSION$ + + + + org.jetbrains.kotlin + kotlin-js-library + ${kotlin.version} + + + + + \ No newline at end of file diff --git a/idea/testData/configuration/js-maven/pluginMissed/pom_after.xml b/idea/testData/configuration/js-maven/pluginMissed/pom_after.xml new file mode 100644 index 00000000000..4bc795fbab9 --- /dev/null +++ b/idea/testData/configuration/js-maven/pluginMissed/pom_after.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + js + compile + + js + + + + + + + + + + + + + $VERSION$ + + + + org.jetbrains.kotlin + kotlin-js-library + ${kotlin.version} + + + + + \ No newline at end of file diff --git a/idea/testData/configuration/js-maven/simpleProject/pom.xml b/idea/testData/configuration/js-maven/simpleProject/pom.xml new file mode 100644 index 00000000000..b53b01dacca --- /dev/null +++ b/idea/testData/configuration/js-maven/simpleProject/pom.xml @@ -0,0 +1,12 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/idea/testData/configuration/js-maven/simpleProject/pom_after.xml b/idea/testData/configuration/js-maven/simpleProject/pom_after.xml new file mode 100644 index 00000000000..3a130b0c402 --- /dev/null +++ b/idea/testData/configuration/js-maven/simpleProject/pom_after.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + js + compile + + js + + + + + + + + + + + + + + org.jetbrains.kotlin + kotlin-js-library + ${kotlin.version} + + + + $VERSION$ + + + + \ No newline at end of file diff --git a/idea/testData/configuration/js-maven/simpleProjectSnapshot/pom.xml b/idea/testData/configuration/js-maven/simpleProjectSnapshot/pom.xml new file mode 100644 index 00000000000..9663ae6eb61 --- /dev/null +++ b/idea/testData/configuration/js-maven/simpleProjectSnapshot/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + + diff --git a/idea/testData/configuration/js-maven/simpleProjectSnapshot/pom_after.xml b/idea/testData/configuration/js-maven/simpleProjectSnapshot/pom_after.xml new file mode 100644 index 00000000000..6bf45dbb266 --- /dev/null +++ b/idea/testData/configuration/js-maven/simpleProjectSnapshot/pom_after.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + maventest + maventest + 1.0-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + js + compile + + js + + + + + + + + + + + + + + + false + + + true + + sonatype.oss.snapshots + Sonatype OSS Snapshot Repository + http://oss.sonatype.org/content/repositories/snapshots + + + + + + false + + + true + + sonatype.oss.snapshots + Sonatype OSS Snapshot Repository + http://oss.sonatype.org/content/repositories/snapshots + + + + + org.jetbrains.kotlin + kotlin-js-library + ${kotlin.version} + + + + $VERSION$ + + + + + \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/configuration/AbstractConfigureProjectByChangingFileTest.java b/idea/tests/org/jetbrains/jet/plugin/configuration/AbstractConfigureProjectByChangingFileTest.java index edb727d5e4e..b21a4dbc3c8 100644 --- a/idea/tests/org/jetbrains/jet/plugin/configuration/AbstractConfigureProjectByChangingFileTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/configuration/AbstractConfigureProjectByChangingFileTest.java @@ -33,6 +33,11 @@ public abstract class AbstractConfigureProjectByChangingFileTest extends LightCo doTest(pathWithFile, pathWithFile.replace("pom", "pom_after"), new KotlinJavaMavenConfigurator()); } + public void doTestWithJSMaven(@NotNull String path) throws Exception { + String pathWithFile = path + "/" + MavenConstants.POM_XML; + doTest(pathWithFile, pathWithFile.replace("pom", "pom_after"), new KotlinJavascriptMavenConfigurator()); + } + public void doTestAndroidGradle(@NotNull String path) throws Exception { doTest(path, path.replace("before", "after"), new KotlinAndroidGradleModuleConfigurator()); } diff --git a/idea/tests/org/jetbrains/jet/plugin/configuration/ConfigureProjectByChangingFileTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/configuration/ConfigureProjectByChangingFileTestGenerated.java index dc9c7e63196..804420a4747 100644 --- a/idea/tests/org/jetbrains/jet/plugin/configuration/ConfigureProjectByChangingFileTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/configuration/ConfigureProjectByChangingFileTestGenerated.java @@ -28,7 +28,7 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@InnerTestClasses({ConfigureProjectByChangingFileTestGenerated.Android_gradle.class, ConfigureProjectByChangingFileTestGenerated.Gradle.class, ConfigureProjectByChangingFileTestGenerated.Maven.class}) +@InnerTestClasses({ConfigureProjectByChangingFileTestGenerated.Android_gradle.class, ConfigureProjectByChangingFileTestGenerated.Gradle.class, ConfigureProjectByChangingFileTestGenerated.Maven.class, ConfigureProjectByChangingFileTestGenerated.Js_maven.class}) @RunWith(JUnit3RunnerWithInners.class) public class ConfigureProjectByChangingFileTestGenerated extends AbstractConfigureProjectByChangingFileTest { @TestMetadata("idea/testData/configuration/android-gradle") @@ -223,4 +223,37 @@ public class ConfigureProjectByChangingFileTestGenerated extends AbstractConfigu doTestWithMaven(fileName); } } + + @TestMetadata("idea/testData/configuration/js-maven") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Js_maven extends AbstractConfigureProjectByChangingFileTest { + public void testAllFilesPresentInJs_maven() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/configuration/js-maven"), Pattern.compile("^([^\\.]+)$"), false); + } + + @TestMetadata("libraryMissed") + public void testLibraryMissed() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/libraryMissed/"); + doTestWithJSMaven(fileName); + } + + @TestMetadata("pluginMissed") + public void testPluginMissed() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/pluginMissed/"); + doTestWithJSMaven(fileName); + } + + @TestMetadata("simpleProject") + public void testSimpleProject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/simpleProject/"); + doTestWithJSMaven(fileName); + } + + @TestMetadata("simpleProjectSnapshot") + public void testSimpleProjectSnapshot() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/configuration/js-maven/simpleProjectSnapshot/"); + doTestWithJSMaven(fileName); + } + } }