Imported Upstream version 1.0.0
[platform/upstream/perl-Net-DBus.git] / t / 50-object-introspect.t
1 # -*- perl -*-
2 use Test::More tests => 3;
3
4 use strict;
5 use warnings;
6
7 BEGIN { 
8     use_ok('Net::DBus::Binding::Introspector');
9     use_ok('Net::DBus::Object');
10 };
11
12 my $bus = Net::DBus->test;
13 my $service = $bus->export_service("/org/cpan/Net/DBus/Test/introspect");
14
15 my $object = Net::DBus::Object->new($service, "/org/example/Object/OtherObject");
16
17 my $introspector = $object->_introspector;
18
19 my $xml_got = $introspector->format($object);
20     
21 my $xml_expect = <<EOF;
22 <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
23 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
24 <node name="/org/example/Object/OtherObject">
25   <interface name="org.freedesktop.DBus.Introspectable">
26     <method name="Introspect">
27       <arg type="s" direction="out"/>
28     </method>
29   </interface>
30   <interface name="org.freedesktop.DBus.Properties">
31     <method name="Get">
32       <arg type="s" direction="in"/>
33       <arg type="s" direction="in"/>
34       <arg type="v" direction="out"/>
35     </method>
36     <method name="GetAll">
37       <arg type="s" direction="in"/>
38       <arg type="a{sv}" direction="out"/>
39     </method>
40     <method name="Set">
41       <arg type="s" direction="in"/>
42       <arg type="s" direction="in"/>
43       <arg type="v" direction="in"/>
44     </method>
45   </interface>
46 </node>
47 EOF
48     
49 is($xml_got, $xml_expect, "xml data matches");
50