From 1b3f5eb617863b4d4c2e1c29b48a1efba2bdf5ff Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Sat, 3 Oct 2009 14:53:01 +0200 Subject: Added test 3 --- ReleaseNotes.txt | 2 + src/it/executable/pom.xml | 71 ------------------- src/it/executable/src/main/c/Executable.c | 8 --- src/it/it-parent/pom.xml | 10 +++ src/it/it0001-executable/pom.xml | 71 +++++++++++++++++++ src/it/it0001-executable/src/main/c/Executable.c | 8 +++ src/it/it0002-executable-static/pom.xml | 71 +++++++++++++++++++ .../src/main/c/HelloWorldExe.c | 8 +++ src/it/it0003-jni/pom.xml | 73 +++++++++++++++++++ src/it/it0003-jni/src/main/c/HelloWorldJNI.c | 16 +++++ .../com/mycompany/mypackage/HelloWorldJNI.java | 15 ++++ .../src/test/java/HelloWorldJNITest.java | 25 +++++++ src/it/jni/pom.xml | 81 ---------------------- src/it/jni/src/main/c/HelloWorldJNI.c | 16 ----- .../com/mycompany/mypackage/HelloWorldJNI.java | 15 ---- src/it/jni/src/test/java/HelloWorldJNITest.java | 25 ------- src/site/apt/HelloWorld.apt | 4 +- 17 files changed, 301 insertions(+), 218 deletions(-) delete mode 100644 src/it/executable/pom.xml delete mode 100644 src/it/executable/src/main/c/Executable.c create mode 100644 src/it/it0001-executable/pom.xml create mode 100644 src/it/it0001-executable/src/main/c/Executable.c create mode 100644 src/it/it0002-executable-static/pom.xml create mode 100644 src/it/it0002-executable-static/src/main/c/HelloWorldExe.c create mode 100644 src/it/it0003-jni/pom.xml create mode 100644 src/it/it0003-jni/src/main/c/HelloWorldJNI.c create mode 100644 src/it/it0003-jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java create mode 100644 src/it/it0003-jni/src/test/java/HelloWorldJNITest.java delete mode 100644 src/it/jni/pom.xml delete mode 100644 src/it/jni/src/main/c/HelloWorldJNI.c delete mode 100644 src/it/jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java delete mode 100644 src/it/jni/src/test/java/HelloWorldJNITest.java diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 83838d3..369f297 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -15,6 +15,8 @@ Bugs - Excecutable needs a test to run and verify the output of Executable. +- Resource directory seems in GIT while it should not, it should be generated in target + - When it test fails it seems not reported in main pom, refer to executable - nar-integration (our plugin copy) tests are not run when maven.tests.skip=true is set... diff --git a/src/it/executable/pom.xml b/src/it/executable/pom.xml deleted file mode 100644 index 98b664e..0000000 --- a/src/it/executable/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.maven.its.nar - it-parent - 1.0-SNAPSHOT - ../it-parent/pom.xml - - - executable - nar - - Maven NAR Executable Test - 1.0-SNAPSHOT - - Simple test executable - - http://maven.apache.org/ - - - - - integration-test - - - maven-nar-plugin - true - - - - executable - true - - - - - - maven-surefire-plugin - - true - - - - - diff --git a/src/it/executable/src/main/c/Executable.c b/src/it/executable/src/main/c/Executable.c deleted file mode 100644 index d640602..0000000 --- a/src/it/executable/src/main/c/Executable.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main(int argc, char *argv[]) { - printf("Helloworld\n"); - return 0; -} - - diff --git a/src/it/it-parent/pom.xml b/src/it/it-parent/pom.xml index 003cca1..44a0010 100644 --- a/src/it/it-parent/pom.xml +++ b/src/it/it-parent/pom.xml @@ -43,6 +43,7 @@ under the License. + local.central @@ -55,4 +56,13 @@ under the License. + + + + junit + junit + 3.8.2 + test + + diff --git a/src/it/it0001-executable/pom.xml b/src/it/it0001-executable/pom.xml new file mode 100644 index 0000000..63391cf --- /dev/null +++ b/src/it/it0001-executable/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.nar + it-parent + 1.0-SNAPSHOT + ../it-parent/pom.xml + + + it0001-executable + nar + + Maven NAR Executable Test + 1.0-SNAPSHOT + + Simple test executable + + http://maven.apache.org/ + + + + + integration-test + + + maven-nar-plugin + true + + + + executable + true + + + + + + maven-surefire-plugin + + true + + + + + diff --git a/src/it/it0001-executable/src/main/c/Executable.c b/src/it/it0001-executable/src/main/c/Executable.c new file mode 100644 index 0000000..d640602 --- /dev/null +++ b/src/it/it0001-executable/src/main/c/Executable.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) { + printf("Helloworld\n"); + return 0; +} + + diff --git a/src/it/it0002-executable-static/pom.xml b/src/it/it0002-executable-static/pom.xml new file mode 100644 index 0000000..42d4e8b --- /dev/null +++ b/src/it/it0002-executable-static/pom.xml @@ -0,0 +1,71 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.nar + it-parent + 1.0-SNAPSHOT + ../it-parent/pom.xml + + + it0002-executable-static + nar + + Maven NAR Static Executable Test + 1.0-SNAPSHOT + + Simple executable statically linked with the c runtime + + + + + + integration-test + + + maven-nar-plugin + true + + static + + + executable + true + + + + + + maven-surefire-plugin + + true + + + + + diff --git a/src/it/it0002-executable-static/src/main/c/HelloWorldExe.c b/src/it/it0002-executable-static/src/main/c/HelloWorldExe.c new file mode 100644 index 0000000..d640602 --- /dev/null +++ b/src/it/it0002-executable-static/src/main/c/HelloWorldExe.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) { + printf("Helloworld\n"); + return 0; +} + + diff --git a/src/it/it0003-jni/pom.xml b/src/it/it0003-jni/pom.xml new file mode 100644 index 0000000..8c1881b --- /dev/null +++ b/src/it/it0003-jni/pom.xml @@ -0,0 +1,73 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.nar + it-parent + 1.0-SNAPSHOT + ../it-parent/pom.xml + + + it0003-jni + nar + + Maven NAR JNI Test + 1.0-SNAPSHOT + + Simple JNI Library + + http://maven.apache.org/ + + + integration-test + + + maven-nar-plugin + true + + + true + + + + jni + com.mycompany.mypackage + false + + + + + + maven-surefire-plugin + + true + + + + + diff --git a/src/it/it0003-jni/src/main/c/HelloWorldJNI.c b/src/it/it0003-jni/src/main/c/HelloWorldJNI.c new file mode 100644 index 0000000..716722e --- /dev/null +++ b/src/it/it0003-jni/src/main/c/HelloWorldJNI.c @@ -0,0 +1,16 @@ +#include +#include "com_mycompany_mypackage_HelloWorldJNI.h" + +JNIEXPORT jstring JNICALL Java_com_mycompany_mypackage_HelloWorldJNI_sayHello( JNIEnv *env, jobject obj ) { + jstring value; /* the return value */ + + char buf[40]; /* working buffer (really only need 20 ) */ + + + sprintf ( buf, "%s", "Hello NAR World!" ); + + value = (*env)->NewStringUTF( env, buf ); + + return value; +} + diff --git a/src/it/it0003-jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java b/src/it/it0003-jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java new file mode 100644 index 0000000..2af3f3c --- /dev/null +++ b/src/it/it0003-jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java @@ -0,0 +1,15 @@ +package com.mycompany.mypackage; + +public class HelloWorldJNI { + static { + NarSystem.loadLibrary(); + } + + public native String sayHello(); + + public static void main( String[] args ) { + HelloWorldJNI app = new HelloWorldJNI(); + System.out.println( app.sayHello() ); + } +} + diff --git a/src/it/it0003-jni/src/test/java/HelloWorldJNITest.java b/src/it/it0003-jni/src/test/java/HelloWorldJNITest.java new file mode 100644 index 0000000..683c321 --- /dev/null +++ b/src/it/it0003-jni/src/test/java/HelloWorldJNITest.java @@ -0,0 +1,25 @@ +import junit.framework.*; + +import com.mycompany.mypackage.HelloWorldJNI; + +public class HelloWorldJNITest extends TestCase { + + public HelloWorldJNITest(String name) { + super(name); + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testNativeHelloWorldJNI() throws Exception { + HelloWorldJNI app = new HelloWorldJNI(); + + this.assertEquals( "Hello NAR World!", app.sayHello() ); + } +} + diff --git a/src/it/jni/pom.xml b/src/it/jni/pom.xml deleted file mode 100644 index 486ac48..0000000 --- a/src/it/jni/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.maven.its.nar - it-parent - 1.0-SNAPSHOT - ../it-parent/pom.xml - - - jni - nar - - Maven NAR JNI Test - 1.0-SNAPSHOT - - Simple JNI Library - - http://maven.apache.org/ - - - integration-test - - - maven-nar-plugin - true - - - true - - - - jni - com.mycompany.mypackage - false - - - - - - maven-surefire-plugin - - true - - - - - - - junit - junit - 3.8.2 - test - - - diff --git a/src/it/jni/src/main/c/HelloWorldJNI.c b/src/it/jni/src/main/c/HelloWorldJNI.c deleted file mode 100644 index 716722e..0000000 --- a/src/it/jni/src/main/c/HelloWorldJNI.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "com_mycompany_mypackage_HelloWorldJNI.h" - -JNIEXPORT jstring JNICALL Java_com_mycompany_mypackage_HelloWorldJNI_sayHello( JNIEnv *env, jobject obj ) { - jstring value; /* the return value */ - - char buf[40]; /* working buffer (really only need 20 ) */ - - - sprintf ( buf, "%s", "Hello NAR World!" ); - - value = (*env)->NewStringUTF( env, buf ); - - return value; -} - diff --git a/src/it/jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java b/src/it/jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java deleted file mode 100644 index 2af3f3c..0000000 --- a/src/it/jni/src/main/java/com/mycompany/mypackage/HelloWorldJNI.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mycompany.mypackage; - -public class HelloWorldJNI { - static { - NarSystem.loadLibrary(); - } - - public native String sayHello(); - - public static void main( String[] args ) { - HelloWorldJNI app = new HelloWorldJNI(); - System.out.println( app.sayHello() ); - } -} - diff --git a/src/it/jni/src/test/java/HelloWorldJNITest.java b/src/it/jni/src/test/java/HelloWorldJNITest.java deleted file mode 100644 index 683c321..0000000 --- a/src/it/jni/src/test/java/HelloWorldJNITest.java +++ /dev/null @@ -1,25 +0,0 @@ -import junit.framework.*; - -import com.mycompany.mypackage.HelloWorldJNI; - -public class HelloWorldJNITest extends TestCase { - - public HelloWorldJNITest(String name) { - super(name); - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testNativeHelloWorldJNI() throws Exception { - HelloWorldJNI app = new HelloWorldJNI(); - - this.assertEquals( "Hello NAR World!", app.sayHello() ); - } -} - diff --git a/src/site/apt/HelloWorld.apt b/src/site/apt/HelloWorld.apt index 3a11ce5..08138d3 100644 --- a/src/site/apt/HelloWorld.apt +++ b/src/site/apt/HelloWorld.apt @@ -15,13 +15,13 @@ There are also some unit test which are run and call the same method. [executable] A C routine. - [helloworldstaticexe] A C routine statically linked with the C-runtime library. + [executable-static] A C routine statically linked with the C-runtime library. [] [jni] A C routine called from Java and a Java unit test. - [helloworldjnilibjava] A java project which depends on "jni". + [java-dep-jni] A java project which depends on "jni". [helloworldstaticjni] A C routine called from Java statically linked with the C-runtime library and a Java unit test. -- cgit v1.2.3