Commit 959c1d08 authored by legoc's avatar legoc

Test result renamed

parent 717b1307
......@@ -44,6 +44,16 @@ target_link_libraries(stop PUBLIC cameo zmq)
add_executable(teststop src/tests/TestStop.cpp)
target_link_libraries(teststop PUBLIC cameo zmq)
add_executable(result src/tests/Result.cpp)
target_link_libraries(result PUBLIC cameo zmq)
add_executable(testresult src/tests/TestResult.cpp)
target_link_libraries(testresult PUBLIC cameo zmq)
......@@ -84,11 +94,6 @@ target_link_libraries(testnonsyncsubscriber PUBLIC cameo zmq)
add_executable(testnonsyncsubscribersandpublisher src/tests/TestNonSyncSubscribersAndPublisherApplication.cpp)
target_link_libraries(testnonsyncsubscribersandpublisher PUBLIC cameo zmq)
add_executable(testresult src/tests/TestResultApplication.cpp)
target_link_libraries(testresult PUBLIC cameo zmq)
add_executable(teststartwithresult src/tests/TestStartWithResultApplication.cpp)
target_link_libraries(teststartwithresult PUBLIC cameo zmq)
......
......@@ -135,7 +135,7 @@ public class TestSelector {
apps.add("testsimplejava");
apps.add("testveryfastjava");
apps.add("teststopjava");
apps.add("startresjava");
apps.add("testresultjava");
apps.add("starterrorjava");
apps.add("startstoragejava");
apps.add("startpubjava");
......@@ -146,8 +146,8 @@ public class TestSelector {
apps.add("testsimplecpp");
apps.add("testveryfastcpp");
apps.add("startstopcpp");
apps.add("startrescpp");
apps.add("teststopcpp");
apps.add("testresultcpp");
apps.add("starterrorcpp");
apps.add("startstoragecpp");
apps.add("startpubcpp");
......@@ -156,12 +156,15 @@ public class TestSelector {
apps.add("cancelcpp");
apps.add("testsimplepy");
apps.add("testveryfastpy");
apps.add("teststoppy");
apps.add("testresultpy");
}
else if (appName.equals("java")) {
apps.add("testsimplejava");
apps.add("testveryfastjava");
apps.add("teststopjava");
apps.add("startresjava");
apps.add("testresultjava");
apps.add("starterrorjava");
apps.add("startstoragejava");
apps.add("startpubjava");
......@@ -174,7 +177,7 @@ public class TestSelector {
apps.add("testsimplecpp");
apps.add("testveryfastcpp");
apps.add("teststopcpp");
apps.add("startrescpp");
apps.add("testresultcpp");
apps.add("starterrorcpp");
apps.add("startstoragecpp");
apps.add("startpubcpp");
......@@ -186,6 +189,7 @@ public class TestSelector {
apps.add("testsimplepy");
apps.add("testveryfastpy");
apps.add("teststoppy");
apps.add("testresultpy");
}
else {
apps.add(appName);
......
......@@ -19,30 +19,16 @@ package fr.ill.ics.cameo.test;
import fr.ill.ics.cameo.Application;
public class TestResultApplication {
public class Result {
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("waiting 1s...");
//
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// }
Application.This.setResult("this is a test result");
Application.This.terminate();
System.out.println("finished the application");
System.out.println("Finished the application");
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.Server;
public class TestStartWithResultApplication {
public class TestResult {
public static void main(String[] args) {
......@@ -33,30 +33,23 @@ public class TestStartWithResultApplication {
Server server = Application.This.getServer();
if (Application.This.isAvailable() && server.isAvailable()) {
System.out.println("connected");
} else {
System.exit(-1);
}
try {
// loop the number of times.
// Loop the number of times.
for (int i = 0; i < numberOfTimes; ++i) {
// start the application.
Application.Instance resultApplication = server.start("resjava");
// Start the application.
Application.Instance resultApplication = server.start("resultjava");
// the getString is blocking until the application finishes
// The call is blocking until the application finishes.
String result = resultApplication.getStringResult();
System.out.println("result application returned " + result);
System.out.println("Result application returned " + result);
}
} finally {
// do not forget to terminate the server and application
Application.This.terminate();
}
System.out.println("finished the application");
System.out.println("Finished the application");
}
}
\ No newline at end of file
......@@ -57,6 +57,17 @@
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestStop"/>
</application>
<application name="resultjava" 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.Result"/>
</application>
<application name="testresultjava" 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.TestResult"/>
</application>
<application name="errorjava" starting_time="0" stopping_time="1" multiple="no" restart="no" info_arg="no">
......@@ -103,13 +114,6 @@
<start executable="java" args="-classpath cameo-tests-jzmq/target/cameo-tests-jzmq-full.jar fr.ill.ics.cameo.test.TestStorageApplication"/>
</application>
<application name="resjava" 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.TestResultApplication"/>
</application>
<application name="startresjava" 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.TestStartWithResultApplication"/>
</application>
......@@ -211,6 +215,14 @@
<start executable="teststop"/>
</application>
<application name="resultcpp" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="result"/>
</application>
<application name="testresultcpp" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="testresult"/>
</application>
......@@ -256,14 +268,6 @@
<start executable="testnonsyncsubscribersandpublisher"/>
</application>
<application name="rescpp" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="testresult"/>
</application>
<application name="startrescpp" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="teststartwithresult"/>
</application>
<application name="starterrorcpp" starting_time="0" stopping_time="1" output_stream="yes" multiple="no" restart="no">
<start executable="teststartwitherror"/>
</application>
......@@ -370,6 +374,14 @@
<start executable="teststop.py"/>
</application>
<application name="resultpy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="result.py"/>
</application>
<application name="testresultpy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="testresult.py"/>
</application>
<!-- Test apps -->
......
#!/usr/bin/python3 -u
import sys
import cameopy
this = cameopy.This
this.init(sys.argv)
this.setResult("test result")
print("Finished the application")
#!/usr/bin/python3 -u
import sys
import cameopy
import time
numberOfTimes = 1 if len(sys.argv) < 3 else int(sys.argv[1])
print("Number of times:", numberOfTimes)
this = cameopy.This
this.init(sys.argv)
server = this.getServer()
for i in range(numberOfTimes):
app = server.start("resultpy", 0);
result = app.getResult()
# The variable result can be None.
if result:
print("Result", result)
else:
print("No result")
print("Finished the application")
......@@ -16,10 +16,6 @@
#include <cameo/cameo.h>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <thread>
using namespace std;
using namespace cameo;
......@@ -30,16 +26,12 @@ 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 << "waiting 1s..." << endl;
cout << "Waiting 1s..." << endl;
this_thread::sleep_for(chrono::seconds(1));
application::This::setResult("test result");
cout << "finished the application" << endl;
cout << "Finished the application" << endl;
}
return 0;
......
......@@ -16,10 +16,6 @@
#include <cameo/cameo.h>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <thread>
using namespace std;
using namespace cameo;
......
......@@ -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;
......@@ -37,25 +34,21 @@ int main(int argc, char *argv[]) {
{
Server& server = application::This::getServer();
if (application::This::isAvailable() && server.isAvailable()) {
cout << "connected" << endl;
}
// loop the number of times.
// Loop the number of times.
for (int i = 0; i < numberOfTimes; ++i) {
// start the application.
unique_ptr<application::Instance> resultApplication = server.start("rescpp");
// Start the application.
unique_ptr<application::Instance> resultApplication = server.start("resultcpp");
optional<string> result = resultApplication->getResult();
if (result.has_value()) {
cout << "result application returned " << result.value() << endl;
cout << "Result " << result.value() << endl;
} else {
cout << "result application has no result" << endl;
cout << "No result" << endl;
}
cout << "finished the application " << *resultApplication << endl;
cout << "Finished the application " << *resultApplication << endl;
}
}
......
......@@ -14,7 +14,6 @@
* limitations under the Licence.
*/
#include <cameo/cameo.h>
#include <iostream>
......
......@@ -16,10 +16,6 @@
#include <cameo/cameo.h>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <thread>
using namespace std;
using namespace cameo;
......@@ -44,7 +40,7 @@ int main(int argc, char *argv[]) {
{
Server& server = application::This::getServer();
// loop the number of times.
// Loop the number of times.
for (int i = 0; i < numberOfTimes; ++i) {
unique_ptr<application::Instance> stopApplication = server.start("stopcpp");
......
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