Commit f2178f22 authored by legoc's avatar legoc

Renamed simple test

parent 472d025a
......@@ -26,6 +26,16 @@ find_package(cameo 1.1.0 REQUIRED)
# Tests
add_executable(simple src/tests/Simple.cpp)
target_link_libraries(simple PUBLIC cameo zmq)
add_executable(testsimple src/tests/TestSimple.cpp)
target_link_libraries(testsimple PUBLIC cameo zmq)
add_executable(openport src/tests/OpenPort.cpp)
target_link_libraries(openport PUBLIC cameo zmq)
......@@ -35,8 +45,6 @@ target_link_libraries(testcameo PUBLIC cameo zmq)
add_executable(testveryfast src/tests/TestVeryFast.cpp)
target_link_libraries(testveryfast PUBLIC cameo zmq)
add_executable(testsimple src/tests/TestSimpleApplication.cpp)
target_link_libraries(testsimple PUBLIC cameo zmq)
add_executable(testbadendpoint src/tests/TestBadEndpoint.cpp)
target_link_libraries(testbadendpoint PUBLIC cameo zmq)
......@@ -77,9 +85,6 @@ target_link_libraries(teststop PUBLIC cameo zmq)
add_executable(teststartwithstop src/tests/TestStartWithStopApplication.cpp)
target_link_libraries(teststartwithstop PUBLIC cameo zmq)
add_executable(teststartwithsimple src/tests/TestStartWithSimpleApplication.cpp)
target_link_libraries(teststartwithsimple PUBLIC cameo zmq)
add_executable(teststartwithveryfast src/tests/TestStartWithVeryFastApplication.cpp)
target_link_libraries(teststartwithveryfast PUBLIC cameo zmq)
......
......@@ -75,16 +75,16 @@ public class TestSelector {
outputThread.start();
}
System.out.println("starting application");
System.out.println("Starting application");
int result = instance.waitFor();
System.out.println("finished application");
System.out.println("Finished application");
// Terminate the thread and the server.
if (streamSocket != null) {
outputThread.waitFor();
}
} else {
System.out.println("no application");
System.out.println("No application");
}
}
......@@ -132,7 +132,7 @@ public class TestSelector {
appName = args[argsIndex];
if (appName.equals("all")) {
apps.add("startsimplejava");
apps.add("testsimplejava");
apps.add("startveryfastjava");
apps.add("startstopjava");
apps.add("startresjava");
......@@ -144,7 +144,7 @@ public class TestSelector {
apps.add("startreqjava");
apps.add("canceljava");
apps.add("startsimplecpp");
apps.add("testsimplecpp");
apps.add("startveryfastcpp");
apps.add("startstopcpp");
apps.add("startrescpp");
......@@ -154,9 +154,11 @@ public class TestSelector {
apps.add("startnpubcpp");
apps.add("startrepcpp");
apps.add("cancelcpp");
apps.add("testsimplepy");
}
else if (appName.equals("java")) {
apps.add("startsimplejava");
apps.add("testsimplejava");
apps.add("startveryfastjava");
apps.add("startstopjava");
apps.add("startresjava");
......@@ -169,7 +171,7 @@ public class TestSelector {
apps.add("canceljava");
}
else if (appName.equals("cpp")) {
apps.add("startsimplecpp");
apps.add("testsimplecpp");
apps.add("startveryfastcpp");
apps.add("startstopcpp");
apps.add("startrescpp");
......@@ -180,6 +182,9 @@ public class TestSelector {
apps.add("startrepcpp");
apps.add("cancelcpp");
}
else if (appName.equals("python")) {
apps.add("testsimplepy");
}
else {
apps.add(appName);
}
......
......@@ -19,20 +19,13 @@ package fr.ill.ics.cameo.test;
import fr.ill.ics.cameo.Application;
public class TestSimpleApplication {
public class Simple {
public static void main(String[] args) {
Application.This.init(args);
if (Application.This.isAvailable()) {
System.out.println("connected");
} else {
System.exit(-1);
}
System.out.println("finished the application");
System.out.println("Finished the application");
Application.This.terminate();
}
......
......@@ -22,7 +22,7 @@ import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.Server;
public class TestStartWithSimpleApplication {
public class TestSimple {
public static void main(String[] args) {
......@@ -35,12 +35,6 @@ public class TestStartWithSimpleApplication {
Server server = Application.This.getServer();
if (Application.This.isAvailable() && server.isAvailable()) {
System.out.println("connected");
} else {
System.exit(-1);
}
Date d = new Date();
try {
......@@ -53,7 +47,7 @@ public class TestStartWithSimpleApplication {
// the getString is blocking until the application finishes
application.waitFor();
System.out.println("finished application " + application + " with code " + application.getExitCode());
System.out.println("Finished application " + application + " with code " + application.getExitCode());
}
} finally {
......@@ -61,7 +55,7 @@ public class TestStartWithSimpleApplication {
Application.This.terminate();
}
System.out.println("finished the application after " + ((new Date()).getTime() - d.getTime()) + "ms");
System.out.println("Finished the application after " + ((new Date()).getTime() - d.getTime()) + "ms");
}
}
\ No newline at end of file
......@@ -33,6 +33,17 @@
<!-- Java apps -->
<application name="simplejava" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.Simple"/>
</application>
<application name="testsimplejava" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestSimple"/>
</application>
<application name="veryfastjava" starting_time="0" stopping_time="0" output_stream="yes" multiple="no" restart="no" info_arg="no">
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.VeryFastApplication"/>
</application>
......@@ -81,14 +92,6 @@
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestStorageApplication"/>
</application>
<application name="simplejava" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestSimpleApplication"/>
</application>
<application name="startsimplejava" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestStartWithSimpleApplication"/>
</application>
<application name="startveryfastjava" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestStartWithVeryFastApplication"/>
</application>
......@@ -183,6 +186,16 @@
<!-- C++ apps -->
<application name="simplecpp" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="simple"/>
</application>
<application name="testsimplecpp" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="testsimple"/>
</application>
<application name="veryfastcpp" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="testveryfast"/>
</application>
......@@ -195,10 +208,6 @@
<start executable="teststorage"/>
</application>
<application name="simplecpp" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="testsimple"/>
</application>
<application name="statecpp" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="teststate"/>
</application>
......@@ -242,10 +251,6 @@
<application name="stopcpp" starting_time="0" stopping_time="2" output_stream="yes" multiple="yes" restart="no">
<start executable="teststop"/>
</application>
<application name="startsimplecpp" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="teststartwithsimple"/>
</application>
<application name="startveryfastcpp" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="teststartwithveryfast"/>
......@@ -340,8 +345,13 @@
</application>
<!-- Python apps -->
<application name="startsimplepy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="startsimple.py"/>
<application name="simplepy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="simple.py"/>
</application>
<application name="testsimplepy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="testsimple.py"/>
</application>
<application name="startstoppy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
......@@ -349,6 +359,7 @@
</application>
<!-- Test apps -->
<application name="responder-server" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="testresponderserver"/>
</application>
......
#!/usr/bin/python3 -u
import sys
import cameopy
this = cameopy.This
this.init(sys.argv)
print("Finished the application")
......@@ -11,9 +11,9 @@ this.init(sys.argv)
server = this.getServer()
for i in range(numberOfTimes):
app = server.start("simplecpp", 0)
app = server.start("simplepy", 0)
state = app.waitFor()
print("finished the application", app.getNameId(),
print("Finished the application", app.getNameId(),
"with state", state,
"and code", app.getExitCode()
)
......@@ -14,11 +14,8 @@
* limitations under the Licence.
*/
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <cameo/cameo.h>
#include <iostream>
using namespace std;
using namespace cameo;
......@@ -29,11 +26,7 @@ int main(int argc, char *argv[]) {
// New block to ensure cameo objects are terminated before the application.
{
if (application::This::isAvailable()) {
cout << "connected" << endl;
}
cout << "finished the application" << endl;
cout << "Finished the application" << endl;
}
return 0;
......
......@@ -14,11 +14,9 @@
* limitations under the Licence.
*/
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <cameo/cameo.h>
#include <iostream>
using namespace std;
using namespace cameo;
......@@ -33,19 +31,19 @@ int main(int argc, char *argv[]) {
application::This::init(argc, argv);
// The start function must be called into a block to ensure the destructor of Instance is called before This::terminate()
// The start function must be called into a block to ensure the destructor of Instance is called before This::terminate().
{
Server& server = application::This::getServer();
// loop the number of times.
// Loop the number of times.
for (int i = 0; i < numberOfTimes; ++i) {
// start the application.
// Start the application.
unique_ptr<application::Instance> app = server.start("simplecpp");
application::State state = app->waitFor();
cout << "finished the application " << *app << " with state " << application::toString(state) << " and code " << app->getExitCode() << endl;
cout << "Finished the application " << *app << " with state " << application::toString(state) << " and code " << app->getExitCode() << endl;
}
}
......
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