X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Engine-STOMP.git;a=blobdiff_plain;f=t%2FCatalyst-Engine-Stomp.t;fp=t%2FCatalyst-Engine-Stomp.t;h=0000000000000000000000000000000000000000;hp=ea2e699860d2e1d5b01147425f00727658a55e29;hb=bf8937b70eb1aabe53e63e2e6c70f569056e609a;hpb=b044cf9b67638aabfea36c19afee14dabc0b65ba diff --git a/t/Catalyst-Engine-Stomp.t b/t/Catalyst-Engine-Stomp.t deleted file mode 100644 index ea2e699..0000000 --- a/t/Catalyst-Engine-Stomp.t +++ /dev/null @@ -1,80 +0,0 @@ -use Test::More; - -# Tests which expect a STOMP server like ActiveMQ to exist on -# localhost:61613, which is what you get if you just get the ActiveMQ -# distro and run its out-of-the-box config. - -use Net::Stomp; -use YAML::XS qw/ Dump Load /; -use Data::Dumper; - -use Alien::ActiveMQ; -my $ACTIVEMQ_VERSION = '5.2.0'; - -my ($stomp, $mq); -eval { - $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } ); -}; -if ($@) { - - unless (Alien::ActiveMQ->is_version_installed($ACTIVEMQ_VERSION)) { - plan 'skip_all' => 'No ActiveMQ server installed by Alien::ActiveMQ, try running the "install-activemq" command'; - exit; - } - - $mq = Alien::ActiveMQ->run_server($ACTIVEMQ_VERSION); - - eval { - $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } ); - }; - if ($@) { - plan 'skip_all' => 'No ActiveMQ server listening on 61613: ' . $@; - exit; - } -} - -plan tests => 12; - -# First fire off the server -$SIG{CHLD} = 'IGNORE'; -unless (fork()) { - system("$^X -Ilib -Itestapp/lib testapp/script/stomptestapp_stomp.pl --oneshot"); - exit 0; -} -print STDERR "server started, waiting for spinup..."; -sleep 20; - -# Now be a client to that server -print STDERR "testing\n"; -ok($stomp, 'Net::Stomp object'); - -my $frame = $stomp->connect(); -ok($frame, 'connect to MQ server ok'); - -my $reply_to = sprintf '%s:1', $frame->headers->{session}; -ok($frame->headers->{session}, 'got a session'); -ok(length $reply_to > 2, 'valid-looking reply_to queue'); - -ok($stomp->subscribe( { destination => '/temp-queue/reply' } ), 'subscribe to temp queue'); - -my $message = { - payload => { foo => 1, bar => 2 }, - reply_to => $reply_to, - type => 'testaction', - }; -my $text = Dump($message); -ok($text, 'compose message'); - -$stomp->send( { destination => '/queue/testcontroller', body => $text } ); - -my $reply_frame = $stomp->receive_frame(); -ok($reply_frame, 'got a reply'); -ok($reply_frame->headers->{destination} eq "/remote-temp-queue/$reply_to", 'came to correct temp queue'); -ok($reply_frame->body, 'has a body'); - -my $response = Load($reply_frame->body); -ok($response, 'YAML response ok'); -ok($response->{type} eq 'testaction_response', 'correct type'); - -ok($stomp->disconnect, 'disconnected'); -