[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Thu Jul 28 20:41:24 UTC 2005
mwilkinson
Thu Jul 28 16:41:24 EDT 2005
Update of /home/repository/moby/moby-live/Perl/t
In directory pub.open-bio.org:/tmp/cvs-serv5656/t
Modified Files:
Client-Central.t
Log Message:
adding more tests to ensure that collection registration is functioning properly. All existing tests now pass on the new codebase 0.85
moby-live/Perl/t Client-Central.t,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/t/Client-Central.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/07/22 23:25:06 1.10
+++ /home/repository/moby/moby-live/Perl/t/Client-Central.t 2005/07/28 20:41:24 1.11
@@ -15,8 +15,8 @@
# Test 2
my $C = MOBY::Client::Central->new(
Registries => {
- mobycentral => { URL => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/MOBY-Central.pl',
- URI => 'http://mobycentral.icapture.ubc.ca/MOBY/Central'}
+ mobycentral => { URL => 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/MOBY-Central.pl',
+ URI => 'http://mobycentral.icapture.ubc.ca/MOBY/Central'}
}
);
@@ -239,7 +239,102 @@
is($enum =~/\|10\|/, 1) or diag("enum element missing");
is($enum =~/\|0\|/, 1) or diag("enum element missing");
-# Test 12
+
+$r = $C->registerService(
+ serviceName => "mysecondservice",
+ serviceType => "Retrieval",
+ authURI => "test.suite.com",
+ contactEmail => 'your at mail.address',
+ description => "this is my second service",
+ category => "moby",
+ URL => "http://illuminae/cgi-bin/service.pl",
+ input =>[
+ ['articleName1', [[Object => ['UglyNamespace']]]], # Simple
+ ],
+ output =>[
+ ['articleName2', [[String => ['UglyNamespace']]]], # Simple
+ ],
+ secondary => {
+ parametername1 => {
+ datatype => 'Integer',
+ default => 0,
+ max => 10,
+ min => -10,
+ enum => [-10, 10, 0]}});
+
+( ok($r->success,"Service registration of collections successful")
+) or diag("Service registration of collections failure: ".$r->message) ;
+
+# test 11 - find by auth & name
+($si, $r) = $C->findService(
+ serviceName => "mysecondservice",
+ authURI => "test.suite.com");
+( is($r, undef, "Service discovery of collections successful")
+) or diag("Service discovery of collections failure") ;
+
+
+
+
+
+
+isa_ok($si, 'ARRAY') or diag("findService with collections didn't return an array ref");
+is(scalar(@$si),1) or diag("findService with collections found too many services");
+$SI = shift @$si;
+print STDERR "$SI";
+isa_ok($SI, 'MOBY::Client::ServiceInstance') or diag("findService collections didn't return a MOBY::Client::ServceInstance");
+isa_ok($SI->input, ARRAY) or diag ("ServiceInstance object input is not a listref (collections test)");
+isa_ok($SI->output, ARRAY) or diag ("ServiceInstance object output is not a listref (collections test)");
+is($SI->name, "mysecondservice") or diag("servicename wrong (collections test)");
+is($SI->authoritative, 0) or diag("service reported to be incorrectly authoritative (collections test)");
+is($SI->authority, "test.suite.com") or diag("authURI incorrect (collections test)");
+is($SI->type, "Retrieval") or diag("service type incorrect (collections test)");
+is($SI->description, "this is my first service") or diag("service description wrong (collections test)");
+is($SI->URL, "http://illuminae/cgi-bin/service.pl") or diag("service URL incorrect (collections test)");
+is($SI->contactEmail, 'your at mail.address') or diag("contact email incorrect (collections test)");
+is($SI->category, "moby") or diag("service category incorrect (collections test)");
+
+ 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 (collections test)");
+is(scalar(@outs), 1) or diag("incorrect number of outputs in servce instance (collections test)");
+is(scalar(@secs), 1) or diag("incorrect number of secodary in servce instance (collections test)");
+
+$in = shift @ins;
+$out = shift @outs;
+$sec = shift @secs;
+
+isa_ok($in, 'MOBY::Client::CollectionArticle') or diag("->inputs did not return a MOBY::collection_input object or client parser failed for MOBY::Client::CollectionArticle");
+isa_ok($out, 'MOBY::Client::CollectionArticle') or diag("->outputs did not return a MOBY::collection_output object or client parser failed for MOBY::Client::CollectionArticle");
+isa_ok($sec, 'MOBY::Client::SecondaryArticle') or diag("->secondarues did not return a MOBY::secondary_input object");
+
+isa_ok($in->Simples, "ARRAY") or diag("->Simples did not return an arrayref (collections test)");
+isa_ok($out->Simples, "ARRAY") or diag("->Simples did not return an arrayref (collections test)");
+my $simplesin = $in->Simples;
+my $simplesout = $out->Simples;
+
+is(scalar(@$simplesin), 1) or diag("->Simples returning wrong number of simple inputs in the collection");
+is(scalar(@$simplesout), 1) or diag("->Simples returning wrong number of simple outputs in the collection");
+
+$in = shift(@$simplesin);
+$out = shift(@$simplesout);
+
+is($in->objectType, "Object") or diag("simple input type reported incorrectly (collections test)");
+is($in->articleName, "articleName1") or diag("simple input article name reported incorrectly (collections test)");
+isa_ok($in->namespaces, 'ARRAY') or diag("simple input namespaces not returned as an arrayref (collections test)");
+ at ns = @{$in->namespaces};
+is(scalar(@ns),1) or diag("simple input reporting wrong number of namespaces (collections test)");
+$ns = shift @ns;
+is($ns, 'UglyNamespace') or diag("simple input reporting wrong namespace (collections test)");
+
+is($out->objectType, "String") or diag("simple output type reported incorrectly (collections test)");
+is($out->articleName, "articleName2") or diag("simple output article name reported incorrectly (collections test)");
+isa_ok($out->namespaces, 'ARRAY') or diag("simple output namespaces not returned as an arrayref (collections test)");
+ at ns = @{$out->namespaces};
+is(scalar(@ns),1) or diag("simple output reporting wrong number of namespaces (collections test)");
+$ns = shift @ns;
+is($ns, 'UglyNamespace') or diag("simple output reporting wrong namespace (collections test)");
+
$r = $C->deregisterService(
serviceName => "myfirstservice",
@@ -249,6 +344,19 @@
) or diag("Service deregistration failure: ".$r->message) ;
+$r = $C->deregisterService(
+ serviceName => "myfirstservice",
+ authURI => "test.suite.com",
+ );
+( ok(!$r->success,"Service deregistration successful")
+) or diag("Service re-deregistration success (should have failed): ".$r->message) ;
+
+$r = $C->deregisterService(
+ serviceName => "mysecondservice",
+ authURI => "test.suite.com",
+ );
+( ok($r->success,"Service deregistration successful")
+) or diag("Service deregistration failure (second service): ".$r->message) ;
More information about the MOBY-guts
mailing list