Commit cee2955d authored by Philippe Merle's avatar Philippe Merle
Browse files

Added support for Windows. Thanks to Guillaume from SADT for pointing this issue out.

* Split helloworld-jna.composite into two SCA composites one for Unix another for Windows.
* Updated the Java test case to choice the SCA composite to load according to the Java system property "os.name".
* Updated pom.xml to choice the SCA composite to run according to <os><family>.
parent d163ee2f
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: HelloWorld POJO
* OW2 FraSCAti Examples: HelloWorld with JNA binding
*
* Copyright (c) 2010 INRIA, University of Lille 1
*
......@@ -22,7 +22,7 @@
*
* Author: Romain Rouvoy
*
* Contributor(s):
* Contributor(s): Philippe Merle
-->
<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/maven-v4_0_0.xsd">
......@@ -48,9 +48,34 @@
<properties>
<logging.conf.file>../../../distribution/standalone/src/main/conf/logging.properties</logging.conf.file>
<composite.file>helloworld-jna</composite.file>
<service.name>r</service.name>
<method.name>run</method.name>
</properties>
<profiles>
<profile>
<id>Unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<composite.file>helloworld-jna</composite.file>
</properties>
</profile>
<profile>
<id>Windows</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<properties>
<composite.file>helloworld-jna-windows</composite.file>
</properties>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- OW2 FraSCAti Examples: HelloWorld with JNA binding -->
<!-- Copyright (C) 2010 INRIA, University of Lille 1 -->
<!-- -->
<!-- This library is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU Lesser General Public -->
<!-- License as published by the Free Software Foundation; either -->
<!-- version 2 of the License, or (at your option) any later version. -->
<!-- -->
<!-- This library is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -->
<!-- Lesser General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU Lesser General Public -->
<!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Romain Rouvoy -->
<!-- -->
<!-- Contributor(s): Philippe Merle -->
<composite name="helloworld-jna" xmlns="http://www.osoa.org/xmlns/sca/1.0">
<service name="r" promote="client/run"/>
<component name="client" xmlns:native="http://frascati.ow2.org/xmlns/native/1.0">
<implementation.java class="jna.hw.Client"/>
<service name="run">
<interface.java interface="java.lang.Runnable"/>
</service>
<reference name="service">
<interface.java interface="jna.hw.Service"/>
<native:binding.jna library="msvcrt"/> <!-- for Windows. -->
</reference>
</component>
</composite>
......@@ -20,7 +20,7 @@
<!-- -->
<!-- Author: Romain Rouvoy -->
<!-- -->
<!-- Contributor(s): -->
<!-- Contributor(s): Philippe Merle -->
<composite name="helloworld-jna" xmlns="http://www.osoa.org/xmlns/sca/1.0">
<service name="r" promote="client/run"/>
......@@ -34,8 +34,7 @@
<reference name="service">
<interface.java interface="jna.hw.Service"/>
<native:binding.jna library="c"/> <!-- for Linux and Mac OS X -->
<!-- <native:binding.jna library="msvcrt"/> for Windows -->
<native:binding.jna library="c"/> <!-- for Linux and Mac OS X. -->
</reference>
</component>
......
......@@ -36,7 +36,14 @@ public class HelloWorldJNATestCase extends FraSCAtiTestCase {
@Override
public String getComposite() {
return "helloworld-jna";
String composite ="helloworld-jna";
String osName = System.getProperty("os.name");
if(osName.startsWith("Windows")) {
composite += "-windows";
}
return composite;
}
@Test
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment