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 |
|
|
require_once('../vospace_service.php'); |
9 |
|
|
|
10 |
richard.p.wagner |
731 |
require_once('debug_funcs.php'); |
11 |
|
|
|
12 |
|
|
class target_node{ |
13 |
|
|
public $target; |
14 |
|
|
function __construct($tg) { |
15 |
|
|
$this->target = $tg; |
16 |
|
|
} |
17 |
|
|
} |
18 |
|
|
|
19 |
richard.p.wagner |
106 |
class TestVOSpaceService extends UnitTestCase { |
20 |
richard.p.wagner |
731 |
function setUp() { |
21 |
richard.p.wagner |
106 |
$this->vospace_server = new SoapServer('../vospace.wsdl', |
22 |
|
|
array('uri' => 'http://www.ivoa.net/xml/VOSpaceContract-v1.1rc1')); |
23 |
|
|
$this->vospace_server->SetClass("VOSpaceService"); |
24 |
|
|
|
25 |
|
|
$this->service = new VOSpaceService(); |
26 |
|
|
|
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
function testNewServer() { |
30 |
|
|
$this->assertNotNull($this->vospace_server); |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
function testFunctionsList() { |
34 |
|
|
|
35 |
|
|
$function_list = $this->vospace_server->getFunctions(); |
36 |
|
|
|
37 |
|
|
$this->assertNotNull($function_list); |
38 |
|
|
$this->assertTrue(in_array("ListNodes", $function_list)); |
39 |
|
|
$this->assertEqual(count($function_list), 15); |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
function testProperties() { |
43 |
|
|
|
44 |
|
|
$prop_list = $this->service->GetProperties(); |
45 |
|
|
|
46 |
richard.p.wagner |
731 |
//barf_var($prop_list); |
47 |
|
|
|
48 |
richard.p.wagner |
106 |
$this->assertNotNull($prop_list); |
49 |
|
|
|
50 |
richard.p.wagner |
731 |
$size = $prop_list["provides"][0]; |
51 |
richard.p.wagner |
106 |
|
52 |
|
|
// properties are of a class Property |
53 |
richard.p.wagner |
731 |
$this->assertNotNull($size); |
54 |
|
|
$this->assertEqual($size["uri"], "ivo://net.ivoa.vospace/properties#size"); |
55 |
|
|
$this->assertEqual($size["readOnly"], TRUE); |
56 |
richard.p.wagner |
106 |
} |
57 |
|
|
|
58 |
richard.p.wagner |
731 |
function testGetNode() { |
59 |
|
|
|
60 |
|
|
$node = $this->service->GetNode(new target_node('ivo://example.org!vospace/128cubed_hierarchy.png')); |
61 |
|
|
|
62 |
|
|
//barf_var($node); |
63 |
|
|
|
64 |
|
|
$this->assertNotNull($node["node"]); |
65 |
|
|
$this->assertEqual($node["node"]->properties[0]["_"], 569516); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
|
69 |
richard.p.wagner |
106 |
} |
70 |
|
|
|
71 |
|
|
|
72 |
|
|
$test = &new TestVOSpaceService(); |
73 |
|
|
$test->run(new HtmlReporter()); |
74 |
|
|
|
75 |
|
|
?> |