[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Fri Jul 22 23:23:26 UTC 2005


mwilkinson
Fri Jul 22 19:23:26 EDT 2005
Update of /home/repository/moby/moby-live/Perl/t
In directory pub.open-bio.org:/tmp/cvs-serv2549/t

Modified Files:
	Client-Central.t 
Log Message:
added about 50 new tests.  now we're really getting tight.

moby-live/Perl/t Client-Central.t,1.8,1.9
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Perl/t/Client-Central.t	2005/07/08 19:22:21	1.8
+++ /home/repository/moby/moby-live/Perl/t/Client-Central.t	2005/07/22 23:23:26	1.9
@@ -4,17 +4,19 @@
 #########################
 
 # change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test::More tests => 14; # perldoc Test::More for details
+#use SOAP::Lite +trace;
+use Test::More tests => 54; # perldoc Test::More for details
 
 # Test 1
 BEGIN { use_ok('MOBY::Client::Central') };
 
+
+
 # Test 2
 my $C = MOBY::Client::Central->new(
 		Registries => {
-						mobycentral => {	URL => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl',
-											URI => 'http://mobycentral.icapture.ubc.ca/MOBY/Central'}
+						mobycentral => {	URL => 'http://localhost/cgi-bin/MOBY-Central.pl',
+											URI => 'http://localhost/MOBY/Central'}
 						}
                                   );
 
@@ -23,6 +25,8 @@
 
 my %TestRegistry ; # to keep track of registry id's for the various tests
 
+
+
 ################## MOBY Registration Tests #################
 
 # Test 3
@@ -40,6 +44,9 @@
 ( ok(!$r->success,"Object registration correctly failed")
  or diag("Object registration failure: ".$r->message));
 
+
+
+
 # Test 4
 $r = $C->registerObjectClass(objectType => "TotalCrap",
                 description => "a human-readable description of the object",
@@ -55,11 +62,17 @@
  or diag("Object registration failure: ".$r->message));
 
 
+
+
+
 # Test 5
 $r = $C->deregisterObjectClass(objectType => "TotalCrap");
 ( ok($r->success,"Object deregistration successful"))
 or diag("Object deregistration failure: ".$r->message) ;
 
+
+
+
 # Test 6 (identical to #4
 $r = $C->registerObjectClass(objectType => "TotalCrap",
                 description => "a human-readable description of the object",
@@ -75,7 +88,10 @@
  or diag("Object registration failure: ".$r->message));
 
 
-# Test 6
+
+
+
+# Test 7
 $r = $C->registerNamespace(
     namespaceType =>'UglyNamespace',
     authURI => 'your.authority.URI',
@@ -85,7 +101,9 @@
 ) or diag("Name space registration failure: ".$r->message) ;
 
 
-# Test 7
+
+
+# Test 8
 $r = $C->registerServiceType(serviceType => "CrappyService",
                 description => "a human-readable description of the service",
 				contactEmail => 'your at email.address',
@@ -96,7 +114,10 @@
 ( ok($r->success,"Service Type registration successful")
 ) or diag("Service Type registration failure: ".$r->message) ;
 
-# Test 8  # should fail
+
+
+
+# Test 9  # should fail
 $r = $C->registerService(
     serviceName  => "myfirstservice",  
     serviceType  => "Retrieval",  
@@ -119,10 +140,12 @@
 			min => -10,
 			enum => [-10, 10, 0]}});
 
