/[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 731 - (hide 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 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 richard.p.wagner 731 require_once('debug_funcs.php');
9 richard.p.wagner 106
10     class TestVOSpaceServiceEndpoint extends UnitTestCase {
11    
12     function setUp(){
13     $this->client = new
14     SoapClient(
15 richard.p.wagner 731 '../vospace.wsdl',
16     array('location' => 'http://localhost/vos/vospace/vospace_endpoint.php',
17 richard.p.wagner 106 'uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1',
18 richard.p.wagner 731 'trace' => 1,
19     'exceptions' => 1));
20 richard.p.wagner 106
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 richard.p.wagner 731 //print '<pre>';
38     //var_dump($response);
39     //print '</pre>';
40     //barf($this->client);
41    
42 richard.p.wagner 106 $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 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#size' );
53 richard.p.wagner 106 $this->assertEqual($provides->property[0]->readonly, True);
54    
55     $this->assertEqual($provides->property[1]->uri,
56 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#owner' );
57 richard.p.wagner 106 $this->assertEqual($provides->property[1]->readonly, True);
58    
59     $this->assertEqual($provides->property[2]->uri,
60 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#modificationdate' );
61 richard.p.wagner 106 $this->assertEqual($provides->property[2]->readonly, True);
62    
63     $this->assertEqual($provides->property[3]->uri,
64 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#creationdate' );
65 richard.p.wagner 106 $this->assertEqual($provides->property[3]->readonly, True);
66    
67 richard.p.wagner 731 // print '<pre>';
68 richard.p.wagner 106 // var_dump($provides);
69 richard.p.wagner 731 // print '</pre>';
70 richard.p.wagner 106 // barf($this->client);
71     }
72    
73    
74     function testNodeNotFound() {
75    
76     try {
77 richard.p.wagner 731 $response = $this->client->GetNode(array('target' => 'ivo://example.org!vospace/foo.txt'));
78 richard.p.wagner 106 }
79     catch (SoapFault $exp) {
80 richard.p.wagner 731 $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'ivo://example.org!vospace/foo.txt' );
81 richard.p.wagner 106 }
82    
83     }
84    
85     function testGetNode() {
86    
87 richard.p.wagner 731 $response = $this->client->GetNode(array('target' => 'ivo://example.org!vospace/128cubed_hierarchy.png'));
88 richard.p.wagner 106 $node = $response->node;
89     $properties = $response->properties;
90    
91 richard.p.wagner 731 $this->assertEqual($node->uri, 'ivo://example.org!vospace/128cubed_hierarchy.png' );
92 richard.p.wagner 106
93     $this->assertNotNull($node->properties);
94    
95     $this->assertEqual($node->properties->property[0]->uri,
96 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#size' );
97 richard.p.wagner 106 $this->assertEqual($node->properties->property[0]->readonly, True);
98    
99 richard.p.wagner 731 $this->assertEqual($node->properties->property[0]->_, '569516');
100 richard.p.wagner 106
101     $this->assertEqual($node->properties->property[1]->uri,
102 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#owner' );
103 richard.p.wagner 106 $this->assertEqual($node->properties->property[1]->readonly, True);
104    
105     $this->assertEqual($node->properties->property[2]->uri,
106 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#modificationdate' );
107 richard.p.wagner 106 $this->assertEqual($node->properties->property[2]->readonly, True);
108    
109     $this->assertEqual($node->properties->property[3]->uri,
110 richard.p.wagner 731 'ivo://net.ivoa.vospace/properties#creationdate' );
111 richard.p.wagner 106 $this->assertEqual($node->properties->property[3]->readonly, True);
112    
113     //barf_min($this->client);
114     }
115    
116 richard.p.wagner 731 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 richard.p.wagner 106
130 richard.p.wagner 731 // $this->client->ListNodes();
131     // }
132 richard.p.wagner 106 }
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