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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 528 - (hide annotations)
Tue May 20 08:42:25 2008 UTC (13 years, 1 month ago) by richard.p.wagner
File size: 4355 byte(s)
presentations
1 richard.p.wagner 106 <?php
2    
3     include('../config.inc');
4    
5     require_once(SIMPLE_TEST . 'unit_tester.php');
6     require_once(SIMPLE_TEST . 'reporter.php');
7    
8    
9     function barf($client) {
10     print "<pre>\n";
11     print "Request:\n".htmlspecialchars($client->__getLastRequest()) ."\n";
12     print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
13     print "</pre>";
14    
15     print "<pre>";
16     print_r($client->__getTypes());
17     print "</pre>";
18    
19     }
20    
21     function barf_min($client) {
22     print "<pre>\n";
23     print "Request:\n".htmlspecialchars($client->__getLastRequest()) ."\n";
24     print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
25     print "</pre>";
26     }
27    
28     function barf_var($var) {
29     print "<pre>\n";
30     var_dump($var);
31     print "</pre>";
32     }
33    
34     class TestVOSpaceServiceEndpoint extends UnitTestCase {
35     function TestVOSpaceServiceEndpoint() {
36     $this->UnitTestCase();
37    
38     }
39    
40     function setUp(){
41     $this->client = new
42     SoapClient(
43     "../vospace.wsdl",
44     array('location' => 'http://localhost/vospace/vospace_endpoint.php',
45     'uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1',
46     "trace" => 1,
47     "exceptions" => 1));
48    
49     }
50    
51     function testNewServiceEndpoint() {
52    
53     $this->assertNotNull($this->client);
54     }
55    
56     function testFunctionsList() {
57    
58     $function_list = $this->client->__getFunctions();
59     $this->assertEqual(count($function_list), 15);
60     }
61    
62     function testGetProperties() {
63    
64     $response = $this->client->GetProperties();
65 richard.p.wagner 528 print "<pre>";
66     var_dump($response);
67     print "</pre>";
68     barf($this->client);
69    
70 richard.p.wagner 106 $accepts = $response->accepts;
71     $provides = $response->provides;
72     $contains = $response->contains;
73    
74     $this->assertNotNull($accepts);
75     $this->assertNotNull($provides);
76     $this->assertNotNull($contains);
77    
78     // hard coding the order to keep things simple
79     $this->assertEqual($provides->property[0]->uri,
80     "ivo://net.ivoa.vospace/properties#size" );
81     $this->assertEqual($provides->property[0]->readonly, True);
82    
83     $this->assertEqual($provides->property[1]->uri,
84     "ivo://net.ivoa.vospace/properties#owner" );
85     $this->assertEqual($provides->property[1]->readonly, True);
86    
87     $this->assertEqual($provides->property[2]->uri,
88     "ivo://net.ivoa.vospace/properties#modificationdate" );
89     $this->assertEqual($provides->property[2]->readonly, True);
90    
91     $this->assertEqual($provides->property[3]->uri,
92     "ivo://net.ivoa.vospace/properties#creationdate" );
93     $this->assertEqual($provides->property[3]->readonly, True);
94    
95     // print "<pre>";
96     // var_dump($provides);
97     // print "</pre>";
98     // barf($this->client);
99     }
100    
101    
102     function testNodeNotFound() {
103    
104     try {
105     $response = $this->client->GetNode(array("target" => 'vos://foo.bar.baz!bang'));
106     }
107     catch (SoapFault $exp) {
108     $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'vos://foo.bar.baz!bang' );
109     }
110    
111     //barf($this->client);
112     }
113    
114     function testGetNode() {
115    
116     $response = $this->client->GetNode(array("target" => 'vos://exmple.org!vospace/foo.txt'));
117     $node = $response->node;
118     $properties = $response->properties;
119    
120     $this->assertEqual($node->uri, 'vos://exmple.org!vospace/foo.txt' );
121    
122     $this->assertNotNull($node->properties);
123    
124     $this->assertEqual($node->properties->property[0]->uri,
125     "ivo://net.ivoa.vospace/properties#size" );
126     $this->assertEqual($node->properties->property[0]->readonly, True);
127    
128     $this->assertEqual($node->properties->property[0]->_, "1");
129    
130     $this->assertEqual($node->properties->property[1]->uri,
131     "ivo://net.ivoa.vospace/properties#owner" );
132     $this->assertEqual($node->properties->property[1]->readonly, True);
133    
134     $this->assertEqual($node->properties->property[2]->uri,
135     "ivo://net.ivoa.vospace/properties#modificationdate" );
136     $this->assertEqual($node->properties->property[2]->readonly, True);
137    
138     $this->assertEqual($node->properties->property[3]->uri,
139     "ivo://net.ivoa.vospace/properties#creationdate" );
140     $this->assertEqual($node->properties->property[3]->readonly, True);
141    
142     //barf_min($this->client);
143     }
144    
145     function testListNodes() {
146    
147     $this->client->ListNodes();
148     }
149     }
150    
151     $test = &new TestVOSpaceServiceEndpoint();
152     $test->run(new HtmlReporter());
153    
154     ?>

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