From: t0m Date: Thu, 21 May 2009 01:11:30 +0000 (+0100) Subject: Change so that ActiveMQ is only started if not already running X-Git-Tag: 0.03~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Engine-STOMP.git;a=commitdiff_plain;h=a0c8e88568223a59b3ab88463fb12e6fb8b0ff64 Change so that ActiveMQ is only started if not already running --- diff --git a/t/Catalyst-Engine-Stomp.t b/t/Catalyst-Engine-Stomp.t index 9c4f148..ea2e699 100644 --- a/t/Catalyst-Engine-Stomp.t +++ b/t/Catalyst-Engine-Stomp.t @@ -11,24 +11,30 @@ use Data::Dumper; use Alien::ActiveMQ; my $ACTIVEMQ_VERSION = '5.2.0'; -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; -} -my $mq = Alien::ActiveMQ->run_server($ACTIVEMQ_VERSION); - -my $stomp; +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()) {