From 1b3f5eb617863b4d4c2e1c29b48a1efba2bdf5ff Mon Sep 17 00:00:00 2001 From: Mark Donszelmann <Mark.Donszelmann@gmail.com> Date: Sat, 3 Oct 2009 14:53:01 +0200 Subject: Added test 3 --- 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 ------- 15 files changed, 297 insertions(+), 216 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 (limited to 'src/it') 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 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven.its.nar</groupId> - <artifactId>it-parent</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../it-parent/pom.xml</relativePath> - </parent> - - <artifactId>executable</artifactId> - <packaging>nar</packaging> - - <name>Maven NAR Executable Test</name> - <version>1.0-SNAPSHOT</version> - <description> - Simple test executable - </description> - <url>http://maven.apache.org/</url> - -<!-- - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> ---> - - <build> - <defaultGoal>integration-test</defaultGoal> - <plugins> - <plugin> - <artifactId>maven-nar-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <libraries> - <library> - <type>executable</type> - <run>true</run> - </library> - </libraries> - </configuration> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - </build> -</project> 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 <stdio.h> - -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. </snapshots> </repository> </repositories> + <pluginRepositories> <pluginRepository> <id>local.central</id> @@ -55,4 +56,13 @@ under the License. </snapshots> </pluginRepository> </pluginRepositories> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> </project> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.its.nar</groupId> + <artifactId>it-parent</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../it-parent/pom.xml</relativePath> + </parent> + + <artifactId>it0001-executable</artifactId> + <packaging>nar</packaging> + + <name>Maven NAR Executable Test</name> + <version>1.0-SNAPSHOT</version> + <description> + Simple test executable + </description> + <url>http://maven.apache.org/</url> + +<!-- + <properties> + <maven.test.skip>true</maven.test.skip> + </properties> +--> + + <build> + <defaultGoal>integration-test</defaultGoal> + <plugins> + <plugin> + <artifactId>maven-nar-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <libraries> + <library> + <type>executable</type> + <run>true</run> + </library> + </libraries> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> +</project> 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 <stdio.h> + +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 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.its.nar</groupId> + <artifactId>it-parent</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../it-parent/pom.xml</relativePath> + </parent> + + <artifactId>it0002-executable-static</artifactId> + <packaging>nar</packaging> + + <name>Maven NAR Static Executable Test</name> + <version>1.0-SNAPSHOT</version> + <description> + Simple executable statically linked with the c runtime + </description> + +<!-- + <properties> + <maven.test.skip>true</maven.test.skip> + </properties> +--> + + <build> + <defaultGoal>integration-test</defaultGoal> + <plugins> + <plugin> + <artifactId>maven-nar-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <runtime>static</runtime> + <libraries> + <library> + <type>executable</type> + <run>true</run> + </library> + </libraries> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> +</project> 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 <stdio.h> + +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 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.its.nar</groupId> + <artifactId>it-parent</artifactId> + <version>1.0-SNAPSHOT</version> + <relativePath>../it-parent/pom.xml</relativePath> + </parent> + + <artifactId>it0003-jni</artifactId> + <packaging>nar</packaging> + + <name>Maven NAR JNI Test</name> + <version>1.0-SNAPSHOT</version> + <description> + Simple JNI Library + </description> + <url>http://maven.apache.org/</url> +<!-- + <properties> + <maven.test.skip>true</maven.test.skip> + </properties> +--> + <build> + <defaultGoal>integration-test</defaultGoal> + <plugins> + <plugin> + <artifactId>maven-nar-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <cpp> + <debug>true</debug> + </cpp> + <libraries> + <library> + <type>jni</type> + <narSystemPackage>com.mycompany.mypackage</narSystemPackage> + <linkCPP>false</linkCPP> + </library> + </libraries> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> +</project> 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 <stdio.h> +#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 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you 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. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven.its.nar</groupId> - <artifactId>it-parent</artifactId> - <version>1.0-SNAPSHOT</version> - <relativePath>../it-parent/pom.xml</relativePath> - </parent> - - <artifactId>jni</artifactId> - <packaging>nar</packaging> - - <name>Maven NAR JNI Test</name> - <version>1.0-SNAPSHOT</version> - <description> - Simple JNI Library - </description> - <url>http://maven.apache.org/</url> -<!-- - <properties> - <maven.test.skip>true</maven.test.skip> - </properties> ---> - <build> - <defaultGoal>integration-test</defaultGoal> - <plugins> - <plugin> - <artifactId>maven-nar-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <cpp> - <debug>true</debug> - </cpp> - <libraries> - <library> - <type>jni</type> - <narSystemPackage>com.mycompany.mypackage</narSystemPackage> - <linkCPP>false</linkCPP> - </library> - </libraries> - </configuration> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> 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 <stdio.h> -#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() ); - } -} - -- cgit v1.2.3