[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Tue Nov 22 21:33:23 UTC 2005


mwilkinson
Tue Nov 22 16:33:23 EST 2005
Update of /home/repository/moby/moby-live/Perl/t
In directory pub.open-bio.org:/tmp/cvs-serv14216/t

Modified Files:
	Client-OntologyServer.t CommonSubs.t 
Log Message:
made modifications to allow complete independence from public MOBY Central.  The MOBY::Client::OntologyServer checks the MOBY_ONTOLOGYSERVER environment varable, and connects to whatever server is at that address.  if you set this to localhost you will be talking to your own moby ontologies.  I have also modified the test suite so that they will work on a vanilla bootstrapped MOBY ontology server, and don't expect any entries from the public ontologies with the exception of the bootstrap entries.

moby-live/Perl/t Client-OntologyServer.t,1.5,1.6 CommonSubs.t,1.3,1.4
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t	2005/09/27 00:06:24	1.5
+++ /home/repository/moby/moby-live/Perl/t/Client-OntologyServer.t	2005/11/22 21:33:23	1.6
@@ -15,11 +15,50 @@
 use Test::More 'no_plan'; #skip_all => "Skipped for development"; #'no_plan'; # perldoc Test::More for details
 use strict;
 use MOBY::Client::OntologyServer;
-#Is the client-code even installed?
-BEGIN { use_ok('MOBY::Client::OntologyServer') };
- 
+use MOBY::Client::Central;
+BEGIN { use_ok('MOBY::Client::OntologyServer');
+      # initialize with a couple of useless things that we can guarantee to find
+       my $C = MOBY::Client::Central->new();
+
+      my %Namespace = ( namespaceType => 'Rub1',
+                        authURI       => 'your.authority.URI',
+                        description   => "human readable description of namespace",
+                        contactEmail  => 'your at address.here'
+                      );
+      my $r = $C->registerNamespace( %Namespace );
+      %Namespace = ( namespaceType => 'Rub2',
+                        authURI       => 'your.authority.URI',
+                        description   => "human readable description of namespace",
+                        contactEmail  => 'your at address.here'
+                      );
+      $r = $C->registerNamespace( %Namespace );
+      my %ServiceType = ( serviceType   => "Rub1",
+                          description   => "a human-readable description of the service",
+                          contactEmail  => 'your at email.address',
+                          authURI       => "test.suite.com",
+                          Relationships => { ISA => ['Service'] }
+                        );
+      $r = $C->registerServiceType( %ServiceType );
+      %ServiceType = ( serviceType   => "Rub2",
+                          description   => "a human-readable description of the service",
+                          contactEmail  => 'your at email.address',
+                          authURI       => "test.suite.com",
+                          Relationships => { ISA => ['Service'] }
+                        );
+      $r = $C->registerServiceType( %ServiceType );};
+
 END {
-  # Clean up after yourself, in case tests fail, or the interpreter is interrupted partway though...
+  # Define cleanup of registry, to return it to its 'pristine' state, 
+  # so that later attempts to run tests don't run into problems caused 
+  # by failure of these tests, or abortion of the test script.
+  # Reconnect to MOBY Central here, since other connections 
+  # will have gone out of scope by the time we get to this END block.
+  # Also can't use %Obj, 
+  my $C = MOBY::Client::Central->new();
+  my $r = $C->deregisterNamespace( namespaceType => 'Rub1' );
+  $r = $C->deregisterNamespace( namespaceType => 'Rub2' );
+  $r = $C->deregisterServiceType( serviceType => 'Rub2' );
+  $r = $C->deregisterServiceType( serviceType => 'Rub2' );
 };
 
 
@@ -28,6 +67,29 @@
 objectExists serviceExists namespaceExists /);
 
 my $os = MOBY::Client::OntologyServer->new();
+
+print STDERR <<END;
+
+
+
+    This is the MOBY Client OntologyServer test suite.
+
+    by default this connects to the server at mobycentral.icapture.ubc.ca
+    (or whatever the default server is set to in the code)
+		
+    If you want to test a different server you must set the following
+    ENVIRONEMNT VARABLE:
+		
+    MOBY_ONTOLOGYSERVER='http://your.server.name/path/to/OntologyServer.cgi'
+		
+  
+
+    For the following tests I will be using the server at:
+END
+
+print STDERR "\t",$os->host,"\n\n\n";
+
+
 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");
