[16:50:12] anexiole:server git:(bugfix/ET750-asyncTests*) $ prove -v t/api/fwm/job/up.t
t/api/fwm/job/up.t ..
[info] Setting log level to: debug
[info] Manager started: MG EMU: Mojo::Server::Daemon
[info] Worker started: MG EMU: [27346]
[info] Manager started: MG EMU: Mojo::Server::Daemon
[info] Worker started: MG EMU: [27346]
Current port of t is 50016
RESULTS : $VAR1 = '{"jobId":2530,"task":"upgrade"}';
job id is 2530
Get the job out ...
IOLOoP is active
After the ioloop...
1..0
skipped: (no reason given)
my $data = from_json( $test_scenario->{contents}->{data} );
my $enqueue_job = Mojo::URL->new($url);
$enqueue_job->query(
Mojo::Parameters->new(
'format' => $test_scenario->{'contents'}->{'format'},
'scope' => $scope,
'deviceType' => $data->{'deviceType'},
'data' => $test_scenario->{'contents'}->{'data'},
)
);
print STDERR qq{ Current port of t is }
. $t->ua->server->url->port . qq{\n};
$t->ua->post_p( $enqueue_job => $header )->then(
sub ($tx) {
print STDERR qq{ RESULTS : }
. Dumper( $tx->result->body );
my $job_id = from_json( $tx->result->body )->{'jobId'};
print STDERR qq{job id is $job_id\n};
# Grab the report of the job out
my $retrieve_enqueued_job_url
= Mojo::URL->new(qq{/myTestApp/api/job/v12/result/$job_id});
$retrieve_enqueued_job_url->query(
Mojo::Parameters->new( 'format' => q{json}, ),
);
print STDERR qq{Get the job out ...\n};
if ( $t->ua->ioloop->is_running() ) {
print STDERR qq{IOLOoP is active\n};
}
else {
print STDERR qq{IOLOoP is not active\n};
}
use Mojo::IOLoop::Delay;
my $delay = Mojo::IOLoop->delay(
sub ($delay) {
Mojo::IOLoop->timer( 3 => $delay->begin );
},
sub ($delay) {
print STDERR '3 seconds';
Mojo::IOLoop->timer( 3 => $delay->begin );
},
sub ($delay) {
print STDERR '6 seconds';
Mojo::IOLoop->timer( 3 => $delay->begin );
},
sub ($delay) { print STDERR '9 seconds'; }
);
$delay->wait;
$t->ua->get_p( $retrieve_enqueued_job_url => $header )->then(
sub ($tx) {
print STDERR qq{ the job RESULTS : }
. Dumper( $tx->result->body );
}
);
print STDERR qq{After the ioloop...\n};
}
)->catch(
sub (@errors) {
print STDERR qq{Job retrieval errors: } . Dumper(@errors);
}
)->wait;
}
Gordon Yeong.