/[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 106 - (hide annotations)
Thu Mar 27 06:46:37 2008 UTC (13 years, 3 months ago) by richard.p.wagner
File size: 4239 byte(s)
creating grid project, and starting vospace project
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     $accepts = $response->accepts;
66     $provides = $response->provides;
67     $contains = $response->contains;
68    
69     $this->assertNotNull($accepts);
70     $this->assertNotNull($provides);
71     $this->assertNotNull($contains);
72    
73     // hard coding the order to keep things simple
74     $this->assertEqual($provides->property[0]->uri,
75     "ivo://net.ivoa.vospace/properties#size" );
76     $this->assertEqual($provides->property[0]->readonly, True);
77    
78     $this->assertEqual($provides->property[1]->uri,
79     "ivo://net.ivoa.vospace/properties#owner" );
80     $this->assertEqual($provides->property[1]->readonly, True);
81    
82     $this->assertEqual($provides->property[2]->uri,
83     "ivo://net.ivoa.vospace/properties#modificationdate" );
84     $this->assertEqual($provides->property[2]->readonly, True);
85    
86     $this->assertEqual($provides->property[3]->uri,
87     "ivo://net.ivoa.vospace/properties#creationdate" );
88     $this->assertEqual($provides->property[3]->readonly, True);
89    
90     // print "<pre>";
91     // var_dump($provides);
92     // print "</pre>";
93     // barf($this->client);
94     }
95    
96    
97     function testNodeNotFound() {
98    
99     try {
100     $response = $this->client->GetNode(array("target" => 'vos://foo.bar.baz!bang'));
101     }
102     catch (SoapFault $exp) {
103     $this->assertEqual($exp->detail->NodeNotFoundFault->uri, 'vos://foo.bar.baz!bang' );
104     }
105    
106     //barf($this->client);
107     }
108    
109     function testGetNode() {
110    
111     $response = $this->client->GetNode(array("target" => 'vos://exmple.org!vospace/foo.txt'));
112     $node = $response->node;
113     $properties = $response->properties;
114    
115     $this->assertEqual($node->uri, 'vos://exmple.org!vospace/foo.txt' );
116    
117     $this->assertNotNull($node->properties);
118    
119     $this->assertEqual($node->properties->property[0]->uri,
120     "ivo://net.ivoa.vospace/properties#size" );
121     $this->assertEqual($node->properties->property[0]->readonly, True);
122    
123     $this->assertEqual($node->properties->property[0]->_, "1");
124    
125     $this->assertEqual($node->properties->property[1]->uri,
126     "ivo://net.ivoa.vospace/properties#owner" );
127     $this->assertEqual($node->properties->property[1]->readonly, True);
128    
129     $this->assertEqual($node->properties->property[2]->uri,
130     "ivo://net.ivoa.vospace/properties#modificationdate" );
131     $this->assertEqual($node->properties->property[2]->readonly, True);
132    
133     $this->assertEqual($node->properties->property[3]->uri,
134     "ivo://net.ivoa.vospace/properties#creationdate" );
135     $this->assertEqual($node->properties->property[3]->readonly, True);
136    
137     //barf_min($this->client);
138     }
139    
140     function testListNodes() {
141    
142     $this->client->ListNodes();
143     }
144     }
145    
146     $test = &new TestVOSpaceServiceEndpoint();
147     $test->run(new HtmlReporter());
148    
149     ?>

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