/[volute]/trunk/projects/grid/vospace/php_endpoint/tests/test_endpoint.php
ViewVC logotype

Diff of /trunk/projects/grid/vospace/php_endpoint/tests/test_endpoint.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 528 by richard.p.wagner, Tue May 20 08:42:25 2008 UTC revision 731 by richard.p.wagner, Tue Aug 19 05:41:49 2008 UTC
# Line 5  Line 5 
5  require_once(SIMPLE_TEST . 'unit_tester.php');  require_once(SIMPLE_TEST . 'unit_tester.php');
6  require_once(SIMPLE_TEST . 'reporter.php');  require_once(SIMPLE_TEST . 'reporter.php');
7    
8    require_once('debug_funcs.php');
 function barf($client) {  
     print "<pre>\n";  
     print "Request:\n".htmlspecialchars($client->__getLastRequest()) ."\n";  
     print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";  
     print "</pre>";  
   
     print "<pre>";  
     print_r($client->__getTypes());  
     print "</pre>";  
   
 }  
   
 function barf_min($client) {  
     print "<pre>\n";  
     print "Request:\n".htmlspecialchars($client->__getLastRequest()) ."\n";  
     print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";  
     print "</pre>";  
 }  
   
 function barf_var($var) {  
     print "<pre>\n";  
     var_dump($var);  
     print "</pre>";  
 }  
