aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus_test/src/tests/error
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-09-14 00:13:11 +0200
committerGitHub <noreply@github.com>2016-09-14 00:13:11 +0200
commit0836f0bf337ee23c5e66f420cfa54d49e4a2104e (patch)
tree403c361cd30043cc3de04483489cfa8e25fe0ff3 /messagebus_test/src/tests/error
parent4537f2d1e36f41e74f348258aecf448b77ef1799 (diff)
Revert "Aressem/move messagebus test tests to separate module"
Diffstat (limited to 'messagebus_test/src/tests/error')
-rw-r--r--messagebus_test/src/tests/error/.gitignore15
-rw-r--r--messagebus_test/src/tests/error/CMakeLists.txt21
-rw-r--r--messagebus_test/src/tests/error/DESC2
-rw-r--r--messagebus_test/src/tests/error/FILES8
-rw-r--r--messagebus_test/src/tests/error/JavaClient.java65
-rw-r--r--messagebus_test/src/tests/error/JavaServer.java47
-rw-r--r--messagebus_test/src/tests/error/cpp-client.cpp75
-rw-r--r--messagebus_test/src/tests/error/cpp-server.cpp73
-rwxr-xr-xmessagebus_test/src/tests/error/ctl.sh10
-rw-r--r--messagebus_test/src/tests/error/error.cpp49
-rwxr-xr-xmessagebus_test/src/tests/error/error_test.sh12
-rw-r--r--messagebus_test/src/tests/error/progdefs.sh3
-rw-r--r--messagebus_test/src/tests/error/routing-template.cfg11
13 files changed, 0 insertions, 391 deletions
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 926047f31cd..00000000000
--- a/messagebus_test/src/tests/error/CMakeLists.txt
+++ /dev/null
@@ -1,21 +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
- messagebus_messagebus-test
-)
-vespa_add_executable(messagebus_test_cpp-server-error_app
- SOURCES
- cpp-server.cpp
- DEPENDS
- messagebus_messagebus-test
-)
-vespa_add_executable(messagebus_test_cpp-client-error_app
- SOURCES
- cpp-client.cpp
- DEPENDS
- messagebus_messagebus-test
-)
-vespa_add_test(NAME messagebus_test_error_test_app NO_VALGRIND COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/error_test.sh
- DEPENDS messagebus_test_error_test_app messagebus_test_cpp-server-error_app messagebus_test_cpp-client-error_app)
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 ca4fc7701e6..00000000000
--- a/messagebus_test/src/tests/error/ctl.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-if [ -z "$SOURCE_DIRECTORY" ]; then
- SOURCE_DIRECTORY="."
-fi
-
-. ../../binref/env.sh
-
-exec $SOURCE_DIRECTORY/../../binref/progctl.sh $SOURCE_DIRECTORY/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 749874a5ef2..00000000000
--- a/messagebus_test/src/tests/error/error.cpp
+++ /dev/null
@@ -1,49 +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/vespalib/testkit/test_kit.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;
- const std::string routing_template = TEST_PATH("routing-template.cfg");
- const std::string ctl_script = TEST_PATH("ctl.sh");
-
- { // 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 + " | sed 's#session#cpp/session#' > routing.cfg").c_str()) == 0);
- }
- fprintf(stderr, "STARTING CPP-SERVER\n");
- EXPECT_TRUE(system((ctl_script + " start server cpp").c_str()) == 0);
- EXPECT_TRUE(system("./messagebus_test_cpp-client-error_app") == 0);
- EXPECT_TRUE(system("../../binref/runjava JavaClient") == 0);
- EXPECT_TRUE(system((ctl_script + " stop server cpp").c_str()) == 0);
- }
- { // JAVA SERVER
- { // Make routing config
- EXPECT_TRUE(system(("cat " + routing_template + " | sed 's#session#java/session#' > routing.cfg").c_str()) == 0);
- }
- fprintf(stderr, "STARTING JAVA-SERVER\n");
- EXPECT_TRUE(system((ctl_script + " start server java").c_str()) == 0);
- EXPECT_TRUE(system("./messagebus_test_cpp-client-error_app") == 0);
- EXPECT_TRUE(system("../../binref/runjava JavaClient") == 0);
- EXPECT_TRUE(system((ctl_script + " stop server java").c_str()) == 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 0c39f3d1ad3..00000000000
--- a/messagebus_test/src/tests/error/error_test.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-set -e
-
-if [ -z "$SOURCE_DIRECTORY" ]; then
- SOURCE_DIRECTORY="."
-fi
-
-. ../../binref/env.sh
-
-$BINREF/compilejava $SOURCE_DIRECTORY/JavaServer.java
-$BINREF/compilejava $SOURCE_DIRECTORY/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 47d02d95b93..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"