X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2FCatalyst-Engine-Stomp.t;h=9c4f1482ade219ffb5fed356dfedd736e90af45b;hb=6ac87378371b9d19564a03b8c2183e14fa653d97;hp=e96c0285db9188546ad1c598b73a51a2c282ebe9;hpb=0a66358961c58c5fff96a363853ee93b00f55119;p=catagits%2FCatalyst-Engine-STOMP.git diff --git a/t/Catalyst-Engine-Stomp.t b/t/Catalyst-Engine-Stomp.t index e96c028..9c4f148 100644 --- a/t/Catalyst-Engine-Stomp.t +++ b/t/Catalyst-Engine-Stomp.t @@ -1,5 +1,4 @@ -use Test::More tests => 14; -use Test::Fork; +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 @@ -9,15 +8,38 @@ use Net::Stomp; use YAML::XS qw/ Dump Load /; 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; +eval { + $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } ); +}; +if ($@) { + plan 'skip_all' => 'No ActiveMQ server listening on 61613: ' . $@; + exit; +} +else { + plan tests => 12; +} + # First fire off the server -my $child_pid = fork_ok(1, sub { - ok(system("$^X -Ilib -Itestapp/lib testapp/script/testapp_stomp.pl --oneshot")); - #sleep 3; -}); +$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 - -my $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } ); +print STDERR "testing\n"; ok($stomp, 'Net::Stomp object'); my $frame = $stomp->connect();