Commit 0f56087a authored by dfournier's avatar dfournier
Browse files

* Update dependencies and artifact <name> tag in pom.xml

* Move most examples to the Runtime Assembly Factory
* Added some test cases on examples
* Correct composites files (to use classes from helloworld binaries)
parent c234447a
......@@ -31,7 +31,7 @@
<groupId>org.scorware.assembly</groupId>
<artifactId>frascati-af-core</artifactId>
<name>Assembly Factory: Core Factory Module</name>
<name>SCOrWare FraSCAti Assembly Factory: Core Factory Module</name>
<url>http://www.scorware.org</url>
<inceptionYear>2007</inceptionYear>
......
......@@ -18,7 +18,7 @@
<example.main.composite>helloworld.composite</example.main.composite>
</properties>
<name>Assembly Factory Examples: HelloWorld Binary - runtime</name>
<name>SCOrWare FraSCAti Assembly Factory Examples: HelloWorld Binary - runtime</name>
<dependencies>
<dependency>
......
package example.hw;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.scorware.assembly.Factory;
import org.scorware.tinfi.TinfiDomain;
import org.objectweb.fractal.api.Component;
public class HelloWorldBinTestCase {
private Component scaDomain;
private java.lang.Runnable service;
@Before
public void setUp() throws Exception {
scaDomain = Factory.getComposite("helloworld");
service = TinfiDomain.getService(scaDomain,
java.lang.Runnable.class, "r");
}
@Test
public void testInit() {
assertNotNull(scaDomain);
assertNotNull(service);
}
@Test
public void testCall() {
service.run();
}
@After
public void tearDown() throws Exception {
TinfiDomain.close(scaDomain);
}
}
......@@ -13,6 +13,6 @@
<artifactId>helloworld-bin-code</artifactId>
<packaging>jar</packaging>
<name>Assembly Factory Examples: HelloWorld Binary - java</name>
<name>SCOrWare FraSCAti Assembly Factory Examples: HelloWorld Binary - java</name>
</project>
......@@ -13,7 +13,7 @@
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld-bin</artifactId>
<name>Assembly Factory Examples: HelloWorld Binary</name>
<name>SCOrWare FraSCAti Assembly Factory Examples: HelloWorld Binary</name>
<modules>
<module>code</module>
......
......@@ -32,7 +32,7 @@
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld-composite</artifactId>
<packaging>jar</packaging>
<name>Assembly Factory Examples: HelloWorld Composite</name>
<name>SCOrWare FraSCAti Assembly Factory Examples: HelloWorld Composite</name>
<!-- Compile the ${example.main.composite} SCA composite with the SCOrWare Generate Factory.-->
<build>
......@@ -66,7 +66,12 @@
<dependencies>
<dependency>
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld</artifactId>
<artifactId>helloworld-bin-code</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.scorware.assembly</groupId>
<artifactId>frascati-af-runtime</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
......
......@@ -24,7 +24,7 @@
package example.hw;
import org.objectweb.fractal.api.Component;
import org.scorware.assembly.AssemblyFactory;
import org.scorware.assembly.Factory;
import org.scorware.tinfi.TinfiDomain;
public class ClientComposite {
......@@ -35,7 +35,7 @@ public class ClientComposite {
System.out.println("\n\n\nStarting The Helloworld Composite Example \n");
scaDomain = AssemblyFactory.getComposite("helloworldAssembly");
scaDomain = Factory.getComposite("helloworldAssembly");
java.lang.Runnable hello = TinfiDomain.getService(scaDomain,
java.lang.Runnable.class, "r");
......
......@@ -32,7 +32,7 @@
<service name="r">
<interface.java interface="java.lang.Runnable" />
</service>
<reference name="s" target="helloworldserver/s" >
<reference name="printService" target="helloworldserver/s" >
<interface.java interface="example.hw.Service" />
</reference>
<implementation.java class="example.hw.ClientImpl" />
......
package example.hw;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.scorware.assembly.Factory;
import org.scorware.tinfi.TinfiDomain;
import org.objectweb.fractal.api.Component;
public class HelloWorldCompositeTestCase {
private Component scaDomain;
private java.lang.Runnable service;
@Before
public void setUp() throws Exception {
scaDomain = Factory.getComposite("helloworldAssembly.composite");
service = TinfiDomain.getService(scaDomain,
java.lang.Runnable.class, "r");
}
@Test
public void testInit() {
assertNotNull(scaDomain);
assertNotNull(service);
}
@Test
public void testCall() {
service.run();
}
@After
public void tearDown() throws Exception {
TinfiDomain.close(scaDomain);
}
}
......@@ -32,7 +32,7 @@
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld-include</artifactId>
<packaging>jar</packaging>
<name>Assembly Factory Examples: HelloWorld Include</name>
<name>SCOrWare FraSCAti Assembly Factory Examples: HelloWorld Include</name>
<!-- Compile the ${example.main.composite} SCA composite with the SCOrWare Generate Factory.-->
<build>
......@@ -62,5 +62,18 @@
<example.main.composite>helloworld</example.main.composite>
<example.main.class>example.hw.Client</example.main.class>
</properties>
<dependencies>
<dependency>
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld-bin-code</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.scorware.assembly</groupId>
<artifactId>frascati-af-runtime</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
......@@ -24,7 +24,7 @@
package example.hw;
import org.objectweb.fractal.api.Component;
import org.scorware.assembly.AssemblyFactory;
import org.scorware.assembly.Factory;
import org.scorware.tinfi.TinfiDomain;
public class Client {
......@@ -35,7 +35,7 @@ public class Client {
System.out.println("\n\n\nStarting The Helloworld Example \n");
scaDomain = AssemblyFactory.getComposite("helloworld");
scaDomain = Factory.getComposite("helloworld");
java.lang.Runnable hello = TinfiDomain.getService(scaDomain,
java.lang.Runnable.class, "r");
......
package example.hw;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Reference;
public class ClientImpl implements Runnable {
public ClientImpl() {
System.err.println("CLIENT created");
}
@Init
public void init() {
System.err.println("CLIENT initialized");
}
public void run() {
s.print("hello world");
}
@Reference
public Service s;
}
\ No newline at end of file
package example.hw;
import org.osoa.sca.annotations.Property;
public class ServerImpl implements Service {
private String header = "->";
private int count = 1;
public ServerImpl() {
System.err.println("SERVER created");
}
public void print(final String msg) {
new Exception() {
private static final long serialVersionUID = 2182742162070453637L;
public String toString() {
return "Server: print method called";
}
}.printStackTrace();
System.err.println("Server: begin printing...");
for (int i = 0 ; i < (count) ; ++i) {
System.err.println(((header) + msg));
}
System.err.println("Server: print done.");
}
public String getHeader() {
return header;
}
@Property
public void setHeader(final String header) {
this.header = header;
}
public int getCount() {
return count;
}
@Property
public void setCount(final int count) {
this.count = count;
}
}
\ No newline at end of file
package example.hw;
public interface Service {
void print(String msg);
}
\ No newline at end of file
......@@ -26,7 +26,7 @@
<service name="r">
<interface.java interface="java.lang.Runnable"/>
</service>
<reference name="s" target="server/s">
<reference name="printService" target="server/s">
<interface.java interface="example.hw.Service"/>
</reference>
</component>
......
package example.hw;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.scorware.assembly.Factory;
import org.scorware.tinfi.TinfiDomain;
import org.objectweb.fractal.api.Component;
public class HelloWorldIncludeTestCase {
private Component scaDomain;
private java.lang.Runnable service;
@Before
public void setUp() throws Exception {
scaDomain = Factory.getComposite("helloworld.composite");
service = TinfiDomain.getService(scaDomain,
java.lang.Runnable.class, "r");
}
@Test
public void testInit() {
assertNotNull(scaDomain);
assertNotNull(service);
}
@Test
public void testCall() {
service.run();
}
@After
public void tearDown() throws Exception {
TinfiDomain.close(scaDomain);
}
}
......@@ -32,7 +32,7 @@
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld-property</artifactId>
<packaging>jar</packaging>
<name>Assembly Factory Examples: HelloWorld with Property</name>
<name>SCOrWare FraSCAti Assembly Factory Examples: HelloWorld with Property</name>
<properties>
<example.main.composite>helloworldProperty</example.main.composite>
......@@ -49,57 +49,73 @@
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.scorware.assembly.examples</groupId>
<artifactId>helloworld-bin-code</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.scorware.assembly</groupId>
<artifactId>frascati-af-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<!--
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
</dependency>
</dependency>
-->
</dependencies>
<build>
<!-- <build>
<plugins>
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<extension>true</extension>
</configuration>
</plugin>
<plugin>
<groupId>org.scorware.assembly</groupId>
<artifactId>frascati-af-generate</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>generate-factory</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<srcs>src/main/java src/main/resources /target/generated-sources/xjc</srcs>
<composite>${example.main.composite}</composite>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
</configuration>
</plugin>
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<extension>true</extension>
</configuration>
</plugin>
<plugin>
<groupId>org.scorware.assembly</groupId>
<artifactId>frascati-af-generate</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>generate-factory</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<srcs>src/main/java src/main/resources /target/generated-sources/xjc</srcs>
<composite>${example.main.composite}</composite>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
</configuration>
</plugin>
</plugins>
</build>
</build> -->
</project>
package example.hw;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Reference;
public class ClientImpl implements Runnable {
public ClientImpl() {
System.err.println("CLIENT created");
}
@Init
public void init() {
System.err.println("CLIENT initialized");
}
public void run() {
s.print("hello world");
}
@Reference
public Service s;
}
\ No newline at end of file
......@@ -24,7 +24,7 @@
package example.hw;
import org.objectweb.fractal.api.Component;
import org.scorware.assembly.AssemblyFactory;
import org.scorware.assembly.Factory;
import org.scorware.tinfi.TinfiDomain;
public class ClientProperty {
......@@ -35,7 +35,7 @@ public class ClientProperty {
System.out.println("\n\n\nStarting The Helloworld Example \n");
scaDomain = AssemblyFactory.getComposite("helloworldProperty");
scaDomain = Factory.getComposite("helloworldProperty");
java.lang.Runnable hello = TinfiDomain.getService(scaDomain,
java.lang.Runnable.class, "r");
......
package example.hw;
import org.osoa.sca.annotations.Property;
public class ServerImpl implements Service {
public String header;
private int count = 1;
public ServerImpl() {
System.err.println("SERVER created");
}
public void print(final String msg) {
new Exception() {
private static final long serialVersionUID = 2182742162070453637L;
public String toString() {
return "Server: print method called";
}
}.printStackTrace();
System.err.println("Server: begin printing...");
for (int i = 0 ; i < (count) ; ++i) {
System.err.println(header + msg);
}
System.err.println("Server: print done.");
}
public String getHeader() {
return header;
}
@Property
public void setHeader(final String header) {
this.header = header;
}
public int getCount() {
return count;
}
@Property
public void setCount(final int count) {
this.count = count;
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!