sync with trunk
[bioperl-run.git] / t / Analysis_soap.t
blob14b2d8deaf3e2d7c4eaf5cb13234eca562892fc7
1 # -*-Perl-*-
2 # $id$
3 ## Bioperl Test Harness Script for Modules
5 use strict;
7 BEGIN {
8     use Bio::Root::Test;
10     test_begin(-tests => 17,
11                            -requires_networking => 1);
12     use_ok('Bio::Tools::Run::Analysis');
13     use_ok('File::Spec');
16 SKIP: {
17         test_skip(-tests => 15, -requires_module => 'SOAP::Lite');
18         use_ok('SOAP::Lite');
20         my $seqret = Bio::Tools::Run::Analysis->new(-name=>'edit.seqret');
21         my $seq = 'tatacga';
23         SKIP: {
24                 # condition used to skip this block of tests
25                 #skip($why, $how_many_in_block);
26                 skip("Failed to create the analysis object", 1)
27                 unless isa_ok( $seqret, 'Bio::Tools::Run::Analysis::soap');
28                 
29                 # test seqret service with some testing data
30                 # TODO: use BIOPERLDEBUG to skip these tests
31                 my %input = (
32                 'sequence_direct_data' => $seq,
33                 'osformat'             => 'raw',
34                 );
35                 is( $seqret->analysis_name, 'seqret', 'analysis_name returned seqret' );
36                 isa_ok( $seqret->analysis_spec, 'HASH');
37                 
38                 my $input_spec = $seqret->input_spec;
39                 isa_ok( $input_spec, 'ARRAY' );
40                 ok( @$input_spec > 0, 'input_spec returned an array with something in it' );
41                 isa_ok( $input_spec->[0], 'HASH' );
42                 my $result_spec = $seqret->result_spec;
43                 isa_ok( $result_spec, 'ARRAY' );
44                 ok( @$result_spec > 0, 'result_spec returned an array with something in it' );
45                 like( $seqret->describe, '/^<\?xml /', 'describe seems to have returned the correct thing' );
46                 my $job = $seqret->create_job (\%input);
47                 SKIP: {
48                         skip("Object not created correctly", 6) unless isa_ok( $job, 'Bio::Tools::Run::Analysis::Job' );
49         
50                         is( $job->status, 'CREATED', 'Job status correct' );
51                         # TODO: not goot to use private methods
52                         my $cloned_job = $seqret->create_job ($job->{'_id'});
53                  
54                         SKIP: {
55                                 skip( "Couldn't clone the job", 2 )
56                                    unless isa_ok( $cloned_job, 'Bio::Tools::Run::Analysis::Job',
57                                                                 'Job cloned successfully' );
58                            
59                                 like( $cloned_job->last_event, '/^<\?xml /',
60                                          'last_event seems to have returned the correct thing' );
61                                 $cloned_job->remove;
62                                 # TODO: not good to use private methods
63                                 is( $cloned_job->{'_destroy_on_exit'}, 1,
64                                    'Cloned job removed successfully' );
65                         }
66                 }
67         }