test
[bioperl-run.git] / t / AnalysisFactory_soap.t
blob0461948bf2ed6789fd8f1a61ce9f05295511cf84
1 # -*-Perl-*-
2 # $id$
3 ## Bioperl Test Harness Script for Modules
5 use strict;
7 BEGIN {
8   # Things to do ASAP once the script is run
9   # even before anything else in the file is parsed
10   #use vars qw($NUMTESTS $DEBUG $error);
11   #$DEBUG = $ENV{'BIOIPERLDEBUG'} || 0;
12   
13   # Use installed Test module, otherwise fall back
14   # to copy of Test.pm located in the t dir
15   eval { require Test::More; };
16   if ( $@ ) {
17     use lib 't/lib';
18   }
20   # Currently no errors
21   #$error = 0;
23   # Setup Test::More and plan the number of tests
24   use Test::More tests=>12;
25   
26   # Use modules that are needed in this test that are from
27   # any of the Bioperl packages: Bioperl-core, Bioperl-run ... etc
28   # use_ok('<module::to::use>');
29   use_ok('Bio::Tools::Run::AnalysisFactory');
30   #use_ok('File::Spec');
33 END {
34   # Things to do right at the very end, just
35   # when the  interpreter finishes/exits
36   # E.g. deleting intermediate files produced during the test
37   
38   #foreach my $file ( qw(cysprot.dnd cysprot1a.dnd) ) {
39   #  unlink $file;
40   #  # check it was deleted
41   #  ok( ! -e $file, 'Expected temp file deleted' );
42   #}
45 # setup input files etc
46 # none in this test
48 # setup output files etc
49 # none in this test
51 # setup global objects that are to be used in more than one test
52 # Also test they were initialised correctly
53 # test new with default access
54 my $factory = Bio::Tools::Run::AnalysisFactory->new();
55 isa_ok( $factory, 'Bio::Tools::Run::AnalysisFactory');
57 # test new with explicit access
58 $factory = Bio::Tools::Run::AnalysisFactory->new(-access=>'soap');
59 isa_ok( $factory, 'Bio::Tools::Run::AnalysisFactory');
61 # test new with non-existing access
62 eval {
63   $factory = Bio::Tools::Run::AnalysisFactory->new(-access=>'non_existing');
65 ok( $@, 'Non existant access method threw an error' );
67 # test default factory values
69 # Now onto the nitty gritty tests of the modules methods
71 # block of tests to skip if you know the tests will fail
72 # under some condition. E.g.:
73 #   Need network access,
74 #   Wont work on particular OS,
75 #   Cant find the exectuable
76 # DO NOT just skip tests that seem to fail for an unknown reason
77 SKIP: {
78   # condition used to skip this block of tests
79   #skip($why, $how_many_in_block);
80   skip("SOAP::Lite not installed, wanted to check real service(s)", 7)
81     unless use_ok('SOAP::Lite');
82   
83   my $array_ref = $factory->available_categories;
84   isa_ok( $array_ref, 'ARRAY' );
85   ok( grep(/protein/i, @$array_ref), 'available_categories returned category with protein' );
86   
87   $array_ref = $factory->available_analyses;
88   isa_ok( $array_ref, 'ARRAY' );
89   ok( grep(/seqret/i, @$array_ref), 'available_analyses returned category with seqret' );
90   
91   $array_ref = $factory->available_analyses('edit');
92   isa_ok( $array_ref, 'ARRAY' );
93   ok( grep(/seqret/i, @$array_ref), 'available_analyses("edit") returned something' );
94   
95   my $service = $factory->create_analysis('edit.seqret');
96   isa_ok( $service, 'Bio::Tools::Run::Analysis::soap' );
97