X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2FCatalyst-Engine-Stomp.t;h=ea2e699860d2e1d5b01147425f00727658a55e29;hb=a431050d77f65a0cdb3683c9620b2135ca4ca1dc;hp=0145e28191cb33333e684ffc2388c76436b211f9;hpb=5c4a779304cf402d31fbe1ef6ad89a8f72c270d3;p=catagits%2FCatalyst-Engine-STOMP.git diff --git a/t/Catalyst-Engine-Stomp.t b/t/Catalyst-Engine-Stomp.t index 0145e28..ea2e699 100644 --- a/t/Catalyst-Engine-Stomp.t +++ b/t/Catalyst-Engine-Stomp.t @@ -8,28 +8,44 @@ use Net::Stomp; use YAML::XS qw/ Dump Load /; use Data::Dumper; -my $stomp; +use Alien::ActiveMQ; +my $ACTIVEMQ_VERSION = '5.2.0'; + +my ($stomp, $mq); eval { $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } ); }; if ($@) { - plan 'skip_all' => 'No ActiveMQ server listening on 61613: ' . $@; - exit; -} -else { - plan tests => 12; + + 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/testapp_stomp.pl --oneshot"); + system("$^X -Ilib -Itestapp/lib testapp/script/stomptestapp_stomp.pl --oneshot"); exit 0; } -sleep 30; +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();