@@ -47,14 +109,9 @@
 
 # Start fresh....
 $os = MOBY::Client::OntologyServer->new();
-################ 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 GO FB PMID/; # These seem pretty solid
+my @check_ns = qw/Rub1 Rub2/; # These seem pretty solid
 foreach (@check_ns) {
  ($success, $msg, $existingURI) = $os->namespaceExists( term => $_);
   is($success, 1)
@@ -70,10 +127,7 @@
     or diag("Object '$_' reported erroneously as non-existent.");
 }
 
-my @check_servicetype = qw/Alignment Analysis Conversion Edit
-NCBI_Blast Parsing SetIntersection SetOperation SetUnion 
-Retrieval Registration Resolution
-StructuralPrediction/; # Service types don't change much, but who knows....
+my @check_servicetype = qw/Rub1 Rub2/; # Service types don't change much, but who knows....
 foreach (@check_servicetype) {
   ($success, $msg, $existingURI) = $os->serviceExists(term => $_);
   is($success, 1)

===================================================================
RCS file: /home/repository/moby/moby-live/Perl/t/CommonSubs.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- /home/repository/moby/moby-live/Perl/t/CommonSubs.t	2005/09/21 19:08:28	1.3
+++ /home/repository/moby/moby-live/Perl/t/CommonSubs.t	2005/11/22 21:33:23	1.4
@@ -21,10 +21,38 @@
 use XML::LibXML;
 use MOBY::MobyXMLConstants;
 
+use MOBY::Client::Central;
+BEGIN { use_ok('MOBY::Client::OntologyServer');
+      # initialize with a couple of useless things that we can guarantee to find
+       my $C = MOBY::Client::Central->new();
+
+      my %Namespace = ( namespaceType => 'Rub1',
+                        authURI       => 'your.authority.URI',
+                        description   => "human readable description of namespace",
+                        contactEmail  => 'your at address.here'
+                      );
+      my $r = $C->registerNamespace( %Namespace );
+      %Namespace = ( namespaceType => 'Rub2',
+                        authURI       => 'your.authority.URI',
+                        description   => "human readable description of namespace",
+                        contactEmail  => 'your at address.here'
+                      );
+      $r = $C->registerNamespace( %Namespace );
+};
+
 END {
-  # Clean up after yourself, in case tests fail, or the interpreter is interrupted partway though...
+  # Define cleanup of registry, to return it to its 'pristine' state, 
+  # so that later attempts to run tests don't run into problems caused 
+  # by failure of these tests, or abortion of the test script.
+  # Reconnect to MOBY Central here, since other connections 
+  # will have gone out of scope by the time we get to this END block.
+  # Also can't use %Obj, 
+  my $C = MOBY::Client::Central->new();
+  my $r = $C->deregisterNamespace( namespaceType => 'Rub1' );
+  $r = $C->deregisterNamespace( namespaceType => 'Rub2' );
 };
 
+
 my @must_implement = qw/
   collectionResponse
   complexResponse
@@ -150,7 +178,7 @@
 # be returned; other articlenames will generate a 'undef' response, so that the number of inputs
 # matches the number of outputs.
 
-my @NS = ("NCBI_gi", "SGD");
+my @NS = ("Rub1", "Rub2");
 my $articles = [ XML_maker("<Simple><Object namespace='$NS[0]' id='163483'/></Simple>"), 
 		 XML_maker("<Simple><Object namespace='invalid_ns' id='163483'/></Simple>"),
 		 XML_maker("<Simple><Object namespace='$NS[1]' id='S0005111'/></Simple>")
@@ -177,7 +205,7 @@
   or diag("Wrong number of Simple Articles IDs returned " .
 	  "(expected zero for bogus namespace)");
 
-is(scalar getSimpleArticleIDs('SGD_LOCUS', $articles), scalar @{$articles})
+is(scalar getSimpleArticleIDs('Rub1', $articles), scalar @{$articles})
   or diag("Wrong number of Simple Articles IDs returned " .
 	  "(expected zero for valid but unused namespace)");
 
@@ -300,7 +328,7 @@
   }
 }
 # Check that bona-fide namespaces are valid, regardless of position in the list of valid namespaces
-my @ns = ('SGD', 'SGD_LOCUS');
+my @ns = ('Rub1', 'Rub2');
 foreach (@ns) {
   ok (validateThisNamespace($_, @ns), "Validate namespace")
     or diag("Namespace ($_) not in list of namespaces");




More information about the MOBY-guts mailing list