comparison dbus-d-javatests/dsrc/DBusTesting.d @ 4:427c0332a111

work on DBusTesting
author Frank Benoit <benoit@tionex.de>
date Sun, 21 Oct 2007 14:49:02 +0200
parents c8f7d77e4d4a
children 7c2c75740370
comparison
equal deleted inserted replaced
3:c8f7d77e4d4a 4:427c0332a111
1 1
2 module DBusTesting; 2 module DBusTesting;
3 3
4 import tango.sys.Environment; 4 import tango.sys.Environment;
5 import tango.io.Stdout;
6 import tango.core.Exception;
7
8 import org.freedesktop.dbus.DBus;
5 9
6 import DBusTestingGen; 10 import DBusTestingGen;
7 11
12 bool exceptionsActive = false;
13 char[][] called;
14 void checkCall( char[] name ){
15 called ~= name.dup;
16 if( exceptionsActive ){
17 throw new TracedException( "Test Exception thrown" );
18 }
19 }
8 20
21 class Dimpl : DBusInterface.dbustest.DImpl {
22 public void testV_V(){
23 checkCall( "testV_V" );
24 }
25 public int testI_I( in int arg1 ){
26 checkCall( "testI_I" );
27 return arg1 + 1234;
28 }
29 }
9 30
10 31
11 32
12 int main(char[][] args) { 33 int main(char[][] args) {
13 34
14 char[] address = Environment.get( "DBUS_ADDRESS" ); 35 char[] address = Environment.get( "DBUS_ADDRESS" );
15 if( ! address ){ 36 if( ! address ){
16 Cout( "Environment variable DBUS_ADDRESS not set" ).newline; 37 Stdout.formatln( "Environment variable DBUS_ADDRESS not set" );
17 return 1; 38 return 1;
18 } 39 }
19 Cout( "D-App started").newline; 40 Stdout.formatln( "D-App started");
20 DBus.DirectConnection dc = new DBus.DirectConnection( args[1] ); 41 DirectConnection dc = new DirectConnection( args[1] );
21 Cout("D-App connected").newline; 42 Stdout.formatln("D-App connected");
22 // auto o = new MyDataFileSystem(); 43 // auto o = new MyDataFileSystem();
23 // o.registerDBusObject( dc.conn ); 44 // o.registerDBusObject( dc.conn );
24 // Cout("Export obj : ")( o.getDBusInstanceName() ).newline; 45 // Cout("Export obj : ")( o.getDBusInstanceName() ).newline;
25 dc.mainLoop(); 46 dc.mainLoop();
26 Cout("D-App disconnected").newline; 47 Stdout.formatln("D-App disconnected");
27 return 0; 48 return 0;
28 } 49 }