9    
10  class TestVOSpaceServiceEndpoint extends UnitTestCase {  class TestVOSpaceServiceEndpoint extends UnitTestCase {
   function TestVOSpaceServiceEndpoint() {  
     $this->UnitTestCase();  
   
   }  
11    
12    function setUp(){    function setUp(){
13      $this->client = new      $this->client = new
14        SoapClient(        SoapClient(
15                   "../vospace.wsdl",                   '../vospace.wsdl',
16                   array('location' => 'http://localhost/vospace/vospace_endpoint.php',                   array('location' => 'http://localhost/vos/vospace/vospace_endpoint.php',
17                         'uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1',                         'uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1',
18                         "trace"      => 1,                         'trace'      => 1,
19                         "exceptions" => 1));                         'exceptions' => 1));
20    
21    }    }
22    
# Line 62  Line 34 
34    function testGetProperties() {    function testGetProperties() {
35            
36      $response = $this->client->GetProperties();      $response = $this->client->GetProperties();
37           print "<pre>";          //print '<pre>';    
38           var_dump($response);      //var_dump($response);
39           print "</pre>";      //print '</pre>';
40           barf($this->client);      //barf($this->client);
41        
42      $accepts = $response->accepts;      $accepts = $response->accepts;
43      $provides = $response->provides;      $provides = $response->provides;
44      $contains = $response->contains;      $contains = $response->contains;
# Line 77  Line 49 
49    
50      // hard coding the order to keep things simple      // hard coding the order to keep things simple
51      $this->assertEqual($provides->property[0]->uri,      $this->assertEqual($provides->property[0]->uri,
52                         "ivo://net.ivoa.vospace/properties#size" );                         'ivo://net.ivoa.vospace/properties#size' );
53      $this->assertEqual($provides->property[0]->readonly, True);      $this->assertEqual($provides->property[0]->readonly, True);
54    
55      $this->assertEqual($provides->property[1]->uri,      $this->assertEqual($provides->property[1]->uri,
56                         "ivo://net.ivoa.vospace/properties#owner" );                         'ivo://net.ivoa.vospace/properties#owner' );
57      $this->assertEqual($provides->property[1]->readonly, True);      $this->assertEqual($provides->property[1]->readonly, True);
58    
59      $this->assertEqual($provides->property[2]->uri,      $this->assertEqual($provides->property[2]->uri,
60                         "ivo://net.ivoa.vospace/properties#modificationdate" );                         'ivo://net.ivoa.vospace/properties#modificationdate' );
61      $this->assertEqual($provides->property[2]->readonly, True);      $this->assertEqual($provides->property[2]->readonly, True);
62    
63      $this->assertEqual($provides->property[3]->uri,      $this->assertEqual($provides->property[3]->uri,
64                         "ivo://net.ivoa.vospace/properties#creationdate" );                         'ivo://net.ivoa.vospace/properties#creationdate' );
65      $this->assertEqual($provides->property[3]->readonly, True);      $this->assertEqual($provides->property[3]->readonly, True);
66    
67      //     print "<pre>";          //     print '<pre>';    
68      //     var_dump($provides);      //     var_dump($provides);
69      //     print "</pre>";      //     print '</pre>';
70      //     barf($this->client);      //     barf($this->client);
71    }    }
72    
# Line 102  Line 74 
74    function testNodeNotFound() {    function testNodeNotFound() {
75    
76       try {       try {
77         $response = $this->client->GetNode(array("target" => 'vos://foo.bar.baz!bang'));         $response = $this->client->GetNode(array('target' => 'ivo://example.org!vospace/foo.txt'));
78       }       }
79       catch (SoapFault $exp) {       catch (SoapFault $exp) {
80         $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'vos://foo.bar.baz!bang' );         $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'ivo://example.org!vospace/foo.txt' );
81       }       }
82    
     //barf($this->client);  
83    }    }
84    
85    function testGetNode() {    function testGetNode() {
86            
87      $response = $this->client->GetNode(array("target" => 'vos://exmple.org!vospace/foo.txt'));      $response = $this->client->GetNode(array('target' => 'ivo://example.org!vospace/128cubed_hierarchy.png'));
88      $node = $response->node;      $node = $response->node;
89      $properties = $response->properties;      $properties = $response->properties;
90    
91      $this->assertEqual($node->uri, 'vos://exmple.org!vospace/foo.txt' );      $this->assertEqual($node->uri, 'ivo://example.org!vospace/128cubed_hierarchy.png' );
92    
93      $this->assertNotNull($node->properties);      $this->assertNotNull($node->properties);
94                                
95      $this->assertEqual($node->properties->property[0]->uri,      $this->assertEqual($node->properties->property[0]->uri,
96                         "ivo://net.ivoa.vospace/properties#size" );                         'ivo://net.ivoa.vospace/properties#size' );
97      $this->assertEqual($node->properties->property[0]->readonly, True);      $this->assertEqual($node->properties->property[0]->readonly, True);
98    
99      $this->assertEqual($node->properties->property[0]->_, "1");      $this->assertEqual($node->properties->property[0]->_, '569516');
100    
101      $this->assertEqual($node->properties->property[1]->uri,      $this->assertEqual($node->properties->property[1]->uri,
102                         "ivo://net.ivoa.vospace/properties#owner" );                         'ivo://net.ivoa.vospace/properties#owner' );
103      $this->assertEqual($node->properties->property[1]->readonly, True);      $this->assertEqual($node->properties->property[1]->readonly, True);
104    
105      $this->assertEqual($node->properties->property[2]->uri,      $this->assertEqual($node->properties->property[2]->uri,
106                         "ivo://net.ivoa.vospace/properties#modificationdate" );                         'ivo://net.ivoa.vospace/properties#modificationdate' );
107      $this->assertEqual($node->properties->property[2]->readonly, True);      $this->assertEqual($node->properties->property[2]->readonly, True);
108    
109      $this->assertEqual($node->properties->property[3]->uri,      $this->assertEqual($node->properties->property[3]->uri,
110                         "ivo://net.ivoa.vospace/properties#creationdate" );                         'ivo://net.ivoa.vospace/properties#creationdate' );
111      $this->assertEqual($node->properties->property[3]->readonly, True);      $this->assertEqual($node->properties->property[3]->readonly, True);
112    
113      //barf_min($this->client);      //barf_min($this->client);
114    }    }
115    
116    function testListNodes() {    function testPullFromNodeNotFound() {
117        
118      $this->client->ListNodes();       try {
119           $response = $this->client->PullFromVoSpace(array('source' => 'ivo://example.org!vospace/foo.txt',
120                                                            'transfer' => Null));
121         }
122         catch (SoapFault $exp) {
123           $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'ivo://example.org!vospace/foo.txt' );
124         }
125    
126    }    }
127    
128    //   function testListNodes() {
129        
130    //     $this->client->ListNodes();
131    //   }
132  }  }
133    
134  $test = &new TestVOSpaceServiceEndpoint();  $test = &new TestVOSpaceServiceEndpoint();

Legend:
Removed from v.528  
changed lines
  Added in v.731

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26