-( ok(!$r->success,"Service registration correctly failed")
+( ok(!$r->success,"Service registration correctly failed testing secondary datatype format")
 ) or diag("Service registration failure: ".$r->message) ;
 
-# Test 9
+
+
+# Test 10
 $r = $C->registerService(
     serviceName  => "myfirstservice",  
     serviceType  => "Retrieval",  
@@ -148,8 +171,75 @@
 ( ok($r->success,"Service registration successful")
 ) or diag("Service registration failure: ".$r->message) ;
 
+# test 11 - find by auth & name
+($si, $r) = $C->findService(
+    serviceName  => "myfirstservice",  
+    authURI      => "test.suite.com");
+( is($r, undef, "Service discovery successful")
+) or diag("Service discovery failure") ;
+
+isa_ok($si, 'ARRAY') or diag("findService didn't return an array ref");
+is(scalar(@$si),1) or diag("findService found too many services");
+$SI = shift @$si;
+print STDERR "$SI";
+isa_ok($SI, 'MOBY::Client::ServiceInstance') or diag("findService didn't return a MOBY::Client::ServceInstance");
+isa_ok($SI->input, ARRAY) or diag ("ServiceInstance object input is not a listref");
+isa_ok($SI->output, ARRAY) or diag ("ServiceInstance object output is not a listref");
+is($SI->name, "myfirstservice") or diag("servicename wrong");
+is($SI->authoritative, 0) or diag("service reported to be incorrectly authoritative");
+is($SI->authority, "test.suite.com") or diag("authURI incorrect");
+is($SI->type, "Retrieval") or diag("service type incorrect");
+is($SI->description, "this is my first service") or diag("service description wrong");
+is($SI->URL, "http://illuminae/cgi-bin/service.pl") or diag("service URL incorrect");
+is($SI->contactEmail, 'your at mail.address') or diag("contact email incorrect");
+is($SI->category, "moby") or diag("service category incorrect");
+
+ at ins = @{$SI->input};
+ at outs = @{$SI->output};
+ at secs = @{$SI->secondary};
+is(scalar(@ins), 1) or diag("incorrect number of inputs in servce instance");
+is(scalar(@outs), 1) or diag("incorrect number of outputs in servce instance");
+is(scalar(@secs), 1) or diag("incorrect number of secodary in servce instance");
+
+$in = shift @ins;
+$out = shift @outs;
+$sec = shift @secs;
+
+isa_ok($in, 'MOBY::Client::SimpleArticle') or diag("->inputs did not return a MOBY::simple_input object");
+isa_ok($out, 'MOBY::Client::SimpleArticle') or diag("->outputs did not return a MOBY::simple_outputobject");
+isa_ok($sec, 'MOBY::Client::SecondaryArticle') or diag("->secondarues did not return a MOBY::secondary_input object");
+
+is($in->objectType, "Object") or diag("simple input type reported incorrectly");
+is($in->articleName, "articleName1") or diag("simple input article name reported incorrectly");
+isa_ok($in->namespaces, 'ARRAY') or diag("simple input namespaces not returned as an arrayref");
+ at ns = @{$in->namespaces};
+is(scalar(@ns),1) or diag("simple input reporting wrong number of namespaces");
+$ns = shift @ns;
+is($ns, 'UglyNamespace') or diag("simple input reporting wrong namespace");
+
+is($out->objectType, "String") or diag("simple output type reported incorrectly");
+is($out->articleName, "articleName2") or diag("simple output article name reported incorrectly");
+isa_ok($out->namespaces, 'ARRAY') or diag("simple output namespaces not returned as an arrayref");
+ at ns = @{$out->namespaces};
+is(scalar(@ns),1) or diag("simple output reporting wrong number of namespaces");
+$ns = shift @ns;
+is($ns, 'UglyNamespace') or diag("simple output reporting wrong namespace");
+
+is($sec->articleName, 'parametername1') or diag("secondary article reporting wrong article name");
+is($sec->datatype, 'Integer') or diag("secondary article reporting wrong datatype");
+is($sec->default,"0") or diag("secondary article reporting wrong default");
+is($sec->max,"10") or diag("secondary article reporting wrong max");
+is($sec->min,"-10") or diag("secondary article reporting wrong min");
+isa_ok($sec->enum, 'ARRAY') or diag("enum is not returning an array ref");
+ at enum = @{$sec->enum};
+is(scalar(@enum), 3) or diag("enum not returning correct number of elements");
+$enum = join "|", at enum;
+$enum = "|".$enum."|";
+is($enum =~/\|-10\|/, 1) or diag("enum element missing");
+is($enum =~/\|10\|/, 1) or diag("enum element missing");
+is($enum =~/\|0\|/, 1) or diag("enum element missing");
 
-# Test 10
+# Test 12
 
 $r = $C->deregisterService(
     serviceName  => "myfirstservice",  
@@ -159,136 +249,29 @@
 ) or diag("Service deregistration failure: ".$r->message) ;
 
 
-# Test 11
+
+
+
+# Test 12
 $r = $C->deregisterObjectClass(objectType => "TotalCrap");
 ( ok($r->success,"Object deregistration successful")
 ) or diag("Object deregistration failure: ".$r->message) ;
 
-# Test 12
+
+
+# Test 13
 $r = $C->deregisterServiceType(serviceType => "CrappyService");
 ( ok($r->success,"Service Type deregistration successful")
 ) or diag("Service Type deregistration failure: ".$r->message) ;
 
-# Test 13
+
+
+
+# Test 44
 $r = $C->deregisterNamespace(namespaceType =>'UglyNamespace');
 ( ok($r->success,"namespace  deregistration successful")
 ) or diag("namespace deregistration failure: ".$r->message) ;
 
-################### MOBY Central Search Tests #################
-#
-#my @service ;
-#
-## Tests 14,15: locateServiceByOutput with output 'Object' and full_objects + full_services
-#@service = $C->locateServiceByOutput(
-#    objectType => "Object",
-#    fullObjects => 1,
-#    fullServices => 1,
-#) ;
-#
-#SKIP: {
-#    skip "locateServiceByOutput w/full object & services".
-#         "did not return any services?", 2 unless scalar(@service) ;
-#    is($service[0]->authority,"illuminae.com","locateServiceByOutput authority") ;
-#    is($service[0]->name,"Servicetest2","locateServiceByOutput service name") ;
-#} ; 
-#
-## Tests 16,17: Testing locateServiceByOutput with output "Object" and full_services only
-#@service = $C->locateServiceByOutput(
-#    objectType => "Object",
-#    fullObjects => 0,
-#    fullServices => 1,
-#		        );
-#SKIP: {
-#    skip "locateServiceByOutput w/ output 'Object' and full services only ".
-#         "did not return any services?", 2 unless scalar(@service) ;
-#    is($service[0]->authority,"illuminae.com","locateServiceByOutput authority") ;
-#    is($service[0]->name,"Servicetest2","locateServiceByOutput service name") ;
-#} ; 
-#
-## Tests 18,19: Testing locateServiceByInput with input
-## 'Object' => Genbank/GI and full_objects + full_services
-#@service = $C->locateServiceByInput(
-#    input => {"Sequence" => ["Genbank/GI"]},
-#    fullObjects  => 1,
-#    fullServices => 1,
-#                         );
-#SKIP: {
-#    skip "locateServiceByInput w/input 'Object' => Genbank/GI ".
-#         "and full_objects + full_services ".
-#         "did not return any services?", 2 unless scalar(@service) ;
-#    is($service[0]->authority,"illuminae.com","locateServiceByOutput authority") ;
-#    is($service[0]->name,"Servicetest2","locateServiceByOutput service name") ;
-#} ; 
-#
-## Tests 20,21: Testing locateServiceByInput with input
-## 'Object' => Genbank/GI and full_services only
-#@service = $C->locateServiceByInput(
-#    input => {"Object" => ["Genbank/GI"]},
-#    fullObjects => 0,
-#    fullServices => 1,
-#                         );
-#SKIP: {
-#    skip "locateServiceByInput w/input 'Object' => Genbank/GI ".
-#         "and full_services ".
-#         "did not return any services?", 2 unless scalar(@service) ;
-#    is($service[0]->authority,"illuminae.com","locateServiceByOutput authority") ;
-#    is($service[0]->name,"Servicetest2","locateServiceByOutput service name") ;
-#} ; 
-#
-## Tests 22,23: Testing locateServiceByType with type 'Retrieve' + full_services
-#@service = $C->locateServiceByType(
-#    serviceType => "Retrieve",
-#    fullServices => 1,
-#                         );
-#SKIP: {
-#    skip "locateServiceByType w/type 'Retrieve' and full_services ".
-#         "did not return any services?", 2 unless scalar(@service) ;
-#    is($service[0]->authority,"illuminae.com","locateServiceByOutput authority") ;
-#    is($service[0]->name,"Servicetest2","locateServiceByOutput service name") ;
-#} ; 
-#
-################### MOBY Deregistration Tests #################
-#
-## Test 17
-#SKIP: {
-#    skip "Skipping test DeregisterService since service registration failed",
-#       1 unless(exists($TestRegistry{'Service'})) ;
-#
-#    $r = $C->deregisterService( serviceID => $TestRegistry{'Service'} );
-#    ok(!$r->success,"Service ID#".$r->registration_id." deregistration successful")
-#      or diag("Service ID#",$TestRegistry{'Service'},
-#	      "deregistration failure: ".$r->message) ;
-#}
-#
-## Test 18
-#SKIP: {
-#    skip "Skipping test DeregisterNamespace since name space registration failed",
-#       1 unless(exists($TestRegistry{'NameSpace'})) ;
-#
-#    $r = $C->deregisterNamespace( namespaceAcc => $TestRegistry{'NameSpace'} );
-#    ok(!$r->success,"Name space ID#".$r->registration_id." deregistration successful")
-#      or diag("Name space ID#",$TestRegistry{'NameSpace'},
-#	      "deregistration failure: ".$r->message) ;
-#}
-#
-## Test 19
-#SKIP: {
-#    skip "Skipping test DeregisterServiceType since service registration failed",
-#       1 unless(exists($TestRegistry{'ServiceType'})) ;
-#
-#    $r = $C->deregisterServiceType( serviceID => $TestRegistry{'ServiceType'} );
-#    ok(!$r->success,"Service type ID#".$r->registration_id." deregistration successful")
-#      or diag("Service type ID#",$TestRegistry{'ServiceType'},
-#	      "deregistration failure: ".$r->message) ;
-#}
-#
-## Test 20
-#SKIP: {
-#    skip "Skipping test DeregisterObject since initial object registration failed",
-#       1 unless(exists($TestRegistry{'Object'})) ;
-#
-#    $r = $C->deregisterObject( serviceID => $TestRegistry{'Object'} );
-#    ok(!$r->success,"Object ID#".$r->registration_id." deregistration successful")
-#      or diag("Object ID#",$TestRegistry{'Object'},
-#	      "deregistration failure: ".$r->message) ;
-#}
+
+
+




More information about the MOBY-guts mailing list