Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

flush out integration / stress test

  • Loading branch information...
commit 76d1aeebb9276f18eb267ca31ab28ec74ae9fe6e 1 parent fa8b08f
@movitto authored
View
1  lib/rjr/amqp_node.rb
@@ -102,6 +102,7 @@ def initialize(args = {})
# Initialize the amqp subsystem
def init_node
@conn = AMQP.connect(:host => @broker)
+ @conn.on_tcp_connection_failure { puts "OTCF #{@node_id}" }
### connect to qpid broker
@channel = AMQP::Channel.new(@conn)
View
8 tests/integration/client
@@ -13,10 +13,12 @@ amqp_node.listen
RJR::Dispatcher.add_handler("client_callback") { |p|
puts "invoked #{client_id} client_callback method"
+ #amqp_node.invoke_request('stress_test-queue', 'stress', "foozmoney#{client_id}")
+ amqp_node.stop
nil
}
-#amqp_node.invoke_request('stress_test-queue', 'stress', "foobar#{client_id}")
-
+#res = amqp_node.invoke_request('stress_test-queue', 'stress', "foobar#{client_id}")
res = amqp_node.invoke_request('stress_test-queue', 'stress_callback', 'foobar')
-puts "Result #{res}"
+puts "Result #{amqp_node.node_id} #{res}"
+amqp_node.join
View
35 tests/integration/client.html
@@ -9,6 +9,41 @@
<script type="text/javascript" src="http://localhost/rjr-test/rjr/json.js"></script>
<script>
$(document).ready(function(){
+ function onopen(){
+ for(var i = 0; i < 50; ++i){
+ ws_node.invoke_request('stress_callback', 'foobar');
+ web_node.invoke_request('stress', 'barfoo');
+ }
+ }
+ function onsuccess(result){
+ console.log("success");
+ console.log(result);
+ }
+ function onfailed(error, msg){
+ console.log("failed");
+ console.log(error);
+ console.log(msg);
+ }
+ function invoke_method(method, params){
+ console.log("invoke_method")
+ console.log(method);
+ console.log(params);
+ }
+
+ web_node = new WebNode('http://localhost/motel');
+ ws_node = new WSNode('127.0.0.1', '8080');
+ ws_node.onopen = function(){ onopen(); };
+ ws_node.onsuccess = function(result) { onsuccess(result); }
+ ws_node.onfailed = function(error, msg) { onfailed(error, msg); }
+ //ws_node.message_received = function(msg) { }
+ ws_node.invoke_method = function(method, params){ invoke_method(method, params); }
+
+ web_node.onsuccess = function(result) { onsuccess(result); }
+ web_node.onfailed = function(error, msg) { onfailed(error, msg); }
+ //web_node.message_received = function(msg) { }
+
+ ws_node.open();
+ });
</script>
</head>
View
5 tests/integration/runner
@@ -2,11 +2,10 @@
# runs the integration test
cd = File.expand_path(File.dirname(__FILE__))
-puts "!!! #{cd}"
server_thread = Thread.new {
puts "Starting server"
- `#{cd}/server > output/server`
+ system("#{cd}/server > output/server")
puts "Server finished"
}
sleep 2
@@ -18,7 +17,7 @@ thread_map = {}
client_threads <<
Thread.new {
puts "Starting client #{i}"
- `#{cd}/client #{i}`
+ system("#{cd}/client #{i}")
puts "Client #{i} finished (#{finished+=1})"
}
thread_map[client_threads.last] = i
Please sign in to comment.
Something went wrong with that request. Please try again.