Commit 1bb031ec authored by Philippe Merle's avatar Philippe Merle

* Added University of Lille 1 into headers.

* Cosmetic updates.
parent f36a5700
/***
/**
* OW2 FraSCAti : Benchmark components implementation
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -21,11 +21,9 @@
* Author: Damien Fournier
*/
package org.ow2.frascati.examples.bench;
public interface Service {
public void call();
public interface Service
{
void call();
}
/***
/**
* OW2 FraSCAti : Benchmark components implementation
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -21,7 +21,6 @@
* Author: Damien Fournier
*/
package org.ow2.frascati.examples.bench;
import java.util.List;
......@@ -29,18 +28,15 @@ import java.util.List;
import org.osoa.sca.annotations.Reference;
@org.osoa.sca.annotations.Service(Service.class)
public class ServiceComponent implements Service {
public class ServiceComponent implements Service
{
@Reference(required = false)
public List<Service> ref;
public void call() {
public void call()
{
for (Service s : ref) {
if (s !=null) s.call();
}
}
}
}
/***
/**
* OW2 FraSCAti : Benchmark components implementation
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -21,11 +21,9 @@
* Author: Damien Fournier
*/
package org.ow2.frascati.examples.bench;
public interface Service {
public void call();
public interface Service
{
void call();
}
/***
/**
* OW2 FraSCAti : Benchmark components implementation
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -21,7 +21,6 @@
* Author: Damien Fournier
*/
package org.ow2.frascati.examples.bench;
import java.util.List;
......@@ -29,18 +28,15 @@ import java.util.List;
import org.oasisopen.sca.annotation.Reference;
@org.oasisopen.sca.annotation.Service(Service.class)
public class ServiceComponent implements Service {
public class ServiceComponent implements Service
{
@Reference(required = false)
public List<Service> ref;
public void call() {
public void call()
{
for (Service s : ref) {
if (s !=null) s.call();
}
}
}
}
/***
/**
* OW2 FraSCAti : Chain composite generator for bench mojo
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -29,10 +29,10 @@ import java.io.IOException;
import org.apache.maven.project.MavenProject;
public class ChainGenerator {
public static void generate(SCABenchGenerator generator) throws IOException {
public class ChainGenerator
{
public static void generate(SCABenchGenerator generator) throws IOException
{
// Maven Project
MavenProject project = generator.getProject();
......@@ -82,6 +82,5 @@ public class ChainGenerator {
outputStream.write(end.getBytes());
outputStream.flush();
outputStream.close();
}
}
/***
/**
* OW2 FraSCAti : Pool composite generator for bench mojo
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -29,10 +29,10 @@ import java.io.IOException;
import org.apache.maven.project.MavenProject;
public class PoolGenerator {
public static void generate(SCABenchGenerator generator) throws IOException {
public class PoolGenerator
{
public static void generate(SCABenchGenerator generator) throws IOException
{
// Maven Project
MavenProject project = generator.getProject();
......@@ -87,6 +87,5 @@ public class PoolGenerator {
outputStream.write(end.getBytes());
outputStream.flush();
outputStream.close();
}
}
/***
/**
* OW2 FraSCAti : Maven mojo to generate SCA composite for benchmarking
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -39,8 +39,8 @@ import org.apache.maven.project.MavenProject;
* @since 1.1
*/
public class SCABenchGenerator extends AbstractMojo {
public class SCABenchGenerator extends AbstractMojo
{
/**
* Name for the resulting composite file
*
......@@ -82,8 +82,8 @@ public class SCABenchGenerator extends AbstractMojo {
*/
private MavenProject project;
public void execute() throws MojoExecutionException, MojoFailureException {
public void execute() throws MojoExecutionException, MojoFailureException
{
try {
if (type.equalsIgnoreCase("chain")) {
ChainGenerator.generate(this);
......@@ -103,7 +103,6 @@ public class SCABenchGenerator extends AbstractMojo {
} catch (IOException e) {
getLog().error(e.getMessage());
}
}
/**
......@@ -111,7 +110,8 @@ public class SCABenchGenerator extends AbstractMojo {
*
* @since 1.3
*/
protected String getName() {
protected String getName()
{
return name;
}
......@@ -120,7 +120,8 @@ public class SCABenchGenerator extends AbstractMojo {
*
* @since 1.3
*/
protected MavenProject getProject() {
protected MavenProject getProject()
{
return project;
}
......@@ -129,7 +130,8 @@ public class SCABenchGenerator extends AbstractMojo {
*
* @since 1.3
*/
protected int getSize() {
protected int getSize()
{
return size;
}
......@@ -138,8 +140,8 @@ public class SCABenchGenerator extends AbstractMojo {
*
* @since 1.3
*/
protected String getNamespace() {
protected String getNamespace()
{
return namespace;
}
}
/***
/**
* OW2 FraSCAti : Tree composite generator for bench mojo
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -29,8 +29,8 @@ import java.io.IOException;
import java.io.OutputStream;
import org.apache.maven.project.MavenProject;
public class TreeGenerator {
public class TreeGenerator
{
private static void leaf(int current, int max, OutputStream outputStream)
throws IOException {
if (current < max) {
......@@ -63,8 +63,8 @@ public class TreeGenerator {
}
public static void generate(SCABenchGenerator generator) throws IOException {
public static void generate(SCABenchGenerator generator) throws IOException
{
// Maven Project
MavenProject project = generator.getProject();
......@@ -103,6 +103,5 @@ public class TreeGenerator {
outputStream.write(end.getBytes());
outputStream.flush();
outputStream.close();
}
}
/***
/**
* OW2 FraSCAti : Benchmark test for FraSCAti Runtime
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -33,8 +33,8 @@ import org.objectweb.fractal.api.Component;
import org.ow2.frascati.FraSCAti;
import org.ow2.frascati.examples.bench.Service;
public class FrascatiTestCase {
public class FrascatiTestCase
{
private Component scaDomain;
private Service service;
......@@ -47,8 +47,8 @@ public class FrascatiTestCase {
long end;
@Before
public void setUp() throws Exception {
public void setUp() throws Exception
{
Logger.getLogger("org.ow2.frascati").setLevel(Level.OFF);
// Warmup
......@@ -58,7 +58,8 @@ public class FrascatiTestCase {
}
@Test
public void testCall() throws Exception {
public void testCall() throws Exception
{
// Start Test
startRuntime = System.nanoTime();
FraSCAti frascati = FraSCAti.newFraSCAti();
......@@ -76,18 +77,15 @@ public class FrascatiTestCase {
frascati.close(scaDomain);
end = System.nanoTime();
}
@After
public void tearDown() throws Exception {
public void tearDown() throws Exception
{
System.out.println("\n######## Test Results ########");
System.out.println("Time taken for creating runtime instance : " + (endRuntime - startRuntime) * 1E-6 + " ms");
System.out.println("Time taken for creating composite instance : " + (endLoadingComposite - startLoadingComposite) * 1E-6 + " ms");
System.out.println("Time taken for calling composite service interface : " + (endCall - startCall) * 1E-6 + " ms");
System.out.println("Total time taken for running with Tuscany Runtime : " + (end - startRuntime) * 1E-6 + " ms\n");
}
}
/***
/**
* OW2 FraSCAti : Benchmark test for Tuscany Runtime
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -31,8 +31,8 @@ import org.junit.Before;
import org.junit.Test;
import org.ow2.frascati.examples.bench.Service;
public class TuscanyTestCase {
public class TuscanyTestCase
{
private Service service;
private SCANode node;
private SCANodeFactory factory;
......@@ -46,31 +46,29 @@ public class TuscanyTestCase {
long end;
@Before
public void setUp() throws Exception {
public void setUp() throws Exception
{
// Warmup
factory = SCANodeFactory.newInstance();
node = factory.createSCANodeFromClassLoader("BenchMark.composite",
getClass().getClassLoader());
node.start();
node.stop();
}
@After
public void tearDown() throws Exception {
public void tearDown() throws Exception
{
System.out.println("\n######## Test Results ########");
System.out.println("Time taken for creating runtime instance : " + (endRuntime - startRuntime) * 1E-6 + " ms");
System.out.println("Time taken for creating composite instance : " + (endLoadingComposite - startLoadingComposite) * 1E-6 + " ms");
System.out.println("Time taken for calling composite service interface : " + (endCall - startCall) * 1E-6 + " ms");
System.out.println("Total time taken for running with Tuscany Runtime : " + (end - startRuntime) * 1E-6 + " ms\n");
}
@Test
public void testCall() {
public void testCall()
{
// Start Test
startRuntime = System.nanoTime();
factory = SCANodeFactory.newInstance();
......@@ -90,7 +88,5 @@ public class TuscanyTestCase {
node.stop();
end = System.nanoTime();
}
}
/***
/**
* OW2 FraSCAti : Benchmark test for Tuscany Runtime
* Copyright (C) 2009-2010 INRIA
* Copyright (C) 2009-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
......@@ -33,8 +33,8 @@ import org.junit.Before;
import org.junit.Test;
import org.ow2.frascati.examples.bench.Service;
public class TuscanyTestCase {
public class TuscanyTestCase
{
private Service service;
private Node node;
private NodeFactory factory;
......@@ -48,8 +48,8 @@ public class TuscanyTestCase {
long end;
@Before
public void setUp() throws Exception {
public void setUp() throws Exception
{
// Warmup
factory = NodeFactory.newInstance();
String contribution = ContributionLocationHelper.getContributionLocation(Service.class);
......@@ -58,23 +58,21 @@ public class TuscanyTestCase {
node = factory.createNode("BenchMark.composite", getClass().getClassLoader());
node.start();
node.stop();
}
@After
public void tearDown() throws Exception {
public void tearDown() throws Exception
{
System.out.println("\n######## Test Results ########");
System.out.println("Time taken for creating runtime instance : " + (endRuntime - startRuntime) * 1E-6 + " ms");
System.out.println("Time taken for creating composite instance : " + (endLoadingComposite - startLoadingComposite) * 1E-6 + " ms");
System.out.println("Time taken for calling composite service interface : " + (endCall - startCall) * 1E-6 + " ms");
System.out.println("Total time taken for running with Tuscany Runtime : " + (end - startRuntime) * 1E-6 + " ms\n");
}
@Test
public void testCall() {
public void testCall()
{
// Start Test
startRuntime = System.nanoTime();
factory = NodeFactory.newInstance();
......@@ -94,8 +92,5 @@ public class TuscanyTestCase {
node.stop();
end = System.nanoTime();
}
}
Markdown is supported
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