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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 734 - (show annotations)
Tue Aug 19 19:37:17 2008 UTC (12 years, 3 months ago) by richard.p.wagner
File size: 5114 byte(s)
working on listing nodes
1 <?php
2
3 include('../config.inc');
4
5 require_once(SIMPLE_TEST . 'unit_tester.php');
6 require_once(SIMPLE_TEST . 'reporter.php');
7
8 require_once('debug_funcs.php');
9
10 class TestVOSpaceServiceEndpoint extends UnitTestCase {
11
12 function setUp(){
13 $this->client = new
14 SoapClient(
15 '../vospace.wsdl',
16 array('location' => 'http://localhost/vos/vospace/vospace_endpoint.php',
17 'uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1',
18 'trace' => 1,
19 'exceptions' => 1));
20
21 }
22
23 function testNewServiceEndpoint() {
24
25 $this->assertNotNull($this->client);
26 }
27
28 function testFunctionsList() {
29
30 $function_list = $this->client->__getFunctions();
31 $this->assertEqual(count($function_list), 15);
32 }
33
34 function testGetProperties() {
35
36 $response = $this->client->GetProperties();
37 //print '<pre>';
38 //var_dump($response);
39 //print '</pre>';
40 //barf($this->client);
41
42 $accepts = $response->accepts;
43 $provides = $response->provides;
44 $contains = $response->contains;
45
46 $this->assertNotNull($accepts);
47 $this->assertNotNull($provides);
48 $this->assertNotNull($contains);
49
50 // hard coding the order to keep things simple
51 $this->assertEqual($provides->property[0]->uri,
52 'ivo://net.ivoa.vospace/properties#size' );
53 $this->assertEqual($provides->property[0]->readonly, True);
54
55 $this->assertEqual($provides->property[1]->uri,
56 'ivo://net.ivoa.vospace/properties#owner' );
57 $this->assertEqual($provides->property[1]->readonly, True);
58
59 $this->assertEqual($provides->property[2]->uri,
60 'ivo://net.ivoa.vospace/properties#modificationdate' );
61 $this->assertEqual($provides->property[2]->readonly, True);
62
63 $this->assertEqual($provides->property[3]->uri,
64 'ivo://net.ivoa.vospace/properties#creationdate' );
65 $this->assertEqual($provides->property[3]->readonly, True);
66
67 // print '<pre>';
68 // var_dump($provides);
69 // print '</pre>';
70 // barf($this->client);
71 }
72
73
74 function testNodeNotFound() {
75
76 try {
77 $response = $this->client->GetNode(array('target' => 'ivo://example.org!vospace/foo.txt'));
78 }
79 catch (SoapFault $exp) {
80 $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'ivo://example.org!vospace/foo.txt' );
81 }
82
83 }
84
85 function testGetNode() {
86
87 $response = $this->client->GetNode(array('target' => 'ivo://example.org!vospace/128cubed_hierarchy.png'));
88 $node = $response->node;
89 $properties = $response->properties;
90
91 $this->assertEqual($node->uri, 'ivo://example.org!vospace/128cubed_hierarchy.png' );
92
93 $this->assertNotNull($node->properties);
94
95 $this->assertEqual($node->properties->property[0]->uri,
96 'ivo://net.ivoa.vospace/properties#size' );
97 $this->assertEqual($node->properties->property[0]->readonly, True);
98
99 $this->assertEqual($node->properties->property[0]->_, '569516');
100
101 $this->assertEqual($node->properties->property[1]->uri,
102 'ivo://net.ivoa.vospace/properties#owner' );
103 $this->assertEqual($node->properties->property[1]->readonly, True);
104
105 $this->assertEqual($node->properties->property[2]->uri,
106 'ivo://net.ivoa.vospace/properties#modificationdate' );
107 $this->assertEqual($node->properties->property[2]->readonly, True);
108
109 $this->assertEqual($node->properties->property[3]->uri,
110 'ivo://net.ivoa.vospace/properties#creationdate' );
111 $this->assertEqual($node->properties->property[3]->readonly, True);
112
113 //barf_min($this->client);
114 }
115
116 function testPullFromNodeNotFound() {
117
118 try {
119 $response = $this->client->PullFromVoSpace(array('source' =>
120 'ivo://example.org!vospace/foo.txt',
121 'transfer' => Null));
122 }
123 catch (SoapFault $exp) {
124 $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'ivo://example.org!vospace/foo.txt' );
125 }
126 }
127
128 function testPullFrom() {
129
130 $view = array('uri' => 'ivo://net.ivoa.vospace/views#identity',
131 'original'=>True);
132 $protocol = array('uri' => 'ivo://net.ivoa.vospace/protocols#http-client');
133
134 $request = array('source' =>
135 'ivo://example.org!vospace/bill_of_rights.txt',
136 'transfer' => array('view'=> $view,
137 'protocol' => $protocol));
138
139 $response = $this->client->PullFromVoSpace($request);
140 $this->assertNotNull($response->transfer);
141
142 $endpoint = $response->transfer->protocol->endpoint;
143
144 // now we're going to check that the endpoint is
145 // really there
146 $this->assertTrue(url_exists($endpoint));
147
148 }
149
150 function testListNodesNodeNotFound() {
151 $this->client->ListNodes();
152 $this->assertTrue(0);
153 }
154
155 function testListNodesRoot() {
156 $this->client->ListNodes();
157 $this->assertTrue(0);
158 }
159
160 // function testListNodesContainer() {
161 // $this->client->ListNodes();
162 // }
163
164 // function testListNodesSingleNode() {
165 // $this->client->ListNodes();
166 // }
167
168 // function testListNodesWildcard() {
169 // $this->client->ListNodes();
170 // }
171
172 }
173
174 $test = &new TestVOSpaceServiceEndpoint();
175 $test->run(new HtmlReporter());
176
177 ?>

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