bc77af93f49e77e025d27992d1ed0fa0a7d65fe4
[catagits/Catalyst-Engine-STOMP.git] / t / server.pl
1 use Alien::ActiveMQ;
2 my $ACTIVEMQ_VERSION = '5.2.0';
3
4 eval {
5     $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } );
6 };
7 if ($@) {
8
9     unless (Alien::ActiveMQ->is_version_installed($ACTIVEMQ_VERSION)) {
10         plan 'skip_all' => 'No ActiveMQ server installed by Alien::ActiveMQ, try running the "install-activemq" command';
11         exit;
12     }
13
14     $mq = Alien::ActiveMQ->run_server($ACTIVEMQ_VERSION);
15
16     eval {
17         $stomp = Net::Stomp->new( { hostname => 'localhost', port => 61613 } );
18     };
19     if ($@) {
20         plan 'skip_all' => 'No ActiveMQ server listening on 61613: ' . $@;
21         exit;
22     }
23 }
24
25 $SIG{CHLD} = 'IGNORE';
26 unless (fork()) {
27         system("$^X -Ilib -Itestapp/lib testapp/script/stomptestapp_stomp.pl --oneshot");
28         exit 0;
29 }
30 print STDERR "server started, waiting for spinup...";
31 sleep 20;
32