diff options
author | Arnstein Ressem <aressem@yahoo-inc.com> | 2016-09-12 16:26:41 +0200 |
---|---|---|
committer | Arnstein Ressem <aressem@yahoo-inc.com> | 2016-09-12 16:26:41 +0200 |
commit | 783bad638168ee3e64505037c75fa2028ab71c00 (patch) | |
tree | 9f9cdc772183fed36b99a8623ef27afdecd8a3fe /messagebus | |
parent | 865030c6d6c3c31f7fabb1a72c4a9902ec5fcca7 (diff) |
In progress moving messagebus/test -> messagebus_test
Diffstat (limited to 'messagebus')
75 files changed, 0 insertions, 1738 deletions
diff --git a/messagebus/CMakeLists.txt b/messagebus/CMakeLists.txt index 534887e011b..332e83128ed 100644 --- a/messagebus/CMakeLists.txt +++ b/messagebus/CMakeLists.txt @@ -17,7 +17,6 @@ vespa_define_module( APPS src/apps/printversion - src/binref TESTS src/tests diff --git a/messagebus/src/binref/.gitignore b/messagebus/src/binref/.gitignore deleted file mode 100644 index cfb0e619824..00000000000 --- a/messagebus/src/binref/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.depend -Makefile -testrun.sh diff --git a/messagebus/src/binref/CMakeLists.txt b/messagebus/src/binref/CMakeLists.txt deleted file mode 100644 index 5c90dd5bfcc..00000000000 --- a/messagebus/src/binref/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. diff --git a/messagebus/src/testlist.txt b/messagebus/src/testlist.txt deleted file mode 100644 index e096aa5a9a1..00000000000 --- a/messagebus/src/testlist.txt +++ /dev/null @@ -1,41 +0,0 @@ -tests/advancedrouting -tests/auto-reply -tests/bucketsequence -tests/blob -tests/choke -tests/configagent -tests/context -tests/emptyreply -tests/error -tests/identity -tests/loadbalance -tests/messagebus -tests/messenger -tests/oos -tests/protocolrepository -tests/queue -tests/replygate -tests/resender -tests/result -tests/retrypolicy -tests/routable -tests/routablequeue -tests/routeparser -tests/routing -tests/routingcontext -tests/routingspec -tests/rpcserviceaddress -tests/sendadapter -tests/sequencer -tests/serviceaddress -tests/servicepool -tests/shutdown -tests/simple-roundtrip -tests/simpleprotocol -tests/slobrok -tests/sourcesession -tests/targetpool -tests/throttling -tests/timeout -tests/trace-roundtrip -tests/messageordering diff --git a/messagebus/test/CMakeLists.txt b/messagebus/test/CMakeLists.txt deleted file mode 100644 index 1e2fb57b960..00000000000 --- a/messagebus/test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -vespa_add_module_dependency(slobrok_slobrokserver) -vespa_add_module_dependency(messagebus) -add_subdirectory(src/binref) -add_subdirectory(src/tests/compile-cpp) -add_subdirectory(src/tests/compile-java) -add_subdirectory(src/tests/error) -add_subdirectory(src/tests/errorcodes) -add_subdirectory(src/tests/speed) -add_subdirectory(src/tests/trace) diff --git a/messagebus/test/src/.gitignore b/messagebus/test/src/.gitignore deleted file mode 100644 index 8689bfd3624..00000000000 --- a/messagebus/test/src/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -Makefile.inc -Makefile.ini -config.cfg -config_command.sh -configure -project.dsw -versiontag.mak -/messagebus_test.mak diff --git a/messagebus/test/src/binref/.gitignore b/messagebus/test/src/binref/.gitignore deleted file mode 100644 index c1b83610972..00000000000 --- a/messagebus/test/src/binref/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.depend -Makefile -compilejava -env.sh -runjava diff --git a/messagebus/test/src/binref/CMakeLists.txt b/messagebus/test/src/binref/CMakeLists.txt deleted file mode 100644 index 20594f98d02..00000000000 --- a/messagebus/test/src/binref/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -configure_file(compilejava.in compilejava @ONLY) -configure_file(runjava.in runjava @ONLY) -configure_file(env.sh.in env.sh @ONLY) diff --git a/messagebus/test/src/binref/compilejava.in b/messagebus/test/src/binref/compilejava.in deleted file mode 100755 index bebe4374afb..00000000000 --- a/messagebus/test/src/binref/compilejava.in +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -unset VESPA_LOG_TARGET -CLASSPATH=@PROJECT_BINARY_DIR@/messagebus/target/messagebus-jar-with-dependencies.jar -CLASSPATH=$CLASSPATH:@PROJECT_BINARY_DIR@/component/target/component.jar -CLASSPATH=$CLASSPATH:. - -if [ $# -lt 1 ]; then - echo "usage: compilejava file ..." - exit 1 -fi -exec javac -classpath $CLASSPATH "$@" diff --git a/messagebus/test/src/binref/env.sh.in b/messagebus/test/src/binref/env.sh.in deleted file mode 100644 index dda4234226f..00000000000 --- a/messagebus/test/src/binref/env.sh.in +++ /dev/null @@ -1,2 +0,0 @@ -BINREF=@CMAKE_CURRENT_BINARY_DIR@ -export BINREF diff --git a/messagebus/test/src/binref/progctl.sh b/messagebus/test/src/binref/progctl.sh deleted file mode 120000 index 781d2058cf9..00000000000 --- a/messagebus/test/src/binref/progctl.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../vespalib/src/vespa/vespalib/testkit/progctl.sh
\ No newline at end of file diff --git a/messagebus/test/src/binref/runjava.in b/messagebus/test/src/binref/runjava.in deleted file mode 100755 index 20d4de0a477..00000000000 --- a/messagebus/test/src/binref/runjava.in +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -unset VESPA_LOG_TARGET -unset LD_PRELOAD -CLASSPATH=@PROJECT_BINARY_DIR@/messagebus/target/messagebus-jar-with-dependencies.jar -CLASSPATH=$CLASSPATH:@PROJECT_BINARY_DIR@/component/target/component.jar -CLASSPATH=$CLASSPATH:. -if [ $# -lt 1 ]; then - echo "usage: runjava <class> [args]" - exit 1 -fi -CLASS=$1 -shift -exec java -cp $CLASSPATH $CLASS "$@" diff --git a/messagebus/test/src/binref/sbcmd b/messagebus/test/src/binref/sbcmd deleted file mode 120000 index 49b9c735282..00000000000 --- a/messagebus/test/src/binref/sbcmd +++ /dev/null @@ -1 +0,0 @@ -../../../../slobrok/src/apps/sbcmd/sbcmd
\ No newline at end of file diff --git a/messagebus/test/src/binref/slobrok b/messagebus/test/src/binref/slobrok deleted file mode 120000 index 5bc8ae2a9f2..00000000000 --- a/messagebus/test/src/binref/slobrok +++ /dev/null @@ -1 +0,0 @@ -../../../../slobrok/src/apps/slobrok/slobrok
\ No newline at end of file diff --git a/messagebus/test/src/binref/testrun.sh b/messagebus/test/src/binref/testrun.sh deleted file mode 120000 index 457b9f75c5e..00000000000 --- a/messagebus/test/src/binref/testrun.sh +++ /dev/null @@ -1 +0,0 @@ -../../../../vespalib/src/vespa/vespalib/testkit/testrun.sh
\ No newline at end of file diff --git a/messagebus/test/src/setup.sh b/messagebus/test/src/setup.sh deleted file mode 100755 index 2111dfb447c..00000000000 --- a/messagebus/test/src/setup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -MYDIR=`pwd` -cp ../../src/cpp/Makefile.inc . -cp ../../src/cpp/versiontag.mak . -cp ../../src/cpp/config.cfg . -cp ../../src/cpp/config_command.sh . -sh config_command.sh -echo MODULEDEP_INCLUDES += -I$MYDIR/../../src/cpp >> Makefile.ini -echo LIBDIR_MESSAGEBUS=$MYDIR/../../src/cpp/messagebus >> Makefile.ini -echo LIBDIR_MESSAGEBUS-TEST=$MYDIR/../../src/cpp/messagebus/testlib >> Makefile.ini diff --git a/messagebus/test/src/test-report-index.html b/messagebus/test/src/test-report-index.html deleted file mode 100644 index 4ddd6eab8f9..00000000000 --- a/messagebus/test/src/test-report-index.html +++ /dev/null @@ -1,17 +0,0 @@ -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<html> - <title>Messagebus</title> - <body> - <h1>Messagebus Test Reports</h1> - <ul> - <li><a href="../../../messagebus/target/site/surefire-report.html">Messagebus Java Test Report</a></li> - <li><a href="test-report-cpp/test-report.html">Messagebus C++ Test Report</a></li> - <li><a href="test-report-cross/test-report.html">Messagebus Cross-language Test Report</a></li> - </ul> - <h1>Messagebus API Documentation</h1> - <ul> - <li><a href="../../../messagebus/src/java/docs/javadoc/index.html">Messagebus Java API Documentation</a></li> - <li><a href="../../../messagebus/src/cpp/doxygen/html/index.html">Messagebus C++ API Documentation</a></li> - </ul> - </body> -</html> diff --git a/messagebus/test/src/testlist.txt b/messagebus/test/src/testlist.txt deleted file mode 100644 index 3ff4369c385..00000000000 --- a/messagebus/test/src/testlist.txt +++ /dev/null @@ -1,6 +0,0 @@ -tests/compile-java -tests/compile-cpp -tests/trace -tests/error -tests/errorcodes -tests/speed diff --git a/messagebus/test/src/tests/compile-cpp/.gitignore b/messagebus/test/src/tests/compile-cpp/.gitignore deleted file mode 100644 index 14e4fb37c45..00000000000 --- a/messagebus/test/src/tests/compile-cpp/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.depend -Makefile -compile-cpp_test -messagebus_test_compile-cpp_test_app diff --git a/messagebus/test/src/tests/compile-cpp/CMakeLists.txt b/messagebus/test/src/tests/compile-cpp/CMakeLists.txt deleted file mode 100644 index aa82392d661..00000000000 --- a/messagebus/test/src/tests/compile-cpp/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(messagebus_test_compile-cpp_test_app TEST - SOURCES - compile-cpp.cpp - DEPENDS -) -vespa_add_test(NAME messagebus_test_compile-cpp_test_app NO_VALGRIND COMMAND messagebus_test_compile-cpp_test_app) diff --git a/messagebus/test/src/tests/compile-cpp/DESC b/messagebus/test/src/tests/compile-cpp/DESC deleted file mode 100644 index 465d625ca9e..00000000000 --- a/messagebus/test/src/tests/compile-cpp/DESC +++ /dev/null @@ -1,2 +0,0 @@ -simple compilation test to check dependencies. - diff --git a/messagebus/test/src/tests/compile-cpp/FILES b/messagebus/test/src/tests/compile-cpp/FILES deleted file mode 100644 index 956ce16a56e..00000000000 --- a/messagebus/test/src/tests/compile-cpp/FILES +++ /dev/null @@ -1 +0,0 @@ -compile-cpp.cpp diff --git a/messagebus/test/src/tests/compile-cpp/compile-cpp.cpp b/messagebus/test/src/tests/compile-cpp/compile-cpp.cpp deleted file mode 100644 index e15b57859b7..00000000000 --- a/messagebus/test/src/tests/compile-cpp/compile-cpp.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("compile-cpp_test"); -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/messagebus/routing/route.h> - -TEST_SETUP(Test); - -int -Test::Main() -{ - TEST_INIT("compile-cpp_test"); - mbus::Route r; - TEST_DONE(); -} diff --git a/messagebus/test/src/tests/compile-java/.gitignore b/messagebus/test/src/tests/compile-java/.gitignore deleted file mode 100644 index d615ebbafe7..00000000000 --- a/messagebus/test/src/tests/compile-java/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.class -.depend -Makefile -compile-java_test diff --git a/messagebus/test/src/tests/compile-java/CMakeLists.txt b/messagebus/test/src/tests/compile-java/CMakeLists.txt deleted file mode 100644 index 3e7665f5fed..00000000000 --- a/messagebus/test/src/tests/compile-java/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_test(NAME messagebus_test_compile-java_test NO_VALGRIND COMMAND sh compile-java_test.sh) diff --git a/messagebus/test/src/tests/compile-java/DESC b/messagebus/test/src/tests/compile-java/DESC deleted file mode 100644 index 465d625ca9e..00000000000 --- a/messagebus/test/src/tests/compile-java/DESC +++ /dev/null @@ -1,2 +0,0 @@ -simple compilation test to check dependencies. - diff --git a/messagebus/test/src/tests/compile-java/FILES b/messagebus/test/src/tests/compile-java/FILES deleted file mode 100644 index 5b154bb1605..00000000000 --- a/messagebus/test/src/tests/compile-java/FILES +++ /dev/null @@ -1 +0,0 @@ -TestCompile.java diff --git a/messagebus/test/src/tests/compile-java/TestCompile.java b/messagebus/test/src/tests/compile-java/TestCompile.java deleted file mode 100644 index 443ae093794..00000000000 --- a/messagebus/test/src/tests/compile-java/TestCompile.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -import com.yahoo.messagebus.EmptyReply; - -public class TestCompile { - public static void main(String[] args) { - EmptyReply er = new EmptyReply(); - } -} diff --git a/messagebus/test/src/tests/compile-java/compile-java_test.sh b/messagebus/test/src/tests/compile-java/compile-java_test.sh deleted file mode 100755 index 9b94ffd51a1..00000000000 --- a/messagebus/test/src/tests/compile-java/compile-java_test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e -. ../../binref/env.sh - -$BINREF/compilejava TestCompile.java -$BINREF/runjava TestCompile - diff --git a/messagebus/test/src/tests/create-test.sh b/messagebus/test/src/tests/create-test.sh deleted file mode 100755 index 27277838a07..00000000000 --- a/messagebus/test/src/tests/create-test.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -gen_ignore_file() { - echo "generating '$1' ..." - echo ".depend" > $1 - echo "Makefile" >> $1 - echo "${test}_test" >> $1 -} - -gen_project_file() { - echo "generating '$1' ..." - echo "APPLICATION ${test}_test" > $1 - echo "OBJS $test" >> $1 - echo "EXTERNALLIBS messagebus messagebus-test" >> $1 - echo "EXTERNALLIBS slobrokserver slobrok fnet vespalib config vespalog" >> $1 - echo "" >> $1 - echo "CUSTOMMAKE" >> $1 - echo "test: depend ${test}_test" >> $1 - echo -e "\t@./${test}_test" >> $1 -} - -gen_source() { - echo "generating '$1' ..." - echo "#include <vespa/log/log.h>" > $1 - echo "LOG_SETUP(\"${test}_test\");" >> $1 - echo "#include <vespa/fastos/fastos.h>" >> $1 - echo "#include <vespa/vespalib/testkit/testapp.h>" >> $1 - echo "" >> $1 - echo "TEST_SETUP(Test);" >> $1 - echo "" >> $1 - echo "int" >> $1 - echo "Test::Main()" >> $1 - echo "{" >> $1 - echo " TEST_INIT(\"${test}_test\");" >> $1 - echo " TEST_DONE();" >> $1 - echo "}" >> $1 -} - -gen_desc() { - echo "generating '$1' ..." - echo "$test test. Take a look at $test.cpp for details." > $1 -} - -gen_file_list() { - echo "generating '$1' ..." - echo "$test.cpp" > $1 -} - -if [ $# -ne 1 ]; then - echo "usage: $0 <name>" - echo " name: name of the test to create" - exit 1 -fi - -test=$1 -if [ -e $test ]; then - echo "$test already present, don't want to mess it up..." - exit 1 -fi - -echo "creating directory '$test' ..." -mkdir -p $test || exit 1 -cd $test || exit 1 -test=`basename $test` - -gen_ignore_file .cvsignore -gen_project_file fastos.project -gen_source $test.cpp -gen_desc DESC -gen_file_list FILES diff --git a/messagebus/test/src/tests/error/.gitignore b/messagebus/test/src/tests/error/.gitignore deleted file mode 100644 index 20cb631e9e8..00000000000 --- a/messagebus/test/src/tests/error/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.class -.depend -Makefile -cpp-client -cpp-server -error_test -out.* -pid.* -routing.cfg -slobrok.cfg -/cpp-client-error -/cpp-server-error -messagebus_test_error_test_app -messagebus_test_cpp-client-error_app -messagebus_test_cpp-server-error_app diff --git a/messagebus/test/src/tests/error/CMakeLists.txt b/messagebus/test/src/tests/error/CMakeLists.txt deleted file mode 100644 index 5baadf2b18b..00000000000 --- a/messagebus/test/src/tests/error/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(messagebus_test_error_test_app TEST - SOURCES - error.cpp - DEPENDS -) -vespa_add_test(NAME messagebus_test_error_test_app NO_VALGRIND COMMAND sh error_test.sh) -vespa_add_executable(messagebus_test_cpp-server-error_app - SOURCES - cpp-server.cpp - DEPENDS -) -vespa_add_executable(messagebus_test_cpp-client-error_app - SOURCES - cpp-client.cpp - DEPENDS -) diff --git a/messagebus/test/src/tests/error/DESC b/messagebus/test/src/tests/error/DESC deleted file mode 100644 index 171966761ee..00000000000 --- a/messagebus/test/src/tests/error/DESC +++ /dev/null @@ -1,2 +0,0 @@ -Check that java and cpp messagebus components are able to pass errors -to each other and preserve meaning. diff --git a/messagebus/test/src/tests/error/FILES b/messagebus/test/src/tests/error/FILES deleted file mode 100644 index 571002a917f..00000000000 --- a/messagebus/test/src/tests/error/FILES +++ /dev/null @@ -1,8 +0,0 @@ -error.cpp -out.server.cpp -out.server.java -cpp-client.cpp -cpp-server.cpp -JavaClient.java -JavaServer.java -routing-template.cfg diff --git a/messagebus/test/src/tests/error/JavaClient.java b/messagebus/test/src/tests/error/JavaClient.java deleted file mode 100644 index e263b3597da..00000000000 --- a/messagebus/test/src/tests/error/JavaClient.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -import com.yahoo.messagebus.*; -import com.yahoo.messagebus.test.*; -import com.yahoo.config.*; -import com.yahoo.messagebus.routing.*; -import com.yahoo.messagebus.network.*; -import com.yahoo.messagebus.network.rpc.*; -import com.yahoo.messagebus.network.rpc.test.*; -import java.util.Arrays; -import java.util.logging.*; - -public class JavaClient { - - private static Logger log = Logger.getLogger(JavaClient.class.getName()); - - public static void main(String[] args) { - try { - RPCMessageBus mb = new RPCMessageBus( - Arrays.asList((Protocol)new SimpleProtocol()), - new RPCNetworkParams() - .setIdentity(new Identity("server/java")) - .setSlobrokConfigId("file:slobrok.cfg"), - "file:routing.cfg"); - - Receptor src = new Receptor(); - Message msg = null; - Reply reply = null; - - SourceSession session = mb.getMessageBus().createSourceSession(src, new SourceSessionParams().setTimeout(300)); - for (int i = 0; i < 10; i++) { - msg = new SimpleMessage("test"); - msg.getTrace().setLevel(9); - session.send(msg, "test"); - reply = src.getReply(60); - if (reply == null) { - System.err.println("JAVA-CLIENT: no reply"); - } else { - System.err.println("JAVA-CLIENT:\n" + reply.getTrace()); - if (reply.getNumErrors() == 2) { - break; - } - } - Thread.sleep(1000); - } - if (reply == null) { - System.err.println("JAVA-CLIENT: no reply"); - System.exit(1); - } - if (reply.getNumErrors() != 2 || - reply.getError(0).getCode() != ErrorCode.APP_FATAL_ERROR + 1 || - reply.getError(1).getCode() != ErrorCode.APP_FATAL_ERROR + 2 || - !reply.getError(0).getMessage().equals("ERR 1") || - !reply.getError(1).getMessage().equals("ERR 2")) - { - System.err.printf("JAVA-CLIENT: wrong errors\n"); - System.exit(1); - } - session.destroy(); - mb.destroy(); - } catch (Exception e) { - log.log(Level.SEVERE, "JAVA-CLIENT: Failed", e); - System.exit(1); - } - } -} diff --git a/messagebus/test/src/tests/error/JavaServer.java b/messagebus/test/src/tests/error/JavaServer.java deleted file mode 100644 index b5321f41fc3..00000000000 --- a/messagebus/test/src/tests/error/JavaServer.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -import com.yahoo.messagebus.*; -import com.yahoo.messagebus.test.*; -import com.yahoo.config.*; -import com.yahoo.messagebus.routing.*; -import com.yahoo.messagebus.network.*; -import com.yahoo.messagebus.network.rpc.*; -import java.util.Arrays; -import java.util.logging.*; - -public class JavaServer implements MessageHandler { - - private static Logger log = Logger.getLogger(JavaServer.class.getName()); - - private DestinationSession session; - - public JavaServer(RPCMessageBus mb) { - session = mb.getMessageBus().createDestinationSession("session", true, this); - } - - public void handleMessage(Message msg) { - Reply reply = new EmptyReply(); - msg.swapState(reply); - reply.addError(new com.yahoo.messagebus.Error(ErrorCode.APP_FATAL_ERROR + 1, "ERR 1")); - reply.addError(new com.yahoo.messagebus.Error(ErrorCode.APP_FATAL_ERROR + 2, "ERR 2")); - session.reply(reply); - } - - public static void main(String[] args) { - try { - RPCMessageBus mb = new RPCMessageBus( - Arrays.asList((Protocol)new SimpleProtocol()), - new RPCNetworkParams() - .setIdentity(new Identity("server/java")) - .setSlobrokConfigId("file:slobrok.cfg"), - "file:routing.cfg"); - JavaServer server = new JavaServer(mb); - System.out.println("java server started"); - while (true) { - Thread.sleep(1000); - } - } catch (Exception e) { - log.log(Level.SEVERE, "JAVA-SERVER: Failed", e); - System.exit(1); - } - } -} diff --git a/messagebus/test/src/tests/error/cpp-client.cpp b/messagebus/test/src/tests/error/cpp-client.cpp deleted file mode 100644 index 4f94a13977c..00000000000 --- a/messagebus/test/src/tests/error/cpp-client.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("cpp-client"); -#include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/sourcesession.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/errorcode.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> -#include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/messagebus/testlib/receptor.h> -#include <vespa/vespalib/util/sync.h> - -using namespace mbus; - -class App : public FastOS_Application -{ -public: - int Main(); -}; - -int -App::Main() -{ - RPCMessageBus mb(ProtocolSet().add(IProtocol::SP(new SimpleProtocol())), - RPCNetworkParams() - .setIdentity(Identity("server/cpp")) - .setSlobrokConfig("file:slobrok.cfg"), - "file:routing.cfg"); - - Receptor src; - Message::UP msg; - Reply::UP reply; - - SourceSession::UP ss = mb.getMessageBus().createSourceSession(src, SourceSessionParams().setTimeout(300)); - for (int i = 0; i < 10; ++i) { - msg.reset(new SimpleMessage("test")); - msg->getTrace().setLevel(9); - ss->send(std::move(msg), "test"); - reply = src.getReply(600); // 10 minutes timeout - if (reply.get() == 0) { - fprintf(stderr, "CPP-CLIENT: no reply\n"); - } else { - fprintf(stderr, "CPP-CLIENT:\n%s\n", - reply->getTrace().toString().c_str()); - if (reply->getNumErrors() == 2) { - break; - } - } - FastOS_Thread::Sleep(1000); - } - if (reply.get() == 0) { - fprintf(stderr, "CPP-CLIENT: no reply\n"); - return 1; - } - if (reply->getNumErrors() != 2 || - reply->getError(0).getCode() != (ErrorCode::APP_FATAL_ERROR + 1) || - reply->getError(1).getCode() != (ErrorCode::APP_FATAL_ERROR + 2) || - reply->getError(0).getMessage() != "ERR 1" || - reply->getError(1).getMessage() != "ERR 2") - { - fprintf(stderr, "CPP-CLIENT: wrong errors\n"); - return 1; - } - return 0; -} - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus/test/src/tests/error/cpp-server.cpp b/messagebus/test/src/tests/error/cpp-server.cpp deleted file mode 100644 index 2eb929f6ca9..00000000000 --- a/messagebus/test/src/tests/error/cpp-server.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("cpp-server"); -#include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> -#include <vespa/messagebus/emptyreply.h> -#include <vespa/messagebus/error.h> -#include <vespa/messagebus/errorcode.h> - -using namespace mbus; - -class Server : public IMessageHandler -{ -private: - DestinationSession::UP _session; -public: - Server(MessageBus &bus); - ~Server(); - void handleMessage(Message::UP msg); -}; - -Server::Server(MessageBus &bus) - : _session(bus.createDestinationSession("session", true, *this)) -{ - fprintf(stderr, "cpp server started\n"); -} - -Server::~Server() -{ - _session.reset(); -} - -void -Server::handleMessage(Message::UP msg) { - Reply::UP reply(new EmptyReply()); - msg->swapState(*reply); - reply->addError(Error(ErrorCode::APP_FATAL_ERROR + 1, "ERR 1")); - reply->addError(Error(ErrorCode::APP_FATAL_ERROR + 2, "ERR 2")); - _session->reply(std::move(reply)); -} - -class App : public FastOS_Application -{ -public: - int Main(); -}; - -int -App::Main() -{ - RPCMessageBus mb(ProtocolSet().add(IProtocol::SP(new SimpleProtocol())), - RPCNetworkParams() - .setIdentity(Identity("server/cpp")) - .setSlobrokConfig("file:slobrok.cfg"), - "file:routing.cfg"); - Server server(mb.getMessageBus()); - while (true) { - FastOS_Thread::Sleep(1000); - } - return 0; -} - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus/test/src/tests/error/ctl.sh b/messagebus/test/src/tests/error/ctl.sh deleted file mode 100755 index 864be4290ed..00000000000 --- a/messagebus/test/src/tests/error/ctl.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -exec ../../binref/progctl.sh progdefs.sh "$@" diff --git a/messagebus/test/src/tests/error/error.cpp b/messagebus/test/src/tests/error/error.cpp deleted file mode 100644 index 9b01e5d61d0..00000000000 --- a/messagebus/test/src/tests/error/error.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("error_test"); -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/vespalib/util/stringfmt.h> - -using namespace mbus; -using vespalib::make_string; - -TEST_SETUP(Test); - -int -Test::Main() -{ - TEST_INIT("error_test"); - Slobrok slobrok; - { // Make slobrok config - EXPECT_TRUE(system("echo slobrok[1] > slobrok.cfg") == 0); - EXPECT_TRUE(system(make_string("echo 'slobrok[0].connectionspec tcp/localhost:%d' " - ">> slobrok.cfg", slobrok.port()).c_str()) == 0); - } - { // CPP SERVER - { // Make routing config - EXPECT_TRUE(system("cat routing-template.cfg | sed 's#session#cpp/session#' > routing.cfg") == 0); - } - fprintf(stderr, "STARTING CPP-SERVER\n"); - EXPECT_TRUE(system("sh ctl.sh start server cpp") == 0); - EXPECT_TRUE(system("./messagebus_test_cpp-client-error_app") == 0); - EXPECT_TRUE(system("../../binref/runjava JavaClient") == 0); - EXPECT_TRUE(system("sh ctl.sh stop server cpp") == 0); - } - { // JAVA SERVER - { // Make routing config - EXPECT_TRUE(system("cat routing-template.cfg | sed 's#session#java/session#' > routing.cfg") == 0); - } - fprintf(stderr, "STARTING JAVA-SERVER\n"); - EXPECT_TRUE(system("sh ctl.sh start server java") == 0); - EXPECT_TRUE(system("./messagebus_test_cpp-client-error_app") == 0); - EXPECT_TRUE(system("../../binref/runjava JavaClient") == 0); - EXPECT_TRUE(system("sh ctl.sh stop server java") == 0); - } - TEST_DONE(); -} diff --git a/messagebus/test/src/tests/error/error_test.sh b/messagebus/test/src/tests/error/error_test.sh deleted file mode 100755 index e2b567f5823..00000000000 --- a/messagebus/test/src/tests/error/error_test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e -. ../../binref/env.sh - -$BINREF/compilejava JavaServer.java -$BINREF/compilejava JavaClient.java -VESPA_LOG_LEVEL='all -spam' ./messagebus_test_error_test_app diff --git a/messagebus/test/src/tests/error/progdefs.sh b/messagebus/test/src/tests/error/progdefs.sh deleted file mode 100644 index 2f6f37a9425..00000000000 --- a/messagebus/test/src/tests/error/progdefs.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -prog server cpp "" "./messagebus_test_cpp-server-error_app" -prog server java "" "../../binref/runjava JavaServer" diff --git a/messagebus/test/src/tests/error/routing-template.cfg b/messagebus/test/src/tests/error/routing-template.cfg deleted file mode 100644 index 4b938c9cc82..00000000000 --- a/messagebus/test/src/tests/error/routing-template.cfg +++ /dev/null @@ -1,11 +0,0 @@ -routingtable[1] -routingtable[0].protocol "Simple" -routingtable[0].hop[1] -routingtable[0].hop[0].name "server" -routingtable[0].hop[0].selector "server/session" -routingtable[0].hop[0].recipient[1] -routingtable[0].hop[0].recipient[0] "server/session" -routingtable[0].route[1] -routingtable[0].route[0].name "test" -routingtable[0].route[0].hop[1] -routingtable[0].route[0].hop[0] "server" diff --git a/messagebus/test/src/tests/errorcodes/.gitignore b/messagebus/test/src/tests/errorcodes/.gitignore deleted file mode 100644 index 13957172a38..00000000000 --- a/messagebus/test/src/tests/errorcodes/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.depend -DumpCodes.class -Makefile -cpp-dump.txt -dumpcodes -java-dump.txt -messagebus_test_dumpcodes_app diff --git a/messagebus/test/src/tests/errorcodes/CMakeLists.txt b/messagebus/test/src/tests/errorcodes/CMakeLists.txt deleted file mode 100644 index 3e12ae340d3..00000000000 --- a/messagebus/test/src/tests/errorcodes/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(messagebus_test_dumpcodes_app TEST - SOURCES - dumpcodes.cpp - DEPENDS -) -vespa_add_test(NAME messagebus_test_dumpcodes_app NO_VALGRIND COMMAND sh errorcodes_test.sh) diff --git a/messagebus/test/src/tests/errorcodes/DESC b/messagebus/test/src/tests/errorcodes/DESC deleted file mode 100644 index 103ebb4698f..00000000000 --- a/messagebus/test/src/tests/errorcodes/DESC +++ /dev/null @@ -1,2 +0,0 @@ -A small test to check that error codes are equal in the Java and C++ -implementations. diff --git a/messagebus/test/src/tests/errorcodes/DumpCodes.java b/messagebus/test/src/tests/errorcodes/DumpCodes.java deleted file mode 100644 index 8eb97813404..00000000000 --- a/messagebus/test/src/tests/errorcodes/DumpCodes.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -import com.yahoo.messagebus.ErrorCode; - -public class DumpCodes { - - private static void dump(String desc, int value) { - String name = ErrorCode.getName(value); - System.out.printf("%s => %d => \"%s\"\n", desc, value, - name != null ? name : ""); - } - - public static void main(String[] args) { - dump("NONE", ErrorCode.NONE); - - dump("SEND_QUEUE_FULL", ErrorCode.SEND_QUEUE_FULL); - dump("NO_ADDRESS_FOR_SERVICE", ErrorCode.NO_ADDRESS_FOR_SERVICE); - dump("CONNECTION_ERROR", ErrorCode.CONNECTION_ERROR); - dump("UNKNOWN_SESSION", ErrorCode.UNKNOWN_SESSION); - dump("SESSION_BUSY", ErrorCode.SESSION_BUSY); - dump("SEND_ABORTED", ErrorCode.SEND_ABORTED); - dump("HANDSHAKE_FAILED", ErrorCode.HANDSHAKE_FAILED); - dump("first unused TRANSIENT_ERROR", ErrorCode.TRANSIENT_ERROR + 8); - - dump("SEND_QUEUE_CLOSED", ErrorCode.SEND_QUEUE_CLOSED); - dump("ILLEGAL_ROUTE", ErrorCode.ILLEGAL_ROUTE); - dump("NO_SERVICES_FOR_ROUTE", ErrorCode.NO_SERVICES_FOR_ROUTE); - dump("SERVICE_OOS", ErrorCode.SERVICE_OOS); - dump("ENCODE_ERROR", ErrorCode.ENCODE_ERROR); - dump("NETWORK_ERROR", ErrorCode.NETWORK_ERROR); - dump("UNKNOWN_PROTOCOL", ErrorCode.UNKNOWN_PROTOCOL); - dump("DECODE_ERROR", ErrorCode.DECODE_ERROR); - dump("TIMEOUT", ErrorCode.TIMEOUT); - dump("INCOMPATIBLE_VERSION", ErrorCode.INCOMPATIBLE_VERSION); - dump("UNKNOWN_POLICY", ErrorCode.UNKNOWN_POLICY); - dump("NETWORK_SHUTDOWN", ErrorCode.NETWORK_SHUTDOWN); - dump("POLICY_ERROR", ErrorCode.POLICY_ERROR); - dump("SEQUENCE_ERROR", ErrorCode.SEQUENCE_ERROR); - dump("first unused FATAL_ERROR", ErrorCode.FATAL_ERROR + 15); - - dump("max UNKNOWN below", ErrorCode.TRANSIENT_ERROR - 1); - dump("min TRANSIENT_ERROR", ErrorCode.TRANSIENT_ERROR); - dump("max TRANSIENT_ERROR", ErrorCode.TRANSIENT_ERROR + 49999); - dump("min APP_TRANSIENT_ERROR", ErrorCode.APP_TRANSIENT_ERROR); - dump("max APP_TRANSIENT_ERROR", ErrorCode.APP_TRANSIENT_ERROR + 49999); - dump("min FATAL_ERROR", ErrorCode.FATAL_ERROR); - dump("max FATAL_ERROR", ErrorCode.FATAL_ERROR + 49999); - dump("min APP_FATAL_ERROR", ErrorCode.APP_FATAL_ERROR); - dump("max APP_FATAL_ERROR", ErrorCode.APP_FATAL_ERROR + 49999); - dump("min UNKNOWN above", ErrorCode.ERROR_LIMIT); - } -} diff --git a/messagebus/test/src/tests/errorcodes/FILES b/messagebus/test/src/tests/errorcodes/FILES deleted file mode 100644 index 766402133fb..00000000000 --- a/messagebus/test/src/tests/errorcodes/FILES +++ /dev/null @@ -1,5 +0,0 @@ -dumpcodes.cpp -DumpCodes.java -ref-dump.txt -cpp-dump.txt -java-dump.txt diff --git a/messagebus/test/src/tests/errorcodes/dumpcodes.cpp b/messagebus/test/src/tests/errorcodes/dumpcodes.cpp deleted file mode 100644 index 121d8585726..00000000000 --- a/messagebus/test/src/tests/errorcodes/dumpcodes.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("dumpcodes"); -#include <vespa/messagebus/errorcode.h> -#include <string> - -using namespace mbus; - -class App : public FastOS_Application -{ -public: - void dump(const std::string &desc, uint32_t value); - int Main(); -}; - -void -App::dump(const std::string &desc, uint32_t value) -{ - fprintf(stdout, "%s => %u => \"%s\"\n", desc.c_str(), value, - ErrorCode::getName(value).c_str()); -} - -int -App::Main() -{ - dump("NONE", ErrorCode::NONE); - - dump("SEND_QUEUE_FULL", ErrorCode::SEND_QUEUE_FULL); - dump("NO_ADDRESS_FOR_SERVICE", ErrorCode::NO_ADDRESS_FOR_SERVICE); - dump("CONNECTION_ERROR", ErrorCode::CONNECTION_ERROR); - dump("UNKNOWN_SESSION", ErrorCode::UNKNOWN_SESSION); - dump("SESSION_BUSY", ErrorCode::SESSION_BUSY); - dump("SEND_ABORTED", ErrorCode::SEND_ABORTED); - dump("HANDSHAKE_FAILED", ErrorCode::HANDSHAKE_FAILED); - dump("first unused TRANSIENT_ERROR", ErrorCode::TRANSIENT_ERROR + 8); - - dump("SEND_QUEUE_CLOSED", ErrorCode::SEND_QUEUE_CLOSED); - dump("ILLEGAL_ROUTE", ErrorCode::ILLEGAL_ROUTE); - dump("NO_SERVICES_FOR_ROUTE", ErrorCode::NO_SERVICES_FOR_ROUTE); - dump("SERVICE_OOS", ErrorCode::SERVICE_OOS); - dump("ENCODE_ERROR", ErrorCode::ENCODE_ERROR); - dump("NETWORK_ERROR", ErrorCode::NETWORK_ERROR); - dump("UNKNOWN_PROTOCOL", ErrorCode::UNKNOWN_PROTOCOL); - dump("DECODE_ERROR", ErrorCode::DECODE_ERROR); - dump("TIMEOUT", ErrorCode::TIMEOUT); - dump("INCOMPATIBLE_VERSION", ErrorCode::INCOMPATIBLE_VERSION); - dump("UNKNOWN_POLICY", ErrorCode::UNKNOWN_POLICY); - dump("NETWORK_SHUTDOWN", ErrorCode::NETWORK_SHUTDOWN); - dump("POLICY_ERROR", ErrorCode::POLICY_ERROR); - dump("SEQUENCE_ERROR", ErrorCode::SEQUENCE_ERROR); - dump("first unused FATAL_ERROR", ErrorCode::FATAL_ERROR + 15); - - dump("max UNKNOWN below", ErrorCode::TRANSIENT_ERROR - 1); - dump("min TRANSIENT_ERROR", ErrorCode::TRANSIENT_ERROR); - dump("max TRANSIENT_ERROR", ErrorCode::TRANSIENT_ERROR + 49999); - dump("min APP_TRANSIENT_ERROR", ErrorCode::APP_TRANSIENT_ERROR); - dump("max APP_TRANSIENT_ERROR", ErrorCode::APP_TRANSIENT_ERROR + 49999); - dump("min FATAL_ERROR", ErrorCode::FATAL_ERROR); - dump("max FATAL_ERROR", ErrorCode::FATAL_ERROR + 49999); - dump("min APP_FATAL_ERROR", ErrorCode::APP_FATAL_ERROR); - dump("max APP_FATAL_ERROR", ErrorCode::APP_FATAL_ERROR + 49999); - dump("min UNKNOWN above", ErrorCode::ERROR_LIMIT); - return 0; -} - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus/test/src/tests/errorcodes/errorcodes_test.sh b/messagebus/test/src/tests/errorcodes/errorcodes_test.sh deleted file mode 100644 index 7c30378cd1a..00000000000 --- a/messagebus/test/src/tests/errorcodes/errorcodes_test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -e -. ../../binref/env.sh - -$BINREF/compilejava DumpCodes.java - -./messagebus_test_dumpcodes_app > cpp-dump.txt -$BINREF/runjava DumpCodes > java-dump.txt -diff -u ref-dump.txt cpp-dump.txt -diff -u ref-dump.txt java-dump.txt diff --git a/messagebus/test/src/tests/errorcodes/ref-dump.txt b/messagebus/test/src/tests/errorcodes/ref-dump.txt deleted file mode 100644 index b8038816897..00000000000 --- a/messagebus/test/src/tests/errorcodes/ref-dump.txt +++ /dev/null @@ -1,34 +0,0 @@ -NONE => 0 => "NONE" -SEND_QUEUE_FULL => 100001 => "SEND_QUEUE_FULL" -NO_ADDRESS_FOR_SERVICE => 100002 => "NO_ADDRESS_FOR_SERVICE" -CONNECTION_ERROR => 100003 => "CONNECTION_ERROR" -UNKNOWN_SESSION => 100004 => "UNKNOWN_SESSION" -SESSION_BUSY => 100005 => "SESSION_BUSY" -SEND_ABORTED => 100006 => "SEND_ABORTED" -HANDSHAKE_FAILED => 100007 => "HANDSHAKE_FAILED" -first unused TRANSIENT_ERROR => 100008 => "UNKNOWN(100008)" -SEND_QUEUE_CLOSED => 200001 => "SEND_QUEUE_CLOSED" -ILLEGAL_ROUTE => 200002 => "ILLEGAL_ROUTE" -NO_SERVICES_FOR_ROUTE => 200003 => "NO_SERVICES_FOR_ROUTE" -SERVICE_OOS => 200004 => "SERVICE_OOS" -ENCODE_ERROR => 200005 => "ENCODE_ERROR" -NETWORK_ERROR => 200006 => "NETWORK_ERROR" -UNKNOWN_PROTOCOL => 200007 => "UNKNOWN_PROTOCOL" -DECODE_ERROR => 200008 => "DECODE_ERROR" -TIMEOUT => 200009 => "TIMEOUT" -INCOMPATIBLE_VERSION => 200010 => "INCOMPATIBLE_VERSION" -UNKNOWN_POLICY => 200011 => "UNKNOWN_POLICY" -NETWORK_SHUTDOWN => 200012 => "NETWORK_SHUTDOWN" -POLICY_ERROR => 200013 => "POLICY_ERROR" -SEQUENCE_ERROR => 200014 => "SEQUENCE_ERROR" -first unused FATAL_ERROR => 200015 => "UNKNOWN(200015)" -max UNKNOWN below => 99999 => "UNKNOWN(99999)" -min TRANSIENT_ERROR => 100000 => "TRANSIENT_ERROR" -max TRANSIENT_ERROR => 149999 => "UNKNOWN(149999)" -min APP_TRANSIENT_ERROR => 150000 => "APP_TRANSIENT_ERROR" -max APP_TRANSIENT_ERROR => 199999 => "UNKNOWN(199999)" -min FATAL_ERROR => 200000 => "FATAL_ERROR" -max FATAL_ERROR => 249999 => "UNKNOWN(249999)" -min APP_FATAL_ERROR => 250000 => "APP_FATAL_ERROR" -max APP_FATAL_ERROR => 299999 => "UNKNOWN(299999)" -min UNKNOWN above => 300000 => "UNKNOWN(300000)" diff --git a/messagebus/test/src/tests/speed/.gitignore b/messagebus/test/src/tests/speed/.gitignore deleted file mode 100644 index 326da75ebb6..00000000000 --- a/messagebus/test/src/tests/speed/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.class -.depend -Makefile -cpp-client -cpp-server -out.* -pid.* -routing.cfg -slobrok.cfg -speed_test -cpp-client-speed -cpp-server-speed -messagebus_test_speed_test_app -messagebus_test_cpp-client-speed_app -messagebus_test_cpp-server-speed_app diff --git a/messagebus/test/src/tests/speed/CMakeLists.txt b/messagebus/test/src/tests/speed/CMakeLists.txt deleted file mode 100644 index 8e1018ec07c..00000000000 --- a/messagebus/test/src/tests/speed/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(messagebus_test_speed_test_app - SOURCES - speed.cpp - DEPENDS -) -vespa_add_test(NAME messagebus_test_speed_test_app COMMAND messagebus_test_speed_test_app BENCHMARK) -vespa_add_executable(messagebus_test_cpp-server-speed_app - SOURCES - cpp-server.cpp - DEPENDS -) -vespa_add_executable(messagebus_test_cpp-client-speed_app - SOURCES - cpp-client.cpp - DEPENDS -) diff --git a/messagebus/test/src/tests/speed/DESC b/messagebus/test/src/tests/speed/DESC deleted file mode 100644 index 10734957438..00000000000 --- a/messagebus/test/src/tests/speed/DESC +++ /dev/null @@ -1,4 +0,0 @@ -This is a simple test that gives a rough idea of the inherent overhead -in messagebus. It sends simple messages back and forth with the -simplest routing setup possible. This test also tests that messagebus -works across Java and C++. diff --git a/messagebus/test/src/tests/speed/FILES b/messagebus/test/src/tests/speed/FILES deleted file mode 100644 index 09f0a5ec1d3..00000000000 --- a/messagebus/test/src/tests/speed/FILES +++ /dev/null @@ -1,8 +0,0 @@ -speed.cpp -out.server.cpp -out.server.java -cpp-client.cpp -cpp-server.cpp -JavaClient.java -JavaServer.java -routing-template.cfg diff --git a/messagebus/test/src/tests/speed/JavaClient.java b/messagebus/test/src/tests/speed/JavaClient.java deleted file mode 100644 index b905ab07e91..00000000000 --- a/messagebus/test/src/tests/speed/JavaClient.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -import com.yahoo.messagebus.*; -import com.yahoo.messagebus.test.*; -import com.yahoo.config.*; -import com.yahoo.messagebus.routing.*; -import com.yahoo.messagebus.network.*; -import com.yahoo.messagebus.network.rpc.*; -import java.util.Arrays; -import java.util.logging.*; - -public class JavaClient implements ReplyHandler { - - private static Logger log = Logger.getLogger(JavaClient.class.getName()); - - private static class Counts { - public int okCnt = 0; - public int failCnt = 0; - Counts() {} - Counts(int okCnt, int failCnt) { - this.okCnt = okCnt; - this.failCnt = failCnt; - } - } - - private SourceSession session; - private Counts counts = new Counts(); - private static long mySeq = 100000; - - public JavaClient(RPCMessageBus mb) { - session = mb.getMessageBus().createSourceSession(this, new SourceSessionParams().setTimeout(30)); - } - - public synchronized Counts sample() { - return new Counts(counts.okCnt, counts.failCnt); - } - - public void send() { - send(++mySeq); - } - - public void send(long seq) { - session.send(new MyMessage(seq), "test"); - } - - public void handleReply(Reply reply) { - if ((reply.getProtocol() == SimpleProtocol.NAME) - && (reply.getType() == SimpleProtocol.REPLY) - && (((SimpleReply)reply).getValue().equals("OK"))) - { - synchronized (this) { - counts.okCnt++; - } - } else { - synchronized (this) { - counts.failCnt++; - } - } - try { - send(); - } catch (IllegalStateException ignore) {} // handle paranoia for shutdown source sessions - } - - public void shutdown() { - session.destroy(); - } - - public static void main(String[] args) { - try { - RPCMessageBus mb = new RPCMessageBus( - new MessageBusParams() - .setRetryPolicy(new RetryTransientErrorsPolicy().setBaseDelay(0.1)) - .addProtocol(new SimpleProtocol()), - new RPCNetworkParams() - .setIdentity(new Identity("server/java")) - .setSlobrokConfigId("file:slobrok.cfg"), - "file:routing.cfg"); - JavaClient client = new JavaClient(mb); - - // let the system 'warm up' - Thread.sleep(5000); - - // inject messages into the feedback loop - for (int i = 0; i < 1024; ++i) { - client.send(i); - } - - // let the system 'warm up' - Thread.sleep(5000); - - long start; - long stop; - Counts before; - Counts after; - - start = System.currentTimeMillis(); - before = client.sample(); - Thread.sleep(10000); // Benchmark time - stop = System.currentTimeMillis(); - after = client.sample(); - stop -= start; - double time = (double)stop; - double msgCnt = (double)(after.okCnt - before.okCnt); - double throughput = (msgCnt / time) * 1000.0; - System.out.printf("JAVA-CLIENT: %g msg/s\n", throughput); - client.shutdown(); - mb.destroy(); - if (after.failCnt > before.failCnt) { - System.err.printf("JAVA-CLIENT: FAILED (%d -> %d)\n", - before.failCnt, after.failCnt); - System.exit(1); - } - } catch (Exception e) { - log.log(Level.SEVERE, "JAVA-CLIENT: Failed", e); - System.exit(1); - } - } - - private static class MyMessage extends SimpleMessage { - - final long seqId; - - MyMessage(long seqId) { - super("message"); - this.seqId = seqId; - } - - @Override - public boolean hasSequenceId() { - return true; - } - - @Override - public long getSequenceId() { - return seqId; - } - } -} diff --git a/messagebus/test/src/tests/speed/JavaServer.java b/messagebus/test/src/tests/speed/JavaServer.java deleted file mode 100644 index afec6dcdba2..00000000000 --- a/messagebus/test/src/tests/speed/JavaServer.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -import com.yahoo.messagebus.*; -import com.yahoo.messagebus.test.*; -import com.yahoo.config.*; -import com.yahoo.messagebus.routing.*; -import com.yahoo.messagebus.network.*; -import com.yahoo.messagebus.network.rpc.*; -import java.util.Arrays; -import java.util.logging.*; - -public class JavaServer implements MessageHandler { - - private static Logger log = Logger.getLogger(JavaServer.class.getName()); - - private DestinationSession session; - - public JavaServer(RPCMessageBus mb) { - session = mb.getMessageBus().createDestinationSession("session", true, this); - } - - public void handleMessage(Message msg) { - if ((msg.getProtocol() == SimpleProtocol.NAME) - && (msg.getType() == SimpleProtocol.MESSAGE) - && (((SimpleMessage)msg).getValue().equals("message"))) - { - Reply reply = new SimpleReply("OK"); - msg.swapState(reply); - session.reply(reply); - } else { - Reply reply = new SimpleReply("FAIL"); - msg.swapState(reply); - session.reply(reply); - } - } - - public static void main(String[] args) { - try { - RPCMessageBus mb = new RPCMessageBus( - Arrays.asList((Protocol)new SimpleProtocol()), - new RPCNetworkParams() - .setIdentity(new Identity("server/java")) - .setSlobrokConfigId("file:slobrok.cfg"), - "file:routing.cfg"); - JavaServer server = new JavaServer(mb); - System.out.println("java server started"); - while (true) { - Thread.sleep(1000); - } - } catch (Exception e) { - log.log(Level.SEVERE, "JAVA-SERVER: Failed", e); - System.exit(1); - } - } -} diff --git a/messagebus/test/src/tests/speed/cpp-client.cpp b/messagebus/test/src/tests/speed/cpp-client.cpp deleted file mode 100644 index c0c9d621a20..00000000000 --- a/messagebus/test/src/tests/speed/cpp-client.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("cpp-client"); -#include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/routing/retrytransienterrorspolicy.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/sourcesession.h> -#include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/vespalib/util/sync.h> - -using namespace mbus; - -class Client : public IReplyHandler -{ -private: - vespalib::Lock _lock; - uint32_t _okCnt; - uint32_t _failCnt; - SourceSession::UP _session; - static uint64_t _seq; -public: - Client(MessageBus &bus, const SourceSessionParams ¶ms); - ~Client(); - void send(); - void send(uint64_t seq); - void sample(uint32_t &okCnt, uint32_t &failCnt); - void handleReply(Reply::UP reply); -}; -uint64_t Client::_seq = 100000; - -Client::Client(MessageBus &bus, const SourceSessionParams ¶ms) - : _lock(), - _okCnt(0), - _failCnt(0), - _session(bus.createSourceSession(*this, params)) -{ -} - -Client::~Client() -{ - _session->close(); -} - -void -Client::send() { - send(++_seq); -} - -void -Client::send(uint64_t seq) { - Message::UP msg(new SimpleMessage("message", true, seq)); - _session->send(std::move(msg), "test"); -} - -void -Client::sample(uint32_t &okCnt, uint32_t &failCnt) { - vespalib::LockGuard guard(_lock); - okCnt = _okCnt; - failCnt = _failCnt; -} - -void -Client::handleReply(Reply::UP reply) { - if ((reply->getProtocol() == SimpleProtocol::NAME) - && (reply->getType() == SimpleProtocol::REPLY) - && (static_cast<SimpleReply&>(*reply).getValue() == "OK")) - { - vespalib::LockGuard guard(_lock); - ++_okCnt; - } else { - fprintf(stderr, "BAD REPLY\n"); - for (uint32_t i = 0; i < reply->getNumErrors(); ++i) { - fprintf(stderr, "ERR[%d]: code=%d, msg=%s\n", i, - reply->getError(i).getCode(), - reply->getError(i).getMessage().c_str()); - } - vespalib::LockGuard guard(_lock); - ++_failCnt; - } - send(); -} - -class App : public FastOS_Application -{ -public: - int Main(); -}; - -int -App::Main() -{ - RetryTransientErrorsPolicy::SP retryPolicy(new RetryTransientErrorsPolicy()); - retryPolicy->setBaseDelay(0.1); - RPCMessageBus mb(MessageBusParams().setRetryPolicy(retryPolicy).addProtocol(IProtocol::SP(new SimpleProtocol())), - RPCNetworkParams().setIdentity(Identity("server/cpp")).setSlobrokConfig("file:slobrok.cfg"), - "file:routing.cfg"); - Client client(mb.getMessageBus(), SourceSessionParams().setTimeout(30)); - - // let the system 'warm up' - FastOS_Thread::Sleep(5000); - - // inject messages into the feedback loop - for (uint32_t i = 0; i < 1024; ++i) { - client.send(i); - } - - // let the system 'warm up' - FastOS_Thread::Sleep(5000); - - FastOS_Time start; - FastOS_Time stop; - uint32_t okBefore = 0; - uint32_t okAfter = 0; - uint32_t failBefore = 0; - uint32_t failAfter = 0; - - start.SetNow(); - client.sample(okBefore, failBefore); - FastOS_Thread::Sleep(10000); // Benchmark time - stop.SetNow(); - client.sample(okAfter, failAfter); - stop -= start; - double time = stop.MilliSecs(); - double msgCnt = (double)(okAfter - okBefore); - double throughput = (msgCnt / time) * 1000.0; - fprintf(stdout, "CPP-CLIENT: %g msg/s\n", throughput); - if (failAfter > failBefore) { - fprintf(stderr, "CPP-CLIENT: FAILED (%d -> %d)\n", failBefore, failAfter); - return 1; - } - return 0; -} - -int main(int argc, char **argv) { - fprintf(stderr, "started '%s'\n", argv[0]); - fflush(stderr); - App app; - int r = app.Entry(argc, argv); - fprintf(stderr, "stopping '%s'\n", argv[0]); - fflush(stderr); - return r; -} diff --git a/messagebus/test/src/tests/speed/cpp-server.cpp b/messagebus/test/src/tests/speed/cpp-server.cpp deleted file mode 100644 index c2cd9bf262a..00000000000 --- a/messagebus/test/src/tests/speed/cpp-server.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("cpp-server"); -#include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> - -using namespace mbus; - -class Server : public IMessageHandler -{ -private: - DestinationSession::UP _session; -public: - Server(MessageBus &bus); - ~Server(); - void handleMessage(Message::UP msg); -}; - -Server::Server(MessageBus &bus) - : _session(bus.createDestinationSession("session", true, *this)) -{ - fprintf(stderr, "cpp server started\n"); -} - -Server::~Server() -{ - _session.reset(); -} - -void -Server::handleMessage(Message::UP msg) { - if ((msg->getProtocol() == SimpleProtocol::NAME) - && (msg->getType() == SimpleProtocol::MESSAGE) - && (static_cast<SimpleMessage&>(*msg).getValue() == "message")) - { - Reply::UP reply(new SimpleReply("OK")); - msg->swapState(*reply); - _session->reply(std::move(reply)); - } else { - Reply::UP reply(new SimpleReply("FAIL")); - msg->swapState(*reply); - _session->reply(std::move(reply)); - } -} - -class App : public FastOS_Application -{ -public: - int Main(); -}; - -int -App::Main() -{ - RPCMessageBus mb(ProtocolSet().add(IProtocol::SP(new SimpleProtocol())), - RPCNetworkParams() - .setIdentity(Identity("server/cpp")) - .setSlobrokConfig("file:slobrok.cfg"), - "file:routing.cfg"); - Server server(mb.getMessageBus()); - while (true) { - FastOS_Thread::Sleep(1000); - } - return 0; -} - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus/test/src/tests/speed/ctl.sh b/messagebus/test/src/tests/speed/ctl.sh deleted file mode 100755 index 864be4290ed..00000000000 --- a/messagebus/test/src/tests/speed/ctl.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -exec ../../binref/progctl.sh progdefs.sh "$@" diff --git a/messagebus/test/src/tests/speed/progdefs.sh b/messagebus/test/src/tests/speed/progdefs.sh deleted file mode 100644 index 4e0390142cf..00000000000 --- a/messagebus/test/src/tests/speed/progdefs.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -prog server cpp "" "./messagebus_test_cpp-server-speed_app" -prog server java "" "../../binref/runjava JavaServer" diff --git a/messagebus/test/src/tests/speed/routing-template.cfg b/messagebus/test/src/tests/speed/routing-template.cfg deleted file mode 100644 index 4b938c9cc82..00000000000 --- a/messagebus/test/src/tests/speed/routing-template.cfg +++ /dev/null @@ -1,11 +0,0 @@ -routingtable[1] -routingtable[0].protocol "Simple" -routingtable[0].hop[1] -routingtable[0].hop[0].name "server" -routingtable[0].hop[0].selector "server/session" -routingtable[0].hop[0].recipient[1] -routingtable[0].hop[0].recipient[0] "server/session" -routingtable[0].route[1] -routingtable[0].route[0].name "test" -routingtable[0].route[0].hop[1] -routingtable[0].route[0].hop[0] "server" diff --git a/messagebus/test/src/tests/speed/speed.cpp b/messagebus/test/src/tests/speed/speed.cpp deleted file mode 100644 index 31ea419ce5c..00000000000 --- a/messagebus/test/src/tests/speed/speed.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("speed_test"); -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/vespalib/util/stringfmt.h> - -using namespace mbus; -using vespalib::make_string; - -TEST_SETUP(Test); - -int -Test::Main() -{ - TEST_INIT("speed_test"); - Slobrok slobrok; - { // Make slobrok config - EXPECT_EQUAL(system("echo slobrok[1] > slobrok.cfg"), 0); - EXPECT_EQUAL(system(make_string("echo 'slobrok[0].connectionspec tcp/localhost:%d' " - ">> slobrok.cfg", slobrok.port()).c_str()), 0); - } - { // CPP SERVER - { // Make routing config - EXPECT_EQUAL(system("cat routing-template.cfg | sed 's#session#cpp/session#' > routing.cfg"), 0); - } - fprintf(stderr, "STARTING CPP-SERVER\n"); - EXPECT_EQUAL(system("sh ctl.sh start server cpp"), 0); - fprintf(stderr, "STARTING CPP-CLIENT\n"); - EXPECT_EQUAL(system("./messagebus_test_cpp-client-speed_app"), 0); - fprintf(stderr, "STARTING JAVA-CLIENT\n"); - EXPECT_EQUAL(system("../../binref/runjava JavaClient"), 0); - fprintf(stderr, "STOPPING\n"); - EXPECT_EQUAL(system("sh ctl.sh stop server cpp"), 0); - } - { // JAVA SERVER - { // Make routing config - EXPECT_EQUAL(system("cat routing-template.cfg | sed 's#session#java/session#' > routing.cfg"), 0); - } - fprintf(stderr, "STARTING JAVA-SERVER\n"); - EXPECT_EQUAL(system("sh ctl.sh start server java"), 0); - fprintf(stderr, "STARTING CPP-CLIENT\n"); - EXPECT_EQUAL(system("./messagebus_test_cpp-client-speed_app"), 0); - fprintf(stderr, "STARTING JAVA-CLIENT\n"); - EXPECT_EQUAL(system("../../binref/runjava JavaClient"), 0); - fprintf(stderr, "STOPPING\n"); - EXPECT_EQUAL(system("sh ctl.sh stop server java"), 0); - } - TEST_DONE(); -} diff --git a/messagebus/test/src/tests/speed/speed_test.sh b/messagebus/test/src/tests/speed/speed_test.sh deleted file mode 100644 index 77eb7e63e0c..00000000000 --- a/messagebus/test/src/tests/speed/speed_test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e - -. ../../binref/env.sh - -$BINREF/compilejava JavaServer.java -$BINREF/compilejava JavaClient.java - -(ulimit -c; ulimit -H -c; ulimit -c unlimited; ./messagebus_test_speed_test_app) diff --git a/messagebus/test/src/tests/trace/.gitignore b/messagebus/test/src/tests/trace/.gitignore deleted file mode 100644 index 1be907ec2f8..00000000000 --- a/messagebus/test/src/tests/trace/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.class -.depend -Makefile -cpp-server -out.* -pid.* -routing.cfg -slobrok.cfg -trace_test -/cpp-server-trace -messagebus_test_trace_test_app -messagebus_test_cpp-server-trace_app diff --git a/messagebus/test/src/tests/trace/CMakeLists.txt b/messagebus/test/src/tests/trace/CMakeLists.txt deleted file mode 100644 index af539fa2818..00000000000 --- a/messagebus/test/src/tests/trace/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(messagebus_test_trace_test_app TEST - SOURCES - trace.cpp - DEPENDS -) -vespa_add_executable(messagebus_test_cpp-server-trace_app - SOURCES - cpp-server.cpp - DEPENDS -) -vespa_add_test(NAME messagebus_test_trace_test_app NO_VALGRIND COMMAND sh trace_test.sh - DEPENDS messagebus_test_trace_test_app messagebus_test_cpp-server-trace_app) diff --git a/messagebus/test/src/tests/trace/DESC b/messagebus/test/src/tests/trace/DESC deleted file mode 100644 index 452e75aefea..00000000000 --- a/messagebus/test/src/tests/trace/DESC +++ /dev/null @@ -1 +0,0 @@ -trace test. Take a look at trace.cpp for details. diff --git a/messagebus/test/src/tests/trace/FILES b/messagebus/test/src/tests/trace/FILES deleted file mode 100644 index 891e4df6273..00000000000 --- a/messagebus/test/src/tests/trace/FILES +++ /dev/null @@ -1,19 +0,0 @@ -trace.cpp -cpp-server.cpp -JavaServer.java -routing.cfg -out.server.cpp1 -out.server.cpp2 -out.server.cpp3 -out.server.cpp4 -out.server.cpp5 -out.server.cpp6 -out.server.cpp7 -out.server.java1 -out.server.java2 -out.server.java3 -out.server.java4 -out.server.java5 -out.server.java6 -out.server.java7 -progdefs.sh diff --git a/messagebus/test/src/tests/trace/JavaServer.java b/messagebus/test/src/tests/trace/JavaServer.java deleted file mode 100644 index 5dfe15e3d0b..00000000000 --- a/messagebus/test/src/tests/trace/JavaServer.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -import com.yahoo.messagebus.*; -import com.yahoo.messagebus.test.*; -import com.yahoo.config.*; -import com.yahoo.messagebus.routing.*; -import com.yahoo.messagebus.network.*; -import com.yahoo.messagebus.network.rpc.*; -import java.util.Arrays; -import java.util.logging.*; - -public class JavaServer implements MessageHandler, ReplyHandler { - - private static Logger log = Logger.getLogger(JavaServer.class.getName()); - - private IntermediateSession session; - private String name; - - public JavaServer(RPCMessageBus mb, String name) { - session = mb.getMessageBus().createIntermediateSession("session", true, this, this); - this.name = name; - } - - public void handleMessage(Message msg) { - msg.getTrace().trace(1, name + " (message)", false); - if (msg.getRoute() == null || !msg.getRoute().hasHops()) { - System.out.println("**** Server '" + name + "' replying."); - Reply reply = new EmptyReply(); - msg.swapState(reply); - handleReply(reply); - } else { - System.out.println("**** Server '" + name + "' forwarding message."); - session.forward(msg); - } - } - - public void handleReply(Reply reply) { - reply.getTrace().trace(1, name + " (reply)", false); - session.forward(reply); - } - - public static void main(String[] args) { - if (args.length != 1) { - System.err.println("usage: JavaServer <service prefix>"); - System.exit(1); - } - String name = args[0]; - SimpleProtocol protocol = new SimpleProtocol(); - protocol.addPolicyFactory("All", new SimpleProtocol.PolicyFactory() { - @Override - public RoutingPolicy create(String param) { - return new AllPolicy(); - } - }); - try { - RPCMessageBus mb = new RPCMessageBus( - Arrays.<Protocol>asList(protocol), - new RPCNetworkParams() - .setIdentity(new Identity(name)) - .setSlobrokConfigId("file:slobrok.cfg"), - "file:routing.cfg"); - JavaServer server = new JavaServer(mb, name); - System.out.printf("java server started name=%s\n", name); - while (true) { - Thread.sleep(1000); - } - } catch (Exception e) { - log.log(Level.SEVERE, "JAVA-SERVER: Failed", e); - System.exit(1); - } - } - - private static class AllPolicy implements RoutingPolicy { - - @Override - public void select(RoutingContext ctx) { - ctx.addChildren(ctx.getMatchedRecipients()); - } - - @Override - public void merge(RoutingContext ctx) { - EmptyReply ret = new EmptyReply(); - for (RoutingNodeIterator it = ctx.getChildIterator(); - it.isValid(); it.next()) { - Reply reply = it.getReplyRef(); - for (int i = 0; i < reply.getNumErrors(); ++i) { - ret.addError(reply.getError(i)); - } - } - ctx.setReply(ret); - } - - @Override - public void destroy() { - - } - } -} diff --git a/messagebus/test/src/tests/trace/cpp-server.cpp b/messagebus/test/src/tests/trace/cpp-server.cpp deleted file mode 100644 index 76e20bc3cfd..00000000000 --- a/messagebus/test/src/tests/trace/cpp-server.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("cpp-server"); -#include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/iprotocol.h> -#include <vespa/messagebus/protocolset.h> -#include <vespa/messagebus/emptyreply.h> - -using namespace mbus; - -class Server : public IMessageHandler, - public IReplyHandler -{ -private: - IntermediateSession::UP _session; - std::string _name; -public: - Server(MessageBus &bus, const std::string &name); - ~Server(); - void handleMessage(Message::UP msg); - void handleReply(Reply::UP reply); -}; - -Server::Server(MessageBus &bus, const std::string &name) - : _session(bus.createIntermediateSession("session", true, *this, *this)), - _name(name) -{ - fprintf(stderr, "cpp server started: %s\n", _name.c_str()); -} - -Server::~Server() -{ - _session.reset(); -} - -void -Server::handleMessage(Message::UP msg) { - msg->getTrace().trace(1, _name + " (message)", false); - if (!msg->getRoute().hasHops()) { - fprintf(stderr, "**** Server '%s' replying.\n", _name.c_str()); - Reply::UP reply(new EmptyReply()); - msg->swapState(*reply); - handleReply(std::move(reply)); - } else { - fprintf(stderr, "**** Server '%s' forwarding message.\n", _name.c_str()); - _session->forward(std::move(msg)); - } -} - -void -Server::handleReply(Reply::UP reply) { - reply->getTrace().trace(1, _name + " (reply)", false); - _session->forward(std::move(reply)); -} - -class App : public FastOS_Application -{ -public: - int Main(); -}; - -int -App::Main() -{ - if (_argc != 2) { - fprintf(stderr, "usage: %s <service-prefix>\n", _argv[0]); - return 1; - } - RPCMessageBus mb(ProtocolSet().add(IProtocol::SP(new SimpleProtocol())), - RPCNetworkParams() - .setIdentity(Identity(_argv[1])) - .setSlobrokConfig("file:slobrok.cfg"), - "file:routing.cfg"); - Server server(mb.getMessageBus(), _argv[1]); - while (true) { - FastOS_Thread::Sleep(1000); - } - return 0; -} - -int main(int argc, char **argv) { - App app; - return app.Entry(argc, argv); -} diff --git a/messagebus/test/src/tests/trace/ctl.sh b/messagebus/test/src/tests/trace/ctl.sh deleted file mode 100755 index 864be4290ed..00000000000 --- a/messagebus/test/src/tests/trace/ctl.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -exec ../../binref/progctl.sh progdefs.sh "$@" diff --git a/messagebus/test/src/tests/trace/progdefs.sh b/messagebus/test/src/tests/trace/progdefs.sh deleted file mode 100644 index fd35b6503e2..00000000000 --- a/messagebus/test/src/tests/trace/progdefs.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -prog server cpp1 "" "./messagebus_test_cpp-server-trace_app server/cpp/1/A" -prog server cpp2 "" "./messagebus_test_cpp-server-trace_app server/cpp/2/A" -prog server cpp3 "" "./messagebus_test_cpp-server-trace_app server/cpp/2/B" -prog server cpp4 "" "./messagebus_test_cpp-server-trace_app server/cpp/3/A" -prog server cpp5 "" "./messagebus_test_cpp-server-trace_app server/cpp/3/B" -prog server cpp6 "" "./messagebus_test_cpp-server-trace_app server/cpp/3/C" -prog server cpp7 "" "./messagebus_test_cpp-server-trace_app server/cpp/3/D" -prog server java1 "" "../../binref/runjava JavaServer server/java/1/A" -prog server java2 "" "../../binref/runjava JavaServer server/java/2/A" -prog server java3 "" "../../binref/runjava JavaServer server/java/2/B" -prog server java4 "" "../../binref/runjava JavaServer server/java/3/A" -prog server java5 "" "../../binref/runjava JavaServer server/java/3/B" -prog server java6 "" "../../binref/runjava JavaServer server/java/3/C" -prog server java7 "" "../../binref/runjava JavaServer server/java/3/D" diff --git a/messagebus/test/src/tests/trace/trace.cpp b/messagebus/test/src/tests/trace/trace.cpp deleted file mode 100644 index 94550460c84..00000000000 --- a/messagebus/test/src/tests/trace/trace.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("trace_test"); -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/vespalib/util/stringfmt.h> -#include <vespa/messagebus/emptyreply.h> -#include <vespa/messagebus/messagebus.h> -#include <vespa/messagebus/sourcesession.h> -#include <vespa/messagebus/rpcmessagebus.h> -#include <vespa/messagebus/intermediatesession.h> -#include <vespa/messagebus/destinationsession.h> -#include <vespa/messagebus/testlib/slobrok.h> -#include <vespa/messagebus/testlib/testserver.h> -#include <vespa/messagebus/routing/routingspec.h> -#include <vespa/messagebus/testlib/receptor.h> -#include <vespa/messagebus/sourcesessionparams.h> -#include <vespa/messagebus/testlib/simplemessage.h> -#include <vespa/messagebus/testlib/simplereply.h> -#include <vespa/messagebus/testlib/simpleprotocol.h> -#include <iostream> - -using namespace mbus; -using vespalib::make_string; - -TEST_SETUP(Test); - -bool -waitSlobrok(RPCMessageBus &mbus, const std::string &pattern) -{ - for (int i = 0; i < 30000; i++) { - slobrok::api::MirrorAPI::SpecList res = mbus.getRPCNetwork().getMirror().lookup(pattern); - if (res.size() > 0) { - return true; - } - FastOS_Thread::Sleep(10); - } - return false; -} - -int -Test::Main() -{ - TEST_INIT("trace_test"); - Slobrok slobrok; - { // Make slobrok config - EXPECT_TRUE(system("echo slobrok[1] > slobrok.cfg") == 0); - EXPECT_TRUE(system(make_string("echo 'slobrok[0].connectionspec tcp/localhost:%d' " - ">> slobrok.cfg", slobrok.port()).c_str()) == 0); - } - EXPECT_TRUE(system("sh ctl.sh start all") == 0); - RPCMessageBus mb(ProtocolSet().add(IProtocol::SP(new SimpleProtocol())), - RPCNetworkParams().setSlobrokConfig("file:slobrok.cfg"), - "file:routing.cfg"); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/1/A/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/2/A/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/2/B/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/3/A/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/3/B/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/3/C/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/cpp/3/D/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/1/A/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/2/A/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/2/B/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/3/A/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/3/B/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/3/C/session")); - EXPECT_TRUE(waitSlobrok(mb, "server/java/3/D/session")); - - TraceNode e3 = TraceNode() - .addChild(TraceNode().addChild("server/cpp/3/A (message)").addChild("server/cpp/3/A (reply)")) - .addChild(TraceNode().addChild("server/cpp/3/B (message)").addChild("server/cpp/3/B (reply)")) - .addChild(TraceNode().addChild("server/cpp/3/C (message)").addChild("server/cpp/3/C (reply)")) - .addChild(TraceNode().addChild("server/cpp/3/D (message)").addChild("server/cpp/3/D (reply)")) - .addChild(TraceNode().addChild("server/java/3/A (message)").addChild("server/java/3/A (reply)")) - .addChild(TraceNode().addChild("server/java/3/B (message)").addChild("server/java/3/B (reply)")) - .addChild(TraceNode().addChild("server/java/3/C (message)").addChild("server/java/3/C (reply)")) - .addChild(TraceNode().addChild("server/java/3/D (message)").addChild("server/java/3/D (reply)")).setStrict(false); - TraceNode e2 = TraceNode() - .addChild(TraceNode().addChild("server/cpp/2/A (message)").addChild(e3).addChild("server/cpp/2/A (reply)")) - .addChild(TraceNode().addChild("server/cpp/2/B (message)").addChild(e3).addChild("server/cpp/2/B (reply)")) - .addChild(TraceNode().addChild("server/java/2/A (message)").addChild(e3).addChild("server/java/2/A (reply)")) - .addChild(TraceNode().addChild("server/java/2/B (message)").addChild(e3).addChild("server/java/2/B (reply)")).setStrict(false); - TraceNode expect = TraceNode() - .addChild(TraceNode().addChild("server/cpp/1/A (message)").addChild(e2).addChild("server/cpp/1/A (reply)")) - .addChild(TraceNode().addChild("server/java/1/A (message)").addChild(e2).addChild("server/java/1/A (reply)")).setStrict(false); - expect.normalize(); - - Receptor src; - Reply::UP reply; - SourceSession::UP ss = mb.getMessageBus().createSourceSession(src, SourceSessionParams()); - for (int i = 0; i < 50; ++i) { - Message::UP msg(new SimpleMessage("test")); - msg->getTrace().setLevel(1); - ss->send(std::move(msg), "test"); - reply = src.getReply(10); - if (reply.get() != NULL) { - reply->getTrace().getRoot().normalize(); - // resending breaks the trace, so retry until it has expected form - if (!reply->hasErrors() && reply->getTrace().getRoot().encode() == expect.encode()) { - break; - } - } - std::cout << "Attempt " << i << " got errors, retrying in 1 second.." << std::endl; - FastOS_Thread::Sleep(1000); - } - - EXPECT_TRUE(!reply->hasErrors()); - EXPECT_EQUAL(reply->getTrace().getRoot().encode(), expect.encode()); - EXPECT_TRUE(system("sh ctl.sh stop all") == 0); - TEST_DONE(); -} diff --git a/messagebus/test/src/tests/trace/trace_test.sh b/messagebus/test/src/tests/trace/trace_test.sh deleted file mode 100644 index 63005385332..00000000000 --- a/messagebus/test/src/tests/trace/trace_test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -. ../../binref/env.sh - -$BINREF/compilejava JavaServer.java - -./messagebus_test_trace_test_app diff --git a/messagebus/test/testrun/.gitignore b/messagebus/test/testrun/.gitignore deleted file mode 100644 index b29b0c6486c..00000000000 --- a/messagebus/test/testrun/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -test-report.html -test-report.html.* -test.*.*.desc -test.*.*.file.* -test.*.*.files.html -test.*.*.log -tmp.* -xsync.log -/test.*.*.result |