/[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 731 - (show annotations)
Tue Aug 19 05:41:49 2008 UTC (12 years, 10 months ago) by richard.p.wagner
File size: 4073 byte(s)
switching to file system backend for testing
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' => '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();
135 $test->run(new HtmlReporter());
136
137 ?>

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