Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / Analysis_soap.t
blob7837a8b34ea4a1aa24da64fbe7884403ba62a8be
1 # -*-Perl-*-
2 # $id$
3 ## Bioperl Test Harness Script for Modules
5 use strict;
7 BEGIN {
8     use Bio::Root::Test;
10     # The EMBL-EBI Soaplab server has been decommissioned on 1st February 2013
11     # (https://www.ebi.ac.uk/Tools/webservices/about/news).
12     # Website "http://www.ebi.ac.uk/soaplab/services" dont exists anymore,
13     # so tests will fail with "404 Not Found" if executed
14     test_begin(-tests => 0,
15                            -requires_networking => 1);
16     use_ok('Bio::Tools::Run::Analysis');
17     use_ok('File::Spec');
20 SKIP: {
21         test_skip(-tests => 15, -requires_module => 'SOAP::Lite');
22         use_ok('SOAP::Lite');
24         my $seqret = Bio::Tools::Run::Analysis->new(-name=>'edit.seqret');
25         my $seq = 'tatacga';
27         SKIP: {
28                 # condition used to skip this block of tests
29                 #skip($why, $how_many_in_block);
30                 skip("Failed to create the analysis object", 1)
31                 unless isa_ok( $seqret, 'Bio::Tools::Run::Analysis::soap');
32                 
33                 # test seqret service with some testing data
34                 # TODO: use BIOPERLDEBUG to skip these tests
35                 my %input = (
36                 'sequence_direct_data' => $seq,
37                 'osformat'             => 'raw',
38                 );
39                 is( $seqret->analysis_name, 'seqret', 'analysis_name returned seqret' );
40                 isa_ok( $seqret->analysis_spec, 'HASH');
41                 
42                 my $input_spec = $seqret->input_spec;
43                 isa_ok( $input_spec, 'ARRAY' );
44                 ok( @$input_spec > 0, 'input_spec returned an array with something in it' );
45                 isa_ok( $input_spec->[0], 'HASH' );
46                 my $result_spec = $seqret->result_spec;
47                 isa_ok( $result_spec, 'ARRAY' );
48                 ok( @$result_spec > 0, 'result_spec returned an array with something in it' );
49                 like( $seqret->describe, '/^<\?xml /', 'describe seems to have returned the correct thing' );
50                 my $job = $seqret->create_job (\%input);
51                 SKIP: {
52                         skip("Object not created correctly", 6) unless isa_ok( $job, 'Bio::Tools::Run::Analysis::Job' );
53         
54                         is( $job->status, 'CREATED', 'Job status correct' );
55                         # TODO: not goot to use private methods
56                         my $cloned_job = $seqret->create_job ($job->{'_id'});
57                  
58                         SKIP: {
59                                 skip( "Couldn't clone the job", 2 )
60                                    unless isa_ok( $cloned_job, 'Bio::Tools::Run::Analysis::Job',
61                                                                 'Job cloned successfully' );
62                            
63                                 like( $cloned_job->last_event, '/^<\?xml /',
64                                          'last_event seems to have returned the correct thing' );
65                                 $cloned_job->remove;
66                                 # TODO: not good to use private methods
67                                 is( $cloned_job->{'_destroy_on_exit'}, 1,
68                                    'Cloned job removed successfully' );
69                         }
70                 }
71         }