[MOBY-guts] biomoby commit

Frank Gibbons fgibbons at pub.open-bio.org
Thu Sep 1 16:09:40 UTC 2005


fgibbons
Thu Sep  1 12:09:40 EDT 2005
Update of /home/repository/moby/moby-live/Perl/t
In directory pub.open-bio.org:/tmp/cvs-serv6626/t

Modified Files:
	Client-OntologyServer.t 
Log Message:
 - Test that 'Exists' functions return success/failure when they should. The relationship function seems to fail, perhaps the test is wrong.

moby-live/Perl/t Client-OntologyServer.t,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t	2005/08/31 14:17:11	1.1
+++ /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t	2005/09/01 16:09:39	1.2
@@ -14,8 +14,6 @@
 #use SOAP::Lite +trace;
 use Test::More 'no_plan'; # perldoc Test::More for details
 use strict;
-use English;
-use Data::Dumper;
 use MOBY::Client::OntologyServer;
 #Is the client-code even installed?
 BEGIN { use_ok('MOBY::Client::OntologyServer') };
@@ -33,8 +31,68 @@
 my @API = (@autoload, qw/new getUserAgent
 objectExists serviceExists namespaceExists relationshipExists/);
 
-my $si = MOBY::Client::OntologyServer->new();
-foreach (@autoload) {eval{$si->$_};} # Call all AUTOLOAD methods, to create them.
+my $os = MOBY::Client::OntologyServer->new();
+foreach (@autoload) {eval{$os->$_};} # Call all AUTOLOAD methods, to create them.
 can_ok("MOBY::Client::OntologyServer", @API)
   or diag("OntologyServer doesn't implement full API");
 
+################ CHECK THAT VALID STUFF RETURNS CORRECTLY ##########
+#
+# It would really be better not to have literal lists of valid namespaces here,
+# Can we pull the entire list of valid namespaces in programmatically from somewhere,
+# and check them all here? Ditto for Objects, Service-types
+#
+my ($success, $msg, $existingURI);
+my @check_ns = qw/SGD NCBI_gi/;
+foreach (@check_ns) {
+ ($success, $msg, $existingURI) = $os->namespaceExists( term => $_);
+  is($success, 1)
+    or diag("Namespace '$_' reported erroneously as non-existent.");
+}
+
+my @check_obj = qw/ Object String Integer Float/;
+foreach (@check_obj) {
+  ($success, $msg, $existingURI) = $os->objectExists(term => $_);
+  is($success, 1)
+    or diag("Object '$_' reported erroneously as non-existent.");
+}
+
+my @check_servicetype = qw/Retrieval/;
+foreach (@check_servicetype) {
+  ($success, $msg, $existingURI) = $os->serviceExists(term => $_);
+  is($success, 1)
+    or diag("Service type '$_' reported erroneously as non-existent.");
+}
+
+my @check_rel = qw/ISA HASA HAS/;
+foreach (@check_rel) {
+  ($success, $msg, $existingURI) = $os->relationshipExists(term => $_);
+  is($success, 1)
+    or diag("Relationship '$_' reported erroneously as non-existent.");
+}
+
+
+######### CHECK THAT *IN*VALID STUFF FAILS CORRECTLY ###############
+#
+# Literal invalid names are OK here, since there's no obvious way to generate them
+# and guarantee that they'll be invalid.
+#
+my $invalid_ns = "InvalidNS";
+($success, $msg, $existingURI) = $os->namespaceExists( term => $invalid_ns);
+is($success, 0)
+  or diag("Namespace '$invalid_ns' reported erroneously as existent.");
+
+my $invalid_obj = "InvalidObject";
+($success, $msg, $existingURI) = $os->objectExists(term => $invalid_obj);
+is($success, 0)
+  or diag("Object '$invalid_obj' reported erroneously as existent.");
+
+my $invalid_st = "InvalidServiceType";
+($success, $msg, $existingURI) = $os->serviceExists(term => $invalid_st);
+is($success, 0)
+  or diag("Service type '$invalid_st' reported erroneously as existent.");
+
+my $invalid_rel = "HA";
+($success, $msg, $existingURI) = $os->relationshipExists(term => $invalid_rel);
+is($success, 0)
+  or diag("Relationship '$invalid_rel' reported erroneously as existent.");




More information about the MOBY-guts mailing list