Commit 3f17e2d3 authored by Lionel Seinturier's avatar Lionel Seinturier

Updating copyright info for 2010.

parent 5718f6d7
============================================================================
OW2 FraSCAti Tinfi
Copyright (C) 2007-2009 INRIA, USTL
Copyright (C) 2007-2010 INRIA, USTL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......
============================================================================
OW2 FraSCAti Tinfi
Copyright (C) 2007-2009 INRIA, USTL
Copyright (C) 2007-2010 INRIA, USTL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -199,4 +199,4 @@ To run the conformance tests, type:
For any question, please contact: Lionel.Seinturier@univ-lille1.fr
Date of creation of this file: June 24, 2007.
Last modified: January 15, 2010.
Last modified: January 19, 2010.
============================================================================
OW2 FraSCAti Tinfi
Copyright (C) 2007-2009 INRIA, USTL
Copyright (C) 2007-2010 INRIA, USTL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2008-2009 INRIA, USTL
*
* 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: Lionel Seinturier
*/
package example.hw;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import junit.framework.TestCase;
import org.junit.Test;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.ow2.frascati.tinfi.TinfiDomain;
/**
* Automate the launching of the HelloWorld example and check that the example
* runs as expected.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 0.2
*/
public class HelloWorldTestCase extends TestCase {
@Test
public void testHelloWorld()
throws
IOException, IllegalArgumentException, ClassNotFoundException,
InstantiationException, IllegalAccessException,
java.lang.InstantiationException, InstantiationException,
IllegalLifeCycleException, NoSuchInterfaceException {
/*
* Use the Console class to direct the output of the example to a
* temporary file.
*/
File tmp = File.createTempFile("helloworld-bin-",".txt");
PrintStream ps = new PrintStream(tmp);
Console.ps = ps;
Runnable r = TinfiDomain.getService("example.hw.HelloWorld",Runnable.class,"r");
r.run();
ps.close();
/*
* Dump the content of the temporay file to the console for visual
* check.
*/
FileReader fr = new FileReader(tmp);
int b;
while( (b=fr.read()) != -1 ) {
char c = (char) b;
System.err.print(c);
}
fr.close();
File tmpExpected = File.createTempFile("helloworld-bin-",".txt");
ps = new PrintStream(tmpExpected);
for (String expected : expecteds) {
ps.println(expected);
}
ps.close();
/*
* Compare the output with the expected result.
*/
fr = new FileReader(tmp);
FileReader frExpected = new FileReader(tmpExpected);
int i=0,line=1,col=1;
while( (b=fr.read()) != -1 ) {
char c = (char) b;
char e = (char) frExpected.read();
if( c != e ) {
String msg = "Unexpected character at line "+line+", column "+col;
System.err.println();
System.err.println("Expected output is: ");
for (String expected : expecteds) {
System.err.println(expected);
}
fail(msg);
}
i++;
if( c == '\n' ) {
line++;
col=1;
}
else {
col++;
}
}
frExpected.close();
fr.close();
/*
* Delete temporary files.
*/
tmp.delete();
tmpExpected.delete();
}
final static private String[] expecteds =
new String[]{
"CLIENT created",
"CLIENT initialized",
"SERVER created",
"Server: begin printing...",
"->hello world",
"Server: print done.",
};
}
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2008-2010 INRIA, USTL
*
* 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: Lionel Seinturier
*/
package example.hw;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import junit.framework.TestCase;
import org.junit.Test;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.ow2.frascati.tinfi.TinfiDomain;
/**
* Automate the launching of the HelloWorld example and check that the example
* runs as expected.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 0.2
*/
public class HelloWorldTestCase extends TestCase {
@Test
public void testHelloWorld()
throws
IOException, IllegalArgumentException, ClassNotFoundException,
InstantiationException, IllegalAccessException,
java.lang.InstantiationException, InstantiationException,
IllegalLifeCycleException, NoSuchInterfaceException {
/*
* Use the Console class to direct the output of the example to a
* temporary file.
*/
File tmp = File.createTempFile("helloworld-bin-",".txt");
PrintStream ps = new PrintStream(tmp);
Console.ps = ps;
Runnable r = TinfiDomain.getService("example.hw.HelloWorld",Runnable.class,"r");
r.run();
ps.close();
/*
* Dump the content of the temporay file to the console for visual
* check.
*/
FileReader fr = new FileReader(tmp);
int b;
while( (b=fr.read()) != -1 ) {
char c = (char) b;
System.err.print(c);
}
fr.close();
File tmpExpected = File.createTempFile("helloworld-bin-",".txt");
ps = new PrintStream(tmpExpected);
for (String expected : expecteds) {
ps.println(expected);
}
ps.close();
/*
* Compare the output with the expected result.
*/
fr = new FileReader(tmp);
FileReader frExpected = new FileReader(tmpExpected);
int i=0,line=1,col=1;
while( (b=fr.read()) != -1 ) {
char c = (char) b;
char e = (char) frExpected.read();
if( c != e ) {
String msg = "Unexpected character at line "+line+", column "+col;
System.err.println();
System.err.println("Expected output is: ");
for (String expected : expecteds) {
System.err.println(expected);
}
fail(msg);
}
i++;
if( c == '\n' ) {
line++;
col=1;
}
else {
col++;
}
}
frExpected.close();
fr.close();
/*
* Delete temporary files.
*/
tmp.delete();
tmpExpected.delete();
}
final static private String[] expecteds =
new String[]{
"CLIENT created",
"CLIENT initialized",
"SERVER created",
"Server: begin printing...",
"->hello world",
"Server: print done.",
};
}
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2009 INRIA, USTL
*
* 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: Lionel Seinturier
*/
package example.hw;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.juliac.osgi.OSGiHelper;
import org.osgi.framework.BundleException;
import org.ow2.frascati.tinfi.TinfiDomain;
import example.hw.itf.Console;
/**
* Automate the launching of the HelloWorld example and check that the example
* runs as expected.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 0.4.5
*/
public class HelloWorldTestCase {
private Component root;
@Before
public void setUp()
throws
ClassNotFoundException, InstantiationException, IllegalAccessException,
IllegalLifeCycleException, NoSuchInterfaceException,
java.lang.InstantiationException {
// Instanciate the HelloWorld composite
root = TinfiDomain.getComponent("example.hw.HelloWorld");
}
@After
public void tearDown() throws BundleException, IOException {
OSGiHelper.getPlatform().stop();
}
@Test
public void serverHelloWorld() throws NoSuchInterfaceException {
/*
* Use the Console class to direct the output of the example to a
* temporary file.
*/
Console.init(
System.err,
new String[]{
"Server: begin printing...",
"->hello world",
"Server: print done.",
});
/*
* Run the test.
*/
Runnable r = (Runnable) root.getFcInterface("r");
r.run();
}
}
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2009-2010 INRIA, USTL
*
* 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: Lionel Seinturier
*/
package example.hw;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.juliac.osgi.OSGiHelper;
import org.osgi.framework.BundleException;
import org.ow2.frascati.tinfi.TinfiDomain;
import example.hw.itf.Console;
/**
* Automate the launching of the HelloWorld example and check that the example
* runs as expected.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 0.4.5
*/
public class HelloWorldTestCase {
private Component root;
@Before
public void setUp()
throws
ClassNotFoundException, InstantiationException, IllegalAccessException,
IllegalLifeCycleException, NoSuchInterfaceException,
java.lang.InstantiationException {
// Instanciate the HelloWorld composite
root = TinfiDomain.getComponent("example.hw.HelloWorld");
}
@After
public void tearDown() throws BundleException, IOException {
OSGiHelper.getPlatform().stop();
}
@Test
public void serverHelloWorld() throws NoSuchInterfaceException {
/*
* Use the Console class to direct the output of the example to a
* temporary file.
*/
Console.init(
System.err,
new String[]{
"Server: begin printing...",
"->hello world",
"Server: print done.",
});
/*
* Run the test.
*/
Runnable r = (Runnable) root.getFcInterface("r");
r.run();
}
}
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2008-2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or