The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit 11be7145 authored by legoc's avatar legoc
Browse files

Added test for output stream C++

parent 7d1f6277
......@@ -148,7 +148,7 @@
<application name="subpubcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" multiple="no" restart="no">
<start executable="build/bin/testsubscriberandpublisher"/>
</application>
<application name="pub2cpp" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/testpublishertwo"/>
</application>
......@@ -173,7 +173,7 @@
<start executable="build/bin/teststartwithresult"/>
</application>
<application name="stopcpp" starting_time="0" retries="0" stopping_time="1000" stream="yes" multiple="yes" restart="no">
<application name="stopcpp" starting_time="0" retries="0" stopping_time="1000" stream="yes" multiple="no" restart="no">
<start executable="build/bin/teststop"/>
</application>
......@@ -216,15 +216,32 @@
<application name="startpubcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" multiple="no" restart="no">
<start executable="build/bin/testsubscriberandpublisher" args="pubcpp"/>
</application>
<application name="startnpubcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" multiple="no" restart="no">
<start executable="build/bin/testnonsyncsubscribersandpublisher" args="npubcpp 10"/>
<start executable="build/bin/testnonsyncsubscribersandpublisher" args="nsubcpp 10"/>
</application>
<application name="startrepcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" multiple="no" restart="no">
<start executable="build/bin/testrequesterandresponder" args="repcpp"/>
</application>
<application name="repcppt" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/testrespondertimeout"/>
</application>
<application name="startrepcppt" starting_time="0" retries="0" stopping_time="1" stream="yes" multiple="no" restart="no">
<start executable="build/bin/testrequesterandrespondertimeout" args="repcppt"/>
</application>
<application name="streamcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/teststream"/>
</application>
<application name="startstreamcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/teststartstream"/>
</application>
<!-- test apps -->
<application name="responder-server" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/testresponderserver"/>
</application>
......
......@@ -233,7 +233,6 @@
<start executable="build/bin/testrequesterandresponder" args="repcpp"/>
</application>
<application name="repcppt" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/testrespondertimeout"/>
</application>
......@@ -242,10 +241,15 @@
<start executable="build/bin/testrequesterandrespondertimeout" args="repcppt"/>
</application>
<application name="startstream" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<application name="streamcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/teststream"/>
</application>
<application name="startstreamcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/teststartstream"/>
</application>
<!-- test apps -->
<application name="responder-server" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="build/bin/testresponderserver"/>
</application>
......
......@@ -181,7 +181,7 @@
<application name="startrepcpp" starting_time="0" retries="0" stopping_time="1" stream="yes" multiple="no" restart="no" environment="win-environment.properties">
<start executable="msvc/x64/Release/reqrepcpp" args="repcpp"/>
</application>
<application name="responder-server" starting_time="0" retries="0" stopping_time="1" stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="msvc/x64/Release/testresponderserver"/>
</application>
......
......@@ -30,6 +30,7 @@ bin_PROGRAMS = \
testrespondertimeout \
testrequesterandrespondertimeout \
teststream \
teststartstream \
testresponderserver \
testrequesterclient
......@@ -264,6 +265,14 @@ teststream_LDFLAGS = $(CT_LDFLAGS)
teststream_LDADD = $(CT_LIBS)
teststartstream_SOURCES = \
TestStartStreamApplication.cpp
teststartstream_CPPFLAGS = $(CT_CXXFLAGS)
teststartstream_LDFLAGS = $(CT_LDFLAGS)
teststartstream_LDADD = $(CT_LIBS)
testresponderserver_SOURCES = \
TestResponderServer.cpp
......
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <cameo/cameo.h>
using namespace std;
using namespace cameo;
void printOutput(shared_ptr<OutputStreamSocket> socket) {
while (true) {
Output output;
if (socket->receive(output)) {
cout << output.getMessage() << endl;
}
else {
return;
}
}
}
int main(int argc, char *argv[]) {
application::This::init(argc, argv);
// New block to ensure cameo objects are terminated before the application.
{
Server& server = application::This::getServer();
if (application::This::isAvailable() && server.isAvailable()) {
cout << "connected" << endl;
}
// start the application.
unique_ptr<application::Instance> app = server.start("streamcpp", cameo::OUTPUTSTREAM);
shared_ptr<OutputStreamSocket> socket = app->getOutputStreamSocket();
std::thread outputThread(std::bind(printOutput, socket));
this_thread::sleep_for(chrono::seconds(2));
cout << "canceling output" << endl;
socket->cancel();
outputThread.join();
application::State state = app->waitFor();
cout << "finished the application" << endl;
}
return 0;
}
......@@ -36,8 +36,9 @@ int main(int argc, char *argv[]) {
application::This::setRunning();
int i = 0;
while (i < 1000) {
while (i < 40) {
cout << "printing " << i << endl;
this_thread::sleep_for(chrono::milliseconds(100));
i++;
}
......
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