From d6e8b63dc3b5ea60b8ff2d1fd2ade35a5dab49d1 Mon Sep 17 00:00:00 2001 From: Daniel Penkin Date: Tue, 8 May 2012 02:23:36 +0400 Subject: [PATCH] Added simple kotlin-maven-plugin integration test --- libraries/tools/kotlin-maven-plugin/pom.xml | 26 +++++ .../kotlin-maven-plugin/src/it/settings.xml | 35 ++++++ .../src/it/test-helloworld/pom.xml | 105 ++++++++++++++++++ .../main/kotlin/org/jetbrains/HelloWorld.kt | 14 +++ .../org/jetbrains/HelloWorldJavaTest.java | 18 +++ .../src/it/test-helloworld/verify.bsh | 7 ++ 6 files changed, 205 insertions(+) create mode 100644 libraries/tools/kotlin-maven-plugin/src/it/settings.xml create mode 100644 libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/pom.xml create mode 100644 libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/main/kotlin/org/jetbrains/HelloWorld.kt create mode 100644 libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/test/java/org/jetbrains/HelloWorldJavaTest.java create mode 100644 libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/verify.bsh diff --git a/libraries/tools/kotlin-maven-plugin/pom.xml b/libraries/tools/kotlin-maven-plugin/pom.xml index bc60410e04a..4caa1412f92 100644 --- a/libraries/tools/kotlin-maven-plugin/pom.xml +++ b/libraries/tools/kotlin-maven-plugin/pom.xml @@ -55,6 +55,32 @@ maven-plugin-plugin 2.9 + + + maven-invoker-plugin + 1.5 + + src/it + ${project.build.directory}/it + + */pom.xml + + + src/it/settings.xml + ${project.build.directory}/local-repo + verify.bsh + + + + integration-test + package + + install + run + + + + diff --git a/libraries/tools/kotlin-maven-plugin/src/it/settings.xml b/libraries/tools/kotlin-maven-plugin/src/it/settings.xml new file mode 100644 index 00000000000..4d6edd35ac6 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin/src/it/settings.xml @@ -0,0 +1,35 @@ + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/pom.xml b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/pom.xml new file mode 100644 index 00000000000..5d9734b9e55 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/pom.xml @@ -0,0 +1,105 @@ + + + 4.0.0 + + org.jetbrains.kotlin.it + test-helloworld + 1.0 + Test Hello World project + + + Test the kotlin-maven-plugin:compile goal on HelloWorld project. + + + + 0.1-SNAPSHOT + + + + + junit + junit + 4.9 + + + + + + ${project.basedir}/src/main/kotlin + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + + + + + + jetbrains-release + http://repository.jetbrains.com/releases + + true + + + false + + + + jetbrains-snapshots + http://repository.jetbrains.com/kotlin-snapshots + + false + + + true + + + + + + + jetbrains-release + http://repository.jetbrains.com/releases + + true + + + false + + + + jetbrains-snapshots + http://repository.jetbrains.com/kotlin-snapshots + + false + + + true + + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/main/kotlin/org/jetbrains/HelloWorld.kt b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/main/kotlin/org/jetbrains/HelloWorld.kt new file mode 100644 index 00000000000..c3a8fa7ca3a --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/main/kotlin/org/jetbrains/HelloWorld.kt @@ -0,0 +1,14 @@ +package org.jetbrains +/** + * User: danielpenkin + * Date: 06.05.12 + * Time: 22:53 + */ + +fun main(args : Array) { + System.out?.println(getGreeting()) +} + +fun getGreeting() : String { + return "Hello, World!" +} \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/test/java/org/jetbrains/HelloWorldJavaTest.java b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/test/java/org/jetbrains/HelloWorldJavaTest.java new file mode 100644 index 00000000000..5a60556b1b2 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/src/test/java/org/jetbrains/HelloWorldJavaTest.java @@ -0,0 +1,18 @@ +package org.jetbrains; + +import org.junit.Test; + +import static junit.framework.Assert.assertEquals; + +/** + * User: danielpenkin + * Date: 06.05.12 + * Time: 23:35 + */ +public class HelloWorldJavaTest { + + @Test + public void greeting() { + assertEquals("Hello, World!", org.jetbrains.namespace.getGreeting()); + } +} diff --git a/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/verify.bsh b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/verify.bsh new file mode 100644 index 00000000000..760db7e13d0 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin/src/it/test-helloworld/verify.bsh @@ -0,0 +1,7 @@ +import java.io.*; + +File file = new File( basedir, "target/test-helloworld-1.0.jar" ); +if (!file.exists() || !file.isFile()) +{ + throw new FileNotFoundException( "Could not find generated JAR: " + file ); +} \ No newline at end of file