b0VIM 7.1      F [L_9  mjj29                                   illythia                                ~mjj29/scm/dbus-java/org/freedesktop/dbus/test/test.java                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     utf-8 3210#"! U                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tp       r            f   s         h            {   A     	   c        
   I           N   h        V           M              Y        S   `        %                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ad  *        r           i            ~  }  Q  2  1                    X  ,          W  .          {  E    
  
  
  
  M
  
  	  	  	  	  v	  t	  E	  *	  %	  	  	  	  	      f  =  8                   }  R  %            |  W  R  8            q  l  I  D                h  =          ~  6          -  (                                               @SuppressWarnings("unchecked")    }       return new TestTuple<String,List<Integer>, Boolean>(info.getSource(), l, true);       l.add(1953);       List<Integer> l = new Vector<Integer>();       DBusCallInfo info = DBusConnection.getCallInfo();          test.fail("show received the wrong arguments");       if (!(in instanceof Integer) || ((Integer) in).intValue() != 234)       System.out.println("Showing Stuff: "+in.getClass()+"("+in+")");    {    public <A> TestTuple<String, List<Integer>, Boolean> show(A in)    }       System.out.println("Done sleeping.");       } catch (InterruptedException Ie) {}          Thread.sleep(1000);       try {       System.out.println("Sleeping.");    {    public void waitawhile()    }          test.fail("new path test got wrong path");       if (!p.toString().equals("/new/path/test"))    {    public void newpathtest(Path p)    }       return f[0];          test.fail("testfloat got incorrect array");             f[3] != 31.42f)                         f[2] != 0.0f ||             f[1] != -23f ||             f[0] != 17.093f ||       if (f.length < 4 ||    {    public float testfloat(float[] f)    }       return out;       }             out[j][k] = lli.get(j).get(k);          for (int k = 0; k < out[j].length; k++)          out[j] = new int[lli.get(j).size()];       for (int j = 0; j < out.length; j++) {       int[][] out = new int[lli.size()][];       List<List<Integer>> lli = in.b;    {    public int[][] teststructstruct(TestStruct3 in)    }       return "Not XML";    {    public String Introspect()    }       this.conn = conn;    {    public testclass(DBusConnection conn)    private DBusConnection conn; { class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignalInterface, TestSignalInterface2, Properties  }    }       return toString();    {    public String getName()    public boolean isRemote() { return false; } { class testnewclass implements TestNewInterface  import org.freedesktop.DBus.Properties; import org.freedesktop.DBus.Introspectable; import org.freedesktop.DBus.Peer; import org.freedesktop.DBus.Error.UnknownObject; import org.freedesktop.DBus.Error.ServiceUnknown; import org.freedesktop.DBus.Error.MatchRuleInvalid; import org.freedesktop.DBus;  import org.freedesktop.dbus.exceptions.NotConnected; import org.freedesktop.dbus.exceptions.DBusExecutionException; import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.Variant; import org.freedesktop.dbus.UInt64; import org.freedesktop.dbus.UInt32; import org.freedesktop.dbus.UInt16; import org.freedesktop.dbus.Path; import org.freedesktop.dbus.Marshalling; import org.freedesktop.dbus.DBusSignal; import org.freedesktop.dbus.DBusSigHandler; import org.freedesktop.dbus.DBusInterface; import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.DBusCallInfo; import org.freedesktop.dbus.DBusAsyncReply; import org.freedesktop.dbus.CallbackHandler;  import java.text.Collator;  import java.util.Vector; import java.util.Set; import java.util.Map; import java.util.List; import java.util.HashMap; import java.util.Arrays;  import java.lang.reflect.Type; import java.lang.reflect.ParameterizedType;  package org.freedesktop.dbus.test; */    Full licence texts are included in the COPYING file with this program.     Academic Free Licence Version 2.1.    under the terms of either the GNU Lesser General Public License Version 2 or the    This program is free software; you can redistribute it and/or modify it     Copyright (c) 2005-2006 Matthew Johnson    D-Bus Java Implementation /* ad  (
  
     %           b  C  $  #        v  u  L  D        m  i  P  7  6        B        F  ?  $  	  
  
  
  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      }    }}       fail("Unexpected Exception Occurred: "+e);       e.printStackTrace();    } catch (Exception e) {              if (!done8) fail("Error callback handler failed to be run");       if (!done7) fail("Signal handler E failed to be run");       if (!done6) fail("Disconnect handler failed to be run");       if (!done5) fail("Signal handler R failed to be run");       if (!done4) fail("Callback handler failed to be run");       if (!done3) fail("Signal handler 3 failed to be run");       if (!done2) fail("Signal handler 2 failed to be run");       if (!done1) fail("Signal handler 1 failed to be run");        serverconn = null;       clientconn = null; 		} 			System.out.println("getName() failed with exception "+NC); 		} catch (NotConnected NC) { 			fail("Should not succeed when disconnected"); 			System.out.println("getName() suceeded and returned: "+tri.getName()); 		try { 		/** Call a method when disconnected */  		clientconn.removeSigHandler(TestSignalInterface.TestSignal.class, sigh); 		/** Remove sig handler */        System.out.println("Trying to do things after disconnection");        serverconn.disconnect();       clientconn.disconnect();       /** Disconnect from the bus. */       System.out.println("Disconnecting");            if (null != DBEe) throw DBEe;       DBEe = clientconn.getError(); ad     z     V       c  2        h  8              r  _      Y  @  %          f  <  *      
  
  x
  O
  	  	  	  	  a	  _	  	    r               i  F      x  p  o  N  "            \  P       {  @          r  f  6      Z  7          z  y                  try {       /** Try and call an explicitly unexported object */              }          System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage());       } catch (UnknownObject UO) {          test.fail("Method Execution should have failed");          System.out.println("Got Remote Name: "+tri.getName());          tri = clientconn.getRemoteObject("foo.bar.Test", "/Moofle", TestRemoteInterface.class);          System.out.println("Calling Method3");       try {       /** Try and call an invalid remote object */              }          System.out.println("Remote Method Failed with: "+SU.getClass().getName()+" "+SU.getMessage());       } catch (ServiceUnknown SU) {          test.fail("Method Execution should have failed");          System.out.println("Got Remote Name: "+tri.getName());          tri = clientconn.getRemoteObject("foo.bar.NotATest", "/Moofle", TestRemoteInterface.class);          System.out.println("Calling Method2");       try {       /** Try and call an invalid remote object */             tri.newpathtest(new Path("/new/path/test"));        tri.sig(ts.toArray(new Type[0]));       Marshalling.getJavaType("ya{si}", ts, -1);       Vector<Type> ts = new Vector<Type>();       /* Test type signatures */        }             test.fail("Error message was not correct");          if (!Te.getMessage().equals("test"))          System.out.println("Remote Method Failed with: "+Te.getClass().getName()+" "+Te.getMessage());       } catch (TestException Te) {          test.fail("Method Execution should have failed");          tri.throwme();          System.out.println("Throwing stuff");       try {       /** call something that throws */        clientconn.callWithCallback(tri, "getNameAndThrow", new callbackhandler());       System.out.println("Doing stuff asynchronously with callback, which throws an error");       clientconn.callWithCallback(tri, "getName", new callbackhandler());       System.out.println("Doing stuff asynchronously with callback");            fail("frobnicate return value incorrect");       if (-5 != rint)       int rint = tri.frobnicate(ls, msmus, 13);       msmus.put("stuff", mus);       Map<String,Map<UInt16,Short>> msmus = new HashMap<String,Map<UInt16,Short>>();       mus.put(new UInt16(6), (short) 7);       mus.put(new UInt16(5), (short) 6);       mus.put(new UInt16(4), (short) 5);       Map<UInt16,Short> mus = new HashMap<UInt16,Short>();       ls.add(71L);       ls.add(5L);       ls.add(2L);       List<Long> ls = new Vector<Long>();       System.out.println("frobnicating");             ||o[2] != 3) fail("teststructstruct returned the wrong thing: "+Arrays.deepToString(out));            ||o[1] != 2            ||o[0] != 1          if (o.length != 3       for (int[] o: out)       if (out.length != 3) fail("teststructstruct returned the wrong thing: "+Arrays.deepToString(out));       int[][] out = tri.teststructstruct(ts3);       TestStruct3 ts3 = new TestStruct3(new TestStruct2(new Vector<String>(), new Variant<Integer>(0)), lli);       lli.add(li);       lli.add(li);       lli.add(li);       li.add(3);       li.add(2);       li.add(1);       List<Integer> li = new Vector<Integer>();       List<List<Integer>> lli = new Vector<List<Integer>>();       System.out.println("Structs of Structs");          fail("testfloat returned the wrong thing");       if (17.093f != tri.testfloat(new float[] { 17.093f, -23f, 0.0f, 31.42f }))       System.out.println("testing floats");       tri.waitawhile();       System.out.println("sending it to sleep");          fail("getName return value incorrect");       if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!", rname))       col.setStrength(Collator.PRIMARY); ad     Z     M     n  .      h  `  ^  $        E  
      w  v  I    |  =  
  
  
  M
  
  	  	  k	        l  =  	        ]  '        p  i  1  o  n  B                r  D        a  E          s  >  =            Z  Y                      System.out.println("Do stuff replied "+b);       Boolean b = stuffreply.getReply();                 fail("Didn't get the correct this");       if (!tclass.equals(tri2.getThis(tri2)))       System.out.println("Get This");           fail("sampleArray return value incorrect");             is.get(4).intValue() != -18)             is.get(3).intValue() != -12 ||             is.get(2).intValue() != -7 ||             is.get(1).intValue() != -5 ||             is.get(0).intValue() != -1 ||       if (is.size() != 5 ||          System.out.println("--"+i);       for (Integer i: is)       System.out.println("sampleArray returned an array:");       List<Integer> is = tri2.sampleArray(l, new Integer[] { 1, 5, 7, 9 }, new long[] { 2, 6, 8, 12 });       System.out.println("Sampling Arrays:");       l.add("aloha");       l.add("hey");       l.add("hej");       l.add("hello");       l.add("hi");       List<String> l = new Vector<String>();                 if (tri2.check()) fail("bools are broken");       System.out.println("Checking bools");        DBusAsyncReply<Boolean> stuffreply = (DBusAsyncReply<Boolean>) clientconn.callMethodAsync(tri2, "dostuff", new TestStruct("bar", new UInt32(52), new Variant<Boolean>(new Boolean(true))));       System.out.println("Doing stuff asynchronously");                 fail("show return value incorrect ("+rv.a+","+rv.b+","+rv.c+")");             true != rv.c.booleanValue())             1953 != rv.b.get(0) ||             1 != rv.b.size() ||       if (!serverconn.getUniqueName().equals(rv.a) ||       System.out.println("Show returned: "+rv);       TestTuple<String,List<Integer>,Boolean> rv = tri2.show(234);       /** Call the remote object and get a response. */           fail("Introspect return value incorrect");       if (0 != col.compare("Not XML", intro2))       System.out.println(intro2);       String intro2 = tri2.Introspect();       System.out.print("Calling the other introspect method: ");       TestRemoteInterface2 tri2 = clientconn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface2.class);       /** This gets a remote object matching our bus name and exported object path. */       System.out.println("Calling Method7--9");       System.out.println("Got path "+prv); 		Path prv = (Path) prop.Get("foo.bar", "foo");       Properties prop = clientconn.getRemoteObject("foo.bar.Test", "/Test", Properties.class);       System.out.println("Testing Properties returning Paths");        System.out.println("Fallback Introspection Data: \n"+intro.Introspect());       System.out.println("Got Fallback Name: "+tri.getName());       intro = clientconn.getRemoteObject("foo.bar.Test", "/FallbackTest/0/4", Introspectable.class);       tri = clientconn.getRemoteObject("foo.bar.Test", "/FallbackTest/0/1", TestRemoteInterface.class);       System.out.println("Calling Method6");        }          System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage());       } catch (UnknownObject UO) {          test.fail("Method Execution should have failed");          System.out.println("Got Remote Name: "+tri.getName());          tri = clientconn.getRemoteObject("foo.bar.Test", "/BadTest2", TestRemoteInterface.class);          System.out.println("Calling Method5");       try {       /** Try and call an implicitly unexported object */         }          System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage());       } catch (UnknownObject UO) {          test.fail("Method Execution should have failed");          System.out.println("Got Remote Name: "+tri.getName());          tri = clientconn.getRemoteObject("foo.bar.Test", "/BadTest", TestRemoteInterface.class);          System.out.println("Calling Method4"); ad  |                q      n      e            v  f  V  F          T  -    
  
  ~
  w
  U
  T
  
   
  	  	  	  	  ^	  W	            (      4            g  L  4              s  =              B            ?  >          l          x        if (null != DBEe) throw DBEe;       DBusExecutionException DBEe = serverconn.getError();       System.out.println("Checking for outstanding errors");  		if (!peers.contains("org.freedesktop.DBus")) fail ("peers contains the wrong name"); 		if (peers.size() != 1) fail("peers hasn't been trimmed"); 		// check that bus name set has been trimmed        Thread.sleep(1000);       /** Pause while we wait for the DBus messages to go back and forth. */        serverconn.sendSignal(new TestSignalInterface.TestObjectSignal("/foo/bar/Wibble", tclass));       /* send an object in a signal */        System.out.println("done");       System.out.print(tni.getName()+" ");       TestNewInterface tni = tri2.getNew();       System.out.print("Testing dynamic object creation...");        System.out.println("done");          test.fail("Failed to check nested lists");           reti.get(0).get(0) != 1)           reti.get(0).size() != 1 ||       if (reti.size() != 1 ||       List<List<Integer>> reti = tri2.checklist(lli);       lli.add(li);       li.add(1);       li = new Vector<Integer>();       lli = new Vector<List<Integer>>();       System.out.print("Testing nested lists...");  		System.out.println("done"); 		tri.reg13291(as, as); 			as[i] = (byte) (100-i); 		for (int i = 0; i < 10; i++) 		byte[] as = new byte[10]; 		System.out.print("reg13291...");        System.out.println("done");       if (4 != tri.overload()) test.fail("wrong overloaded method called");       if (3 != tri2.overload()) test.fail("wrong overloaded method called");       if (2 != tri2.overload((byte) 0)) test.fail("wrong overloaded method called");       if (1 != tri2.overload("foo")) test.fail("wrong overloaded method called");       tri = clientconn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class);       System.out.print("testing method overloading...");        System.out.println("done");              if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!",tri2.recursionTest())) fail("recursion test failed");              System.out.print("testing recursion...");              System.out.println("done");       tri2.complexv(new Variant(m, "a{ss}"));       m.put("cow", "moo");       Map m = new HashMap();       System.out.print("testing complex variants...");        System.out.println("done");                 fail("Didn't get back the same TestSerializable");           s.getVector().get(2) != 3)           s.getVector().get(1) != 2 ||           s.getVector().get(0) != 1 ||           s.getVector().size() != 3 ||           ! s.getString().equals("woo") ||       if (s.getInt() != 1 ||        System.out.print("returned: "+s);       s = tri2.testSerializable((byte) 12, s, 13);       TestSerializable<String> s = new TestSerializable<String>(1, "woo", v);       v.add(3);       v.add(2);       v.add(1);       Vector<Integer> v = new Vector<Integer>();       System.out.print("testing custom serialization...");        System.out.println("done");              serverconn.sendSignal(new TestSignalInterface.TestArraySignal("/Test", tsl, tsm));       tsm.put(new UInt32(42), new TestStruct2(l, new Variant<UInt64>(new UInt64(789))));       tsm.put(new UInt32(1), new TestStruct2(l, new Variant<UInt64>(new UInt64(678))));       Map<UInt32, TestStruct2> tsm = new HashMap<UInt32, TestStruct2>();       tsl.add(n      List<TestS truct2> tsl = new Vector<TestStruct2>();       List<TestStruct2> tsl = new Vector<TestStruct2>();       /** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */       System.out.print("Sending Array Signal...");                 fail("dostuff return value incorrect");       if (true != b.booleanValue()) ad  H        h           l  g  9  4          h  T  @  !        {  M              X  9                    k  f  V  Q  8  3  
  
  
  2
  
  
   
  	  	  	  	  	  z	  u	  J	  >	  	              g  A      {  !        k  6  1        X  #          w  -  *            L        E  &                                                                               {    public Map<String, Variant> svm() @SuppressWarnings("unchecked") public Map<Path,Path> pathmaprv(Map<Path,Path> a) { return a; } public List<Path> pathlistrv(List<Path> a) { return a; } public Path pathrv(Path a) { return a; } public Map<String, Variant> GetAll (String interface_name) { return new HashMap<String,Variant>(); } public <A> void Set (String interface_name, String property_name, A value)  {} }    return (A) new Path("/nonexistant/path"); { public <A> A Get (String interface_name, String property_name) @SuppressWarnings("unchecked") 	} 			if (as[i] != bs[i]) test.fail("didn't receive identical byte arrays"); 		for (int i = 0; i < as.length;  i++) 		if (as.length != bs.length) test.fail("didn't receive identical byte arrays"); 	{ 	public void reg13291(byte[] as, byte[] bs)    }          test.fail("Didn't send variant correctly");          || !"moo".equals(((Map<Object,Object>) v.getValue()).get("cow")))          || ((Map<Object,Object>) v.getValue()).size() != 1          || ! (v.getValue() instanceof Map)       if (!"a{ss}".equals(v.getSig())    {    public void complexv(Variant<? extends Object> v)    @SuppressWarnings("unchecked")    }          test.fail("Didn't send types correctly");          || ! Integer.class.equals(((ParameterizedType) s[1]).getActualTypeArguments()[1]))          || ! String.class.equals(((ParameterizedType) s[1]).getActualTypeArguments()[0])          || ((ParameterizedType) s[1]).getActualTypeArguments().length != 2          || ! Map.class.equals(((ParameterizedType) s[1]).getRawType())          || ! (s[1] instanceof ParameterizedType)          || !s[0].equals(Byte.class)        if (s.length != 2    {    public void sig(Type[] s)    }       return n;       { throw new DBusExecutionException(DBe.getMessage()); }       } catch (DBusException DBe)           conn.exportObject("/new", n);       try {       testnewclass n = new testnewclass();    {    public TestNewInterface getNew()    }       return lli;    {    public List<List<Integer>> checklist(List<List<Integer>> lli)    }          return -1;       else          return 4;       else if ("org.freedesktop.dbus.test.TestRemoteInterface".equals(info.getInterface()))          return 3;       if ("org.freedesktop.dbus.test.AlternateTestInterface".equals(info.getInterface()))       DBusCallInfo info = DBusConnection.getCallInfo();    {    public int overload()    }       return 2;    {    public int overload(byte b)    }       return 1;    {    public int overload(String s)    }       }          return "";          test.fail("Failed with error: "+DBe);       } catch (DBusException DBe) {          return tri.getName();          TestRemoteInterface tri = conn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class);       try {    {    public String recursionTest()    }       return s;          test.fail("Error in recieving custom synchronisation");          || !(s.getVector().get(2) == 3)    )          || !(s.getVector().get(1) == 2)          || !(s.getVector().get(0) == 1)          || !(s.getVector().size() == 3)          || !(s.getString().equals("woo"))          || !(s.getInt() == 1)          || i != 13       if (  b != 12       System.out.println("Recieving TestSerializable: "+s);    {    public TestSerializable<String> testSerializable(byte b, TestSerializable<String> s, int i)    }       throw new TestException("test");    {    public void throwme() throws TestException    }       return this;          test.fail("Didn't get this properly");       if (!t.equals(this))    {    public DBusInterface getThis(DBusInterface t) ad  (   (     {     X  W          e  `  ^  ]  Y  .  *        o  j  I  -          [                  Y  W  ;    
  
  
  
  n
  f
  1
  .
  ,
  (
  
  
  	  	  	  	  9	  6	  "	  	  	            ;  2        k  f  b  ]  [  Z  Y  U  =  9            S  N  L  K  G  /  +            a  E  6        s  +                r  p  T              k  `  (  '                                               System.out.println("SignalHandler 2 Running");          }             test.fail("SignalHandler 2 has been run too many times");          } else {             test.done2 = true;          if (false == test.done2) {       try {    {    public void handle(TestSignalInterface.TestArraySignal t)    /** Handling a signal */ { class arraysignalhandler implements DBusSigHandler<TestSignalInterface.TestArraySignal>  */  * Untyped signal handler /**  }    }          test.fail("Incorrect TestSignal parameters");       if (!"Bar".equals(t.value) || !(new UInt32(42)).equals(t.number))       System.out.println("string("+t.value+") int("+t.number+")");       System.out.println("SignalHandler 1 Running");       }          test.fail("SignalHandler 1 has been run too many times");       } else {          test.done1 = true;       if (false == test.done1) {    {    public void handle(TestSignalInterface.TestSignal t)    /** Handling a signal */ { class signalhandler implements DBusSigHandler<TestSignalInterface.TestSignal>  */  * Typed signal handler /**  }    }       System.out.println("Path sighandler: "+t);    {    public void handle(TestSignalInterface.TestPathSignal t)    /** Handling a signal */ { class pathsignalhandler implements DBusSigHandler<TestSignalInterface.TestPathSignal>  */  * Typed signal handler /**   }    } 		} 			} 				test.fail("Disconnect handler threw an exception: "+DBe); 				DBe.printStackTrace(); 			} catch (DBusException DBe) { 				conn.removeSigHandler(TestSignalInterface2.TestRenamedSignal.class, sh); 			try { 			System.out.println("Handling disconnect, unregistering handler");          test.done6 = true;       if (false == test.done6) {    {    public void handle(DBus.Local.Disconnected t)    /** Handling a signal */ 	} 		this.sh = sh; 		this.conn = conn; 	{ 	public disconnecthandler(DBusConnection conn, renamedsignalhandler sh) 	private renamedsignalhandler sh; 	private DBusConnection conn; { class disconnecthandler implements DBusSigHandler<DBus.Local.Disconnected>  */  * Disconnect handler /** } 	}       System.out.println("SignalHandler E Running");       }          test.fail("SignalHandler E has been run too many times");       } else {          test.done7 = true;       if (false == test.done7) {    {    public void handle(TestSignalInterface.EmptySignal t)    /** Handling a signal */ { class emptysignalhandler implements DBusSigHandler<TestSignalInterface.EmptySignal>  */  * Empty signal handler /**  }    }          test.fail("Incorrect TestRenamedSignal parameters");       if (!"Bar".equals(t.value) || !(new UInt32(42)).equals(t.number))       System.out.println("string("+t.value+") int("+t.number+")");       System.out.println("SignalHandler R Running");       }          test.fail("SignalHandler R has been run too many times");       } else {          test.done5 = true;       if (false == test.done5) {    {    public void handle(TestSignalInterface2.TestRenamedSignal t)    /** Handling a signal */ { class renamedsignalhandler implements DBusSigHandler<TestSignalInterface2.TestRenamedSignal>  */  * Typed signal handler for renamed signal /**  }    }       return (Map<String, Variant>) properties;       properties.put("Parameters", new Variant(parameters, "a{sv}"));        parameters.put("Password", new Variant<String>("abcdef"));       parameters.put("Name", new Variant<String>("Joe"));        HashMap<String, Variant<String>> parameters = new HashMap<String, Variant<String>>();       HashMap<String, Variant> properties = new HashMap<String, Variant>(); ad          c     @          F        g  2              i  %  
  
  
  p
  R
  
  
  
  
  
   
  	  	  	  	  D	  ?	  	  	          |  z  y  u  M  I              {  y  x  t  `  \  #  !          c  :      |  c  ^  )  $    {  N          @  -  (  &  %  !          u  M  %                      public static boolean done6 = false;    public static boolean done5 = false;    public static boolean done4 = false;    public static boolean done3 = false;    public static boolean done2 = false;    public static boolean done1 = false; { public class test  */  * This is a test program which sends and recieves a signal, implements, exports and calls a remote method. /**  }    } 		test.done8=true;       if (test.done8) test.fail("Already ran callback error handler"); 			test.fail("Exception has the wrong message");       if (0 != col.compare("test", e.getMessage()))       col.setStrength(Collator.PRIMARY);       col.setDecomposition(Collator.FULL_DECOMPOSITION);       Collator col = Collator.getInstance(); 		if (!(e instanceof TestException)) test.fail("Exception is of the wrong sort"); 		System.out.println("Handling error callback: "+e+" message = '"+e.getMessage()+"'");    {    public void handleError(DBusExecutionException e)    }       test.done4 = true;       if (test.done4) test.fail("Already ran callback handler");          test.fail("call with callback, wrong return value");       if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!", r))       col.setStrength(Collator.PRIMARY);       col.setDecomposition(Collator.FULL_DECOMPOSITION);       Collator col = Collator.getInstance();       System.out.println("Handling callback: "+r);    {    public void handle(String r) { class callbackhandler implements CallbackHandler<String>  */  * Callback handler /**  }    }       test.fail("This signal handler shouldn't be called");    {    public void handle(T s)    /** Handling a signal */ { class badarraysignalhandler<T extends DBusSignal> implements DBusSigHandler<T>  */  * handler which should never be called /**  }    }       System.out.println(s.otherpath);       }          test.fail("SignalHandler 3 has been run too many times");       } else {          test.done3 = true;       if (false == test.done3) {    {    public void handle(TestSignalInterface.TestObjectSignal s) { class objectsignalhandler implements DBusSigHandler<TestSignalInterface.TestObjectSignal>  */  * Object path signal handler /**  }    }       }          test.fail("SignalHandler 2 threw an exception: "+e);          e.printStackTrace();       } catch (Exception e) { 			             test.fail("Incorrect TestArraySignal parameters");                789L != ((UInt64) t.m.get(new UInt32(42)).b.getValue()).longValue()) 				   !(t.m.get(new UInt32(42)).b.getValue() instanceof UInt64) ||                678L != ((UInt64) t.m.get(new UInt32(1)).b.getValue()).longValue() ||          if (!(t.m.get(new UInt32(1)).b.getValue() instanceof UInt64) || 			if (t.m.keySet().size() != 2) test.fail("Incorrect TestArraySignal map size: should be 2, actually "+t.m.keySet().size()); 			             test.fail("Incorrect TestArraySignal parameters");                !"aloha".equals(t.v.get(0).a.get(4)))                !"hey".equals(t.v.get(0).a.get(3)) ||                !"hej".equals(t.v.get(0).a.get(2)) ||                !"hello".equals(t.v.get(0).a.get(1)) ||                !"hi".equals(t.v.get(0).a.get(0)) ||                t.v.get(0).a.size() != 5 ||                567L != ((UInt64) t.v.get(0).b.getValue()).longValue() ||          if (!(t.v.get(0).b.getValue() instanceof UInt64) ||          System.out.println(t.v.get(0).b.getValue());          System.out.println(t.v.get(0).b.getType());             System.out.println("--"+str);          for (String str: t.v.get(0).a)          System.out.println("Got a test array signal with Parameters: ");          if (t.v.size() != 1) test.fail("Incorrect TestArraySignal array length: should be 1, actually "+t.v.size()); ad  >   v     I           M            e  9          g            d  ]      H  G    
  
  
  5
  	  	  ,	          @    n          k  *  "        z  -        ^  ]  9              l  Y  9  2    v  u                                                                  /** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */       System.out.println("Sending Signal");              System.runFinalization();       System.gc();       System.runFinalization();       System.gc();       System.runFinalization();       System.gc();       tclass2 = null;       // implicitly unexport object       serverconn.unExportObject("/BadTest");       // explicitly unexport object        serverconn.addFallback("/FallbackTest", tclass);       serverconn.exportObject("/BadTest2", tclass2);       serverconn.exportObject("/BadTest", tclass);       serverconn.exportObject("/Test", tclass);       /** This exports an instance of the test class as the object /Test. */       testclass tclass2 = new testclass(serverconn);       testclass tclass = new testclass(serverconn);       System.out.println("Listening for Method Calls");              }          test.fail("Failed to add handlers: "+DBe.getMessage());       } catch (DBusException DBe) {          test.fail("Failed to add handlers: "+MRI.getMessage());       } catch (MatchRuleInvalid MRI) {          System.out.println("done");          clientconn.removeSigHandler(TestSignalInterface.TestSignal.class, bash);          clientconn.addSigHandler(TestSignalInterface.TestSignal.class, bash);          badarraysignalhandler<TestSignalInterface.TestSignal> bash = new badarraysignalhandler<TestSignalInterface.TestSignal>();          clientconn.addSigHandler(TestSignalInterface.TestPathSignal.class, new pathsignalhandler());          clientconn.addSigHandler(TestSignalInterface.TestObjectSignal.class, new objectsignalhandler());          clientconn.addSigHandler(TestSignalInterface.TestArraySignal.class, source, peer, new arraysignalhandler());          String source = dbus.GetNameOwner("foo.bar.Test");          clientconn.addSigHandler(DBus.Local.Disconnected.class, new disconnecthandler(clientconn, rsh));          clientconn.addSigHandler(TestSignalInterface2.TestRenamedSignal.class, rsh);          clientconn.addSigHandler(TestSignalInterface.TestSignal.class, sigh);          clientconn.addSigHandler(TestSignalInterface.EmptySignal.class, new emptysignalhandler());          /** This registers an instance of the test class as the signal handler for the TestSignal class. */       try { 		renamedsignalhandler rsh = new renamedsignalhandler(); 		signalhandler sigh = new signalhandler();       System.out.print("Listening for signals...");        DBus dbus = clientconn.getRemoteObject("org.freedesktop.DBus", "/org/freedesktop/DBus", DBus.class);       Peer peer = clientconn.getRemoteObject("foo.bar.Test", "/Test", Peer.class);       /** This gets a remote object matching our bus name and exported object path. */              serverconn.requestBusName("foo.bar.Test");       System.out.println("Registering Name");              clientconn.setWeakReferences(true);       serverconn.setWeakReferences(true);       clientconn = DBusConnection.getConnection(DBusConnection.SESSION);       serverconn = DBusConnection.getConnection(DBusConnection.SESSION);       System.out.println("Creating Connection");    { try {    public static void main(String[] args)     @SuppressWarnings("unchecked")    static DBusConnection clientconn = null;    static DBusConnection serverconn = null;    }       System.exit(1);       if (null != clientconn) clientconn.disconnect();       if (null != serverconn) serverconn.disconnect();       System.err.println("Test Failed: "+message);       System.out.println("Test Failed: "+message);    {    public static void fail(String message)    public static boolean done8 = false;    public static boolean done7 = false; ad          f         A          t  N        x  s  7          X  ?            ^  6  
  
  
  
  l
  G
  "
  	  	  	  j	  S	  .	  	          f  5  $                  }  x  B  ?                e  `  K  &          m  >            u  \  2  	        w  \  .      z  H                              }       return -5;          test.fail("Sub-Map has wrong contents");       if (!(new Short((short)7).equals(mus.get(new UInt16(6)))))          test.fail("Sub-Map has wrong contents");       if (!(new Short((short)6).equals(mus.get(new UInt16(5)))))          test.fail("Sub-Map has wrong contents");       if (!(new Short((short)5).equals(mus.get(new UInt16(4)))))          test.fail("Sub-Map was wrong size");       if (mus.size() != 3)          test.fail("Sub-Map was null");       if (null == mus)       Map<UInt16,Short> mus = m.get("stuff");          test.fail("Incorrect key");       if (!m.keySet().contains("stuff"))          test.fail("Map was wrong size");       if (m.size() != 1)          test.fail("Map was null");       if (null == m)          test.fail("v is incorrect");       if (((Integer) v) != 13)          test.fail("v not an Integer");       if (!(v instanceof Integer))          test.fail("List has wrong contents");           n.get(2) != 71L)           n.get(1) != 5L ||       if (n.get(0) != 2L ||          test.fail("List was wrong size (expected 3, actual "+n.size()+")");       if (n.size() != 3)          test.fail("List was null");       if (null == n)    {    public <T> int frobnicate(List<Long> n, Map<String,Map<UInt16,Short>> m, T v)    }       return false;       System.out.println("Being checked");    {    public boolean check() 	} 		throw new TestException("test"); 	{ 	public String getNameAndThrow() throws TestException    }       return "This Is A UTF-8 Name: س !!";    {    public String getName()    }       return v;       v.add(-18);       v.add(-12);       v.add(-7);       v.add(-5);       v.add(-1);       Vector<Integer> v = new Vector<Integer>();          test.fail("sampleArray, Integer array contents incorrect");             ls[3] != 12)             ls[2] != 8 ||             ls[1] != 6 ||             ls[0] != 2 ||       if (ls.length != 4 ||          System.out.println("--"+l);       for (long l: ls)       System.out.println("Got an array:");          test.fail("sampleArray, Integer array contents incorrect");             is[3].intValue() != 9)             is[2].intValue() != 7 ||             is[1].intValue() != 5 ||             is[0].intValue() != 1 ||       if (is.length != 4 ||          System.out.println("--"+i);       for (Integer i: is)       System.out.println("Got an array:");          test.fail("sampleArray, String array contents incorrect");             !"aloha".equals(ss.get(4)))             !"hey".equals(ss.get(3)) ||             !"hej".equals(ss.get(2)) ||             !"hello".equals(ss.get(1)) ||             !"hi".equals(ss.get(0)) ||       if (ss.size()!= 5 ||          System.out.println("--"+s);       for (String s: ss)       System.out.println("Got an array:");    {    public List<Integer> sampleArray(List<String> ss, Integer[] is, long[] ls)    /** The method we are exporting to the Bus. */    public boolean isRemote() { return false; }    /** Local classes MUST implement this to return false */    }       return (T) foo.c.getValue();          test.fail("dostuff received the wrong arguments");             ((Boolean) foo.c.getValue()).booleanValue() != true)             !(foo.c.getValue() instanceof Boolean) ||             foo.b.intValue() != 52 ||             !"bar".equals(foo.a) ||             !(foo.c instanceof Variant) ||             !(foo.b instanceof UInt32) ||             !(foo.a instanceof String) ||       if (!(foo instanceof TestStruct) ||       System.out.println(" -- ("+foo.a.getClass()+", "+foo.b.getClass()+", "+foo.c.getClass()+")");       System.out.println("Doing Stuff "+foo);    {    public <T> T dostuff(TestStruct foo) ad     X     N     @        i  J  "        $         o  0        Y  ,  
  
  
  
  y
  I
  )
  	  	  	  	  	  _	  I	  	          A      e  A          L  !           W  *        j  1        C          ~  "  !        X  W                col.setDecomposition(Collator.FULL_DECOMPOSITION);       Collator col = Collator.getInstance();        serverconn.sendSignal(new TestSignalInterface.TestPathSignal("/Test", path, paths, pathm));        if (!pm.containsKey(path) || !path.equals(pm.get(path))) fail("pathmaprv incorrect");       }          System.out.println(pm.get(q));          System.out.println(q);       for (Path q: pm.keySet()) {       System.out.println(pm.containsKey(p)+" "+pm.get(p)+" "+p.equals(pm.get(p)));       System.out.println(pm.containsKey(path)+" "+pm.get(path)+" "+path.equals(pm.get(path)));       System.out.println(pathm.toString()+" => "+pm.toString());       Map<Path, Path> pm = tri.pathmaprv(pathm);       pathm.put(path, path);       Map<Path, Path> pathm = new HashMap<Path, Path>();       if (!paths.equals(ps)) fail("pathlistrv incorrect");       System.out.println(paths.toString()+" => "+ps.toString());       List<Path> ps = tri.pathlistrv(paths);       paths.add(path);       List<Path> paths = new Vector<Path>();       if (!path.equals(p)) fail("pathrv incorrect");       System.out.println(path.toString()+" => "+p.toString());       Path p = tri.pathrv(path);       Path path = new Path("/nonexistantwooooooo");           fail("incorrect reply from svm");       if (!"{ Parameters => [{ Name => [Joe],Password => [abcdef] }] }".equals(svmmap.toString()))       System.out.println(svmmap.toString());       Map<String, Variant> svmmap = tri.svm();        System.out.println("Got Remote Name: "+rname);       String rname = tri.getName();       /** Call the remote object and get a response. */       System.out.println("Got Remote Object: "+tri);       TestRemoteInterface tri = (TestRemoteInterface) clientconn.getPeerRemoteObject("foo.bar.Test", "/Test");       /** This gets a remote object matching our bus name and exported object path. */       System.out.println("Calling Method0/1");              }          System.out.println("Ping returned in "+(now-then)+"ms.");          long now = System.currentTimeMillis();          peer.Ping();          long then = System.currentTimeMillis();       for (int i = 0; i < 10; i++) {       /** Call ping. */ 		System.out.println("Pinging ourselves");  		clientconn.releaseBusName("test.testclient"); 		peers.add("test.testclient"); 		clientconn.requestBusName("test.testclient"); 		peers.add("org.freedesktop.DBus"); 		Set<String> peers = serverconn.new PeerSet();  		// setup bus name set               System.out.println("Got Introspection Data: \n"+data);          fail("Introspection data invalid");       if (null == data || !data.startsWith("<!DOCTYPE"))       data = intro.Introspect();       /** Get introspection data */       intro = clientconn.getRemoteObject("foo.bar.Test", "/Test", Introspectable.class);       System.out.println("Got Introspection Data: \n"+data);*/          fail("Introspection data invalid");       if (null == data || !data.startsWith("<!DOCTYPE"))       String data;/* = intro.Introspect();       /** Get introspection data */       Introspectable intro = clientconn.getRemoteObject("foo.bar.Test", "/", Introspectable.class);       /** This gets a remote object matching our bus name and exported object path. */       System.out.println("Getting our introspection data");                 System.out.println("\t"+name);       for (String name: names)       String[] names = dbus.ListNames();       System.out.println("These things are on the bus:");        serverconn.sendSignal(new TestSignalInterface2.TestRenamedSignal("/foo/bar/Wibble", "Bar", new UInt32(42)));       serverconn.sendSignal(new TestSignalInterface.EmptySignal("/foo/bar/Wibble"));       serverconn.sendSignal(new TestSignalInterface.TestSignal("/foo/bar/Wibble", "Bar", new UInt32(42))); ad  p       S     n      d  ]  ;  :            P            ^  7            u  X  =    
  
  
  
  ?
  8
  
  
  	  	  .	      @                n  m  :            w  R  /          n  C  !           I  /  .       m  l  /                                                                                                                                                                                                                                                                                                                                                                                            if (null != DBEe) throw DBEe;       DBusExecutionException DBEe = serverconn.getError();       System.out.println("Checking for outstanding errors");  		if (!peers.contains("org.freedesktop.DBus")) fail ("peers contains the wrong name"); 		if (peers.size() != 1) fail("peers hasn't been trimmed"); 		// check that bus name set has been trimmed        Thread.sleep(1000);       /** Pause while we wait for the DBus messages to go back and forth. */        serverconn.sendSignal(new TestSignalInterface.TestObjectSignal("/foo/bar/Wibble", tclass));       /* send an object in a signal */        System.out.println("done");       System.out.print(tni.getName()+" ");       TestNewInterface tni = tri2.getNew();       System.out.print("Testing dynamic object creation...");        System.out.println("done");          test.fail("Failed to check nested lists");           reti.get(0).get(0) != 1)           reti.get(0).size() != 1 ||       if (reti.size() != 1 ||       List<List<Integer>> reti = tri2.checklist(lli);       lli.add(li);       li.add(1);       li = new Vector<Integer>();       lli = new Vector<List<Integer>>();       System.out.print("Testing nested lists...");  		System.out.println("done"); 		tri.reg13291(as, as); 			as[i] = (byte) (100-i); 		for (int i = 0; i < 10; i++) 		byte[] as = new byte[10]; 		System.out.print("reg13291...");        System.out.println("done");       if (4 != tri.overload()) test.fail("wrong overloaded method called");       if (3 != tri2.overload()) test.fail("wrong overloaded method called");       if (2 != tri2.overload((byte) 0)) test.fail("wrong overloaded method called");       if (1 != tri2.overload("foo")) test.fail("wrong overloaded method called");       tri = clientconn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class);       System.out.print("testing method overloading...");        System.out.println("done");              if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!",tri2.recursionTest())) fail("recursion test failed");              System.out.print("testing recursion...");              System.out.println("done");       tri2.complexv(new Variant(m, "a{ss}"));       m.put("cow", "moo");       Map m = new HashMap();       System.out.print("testing complex variants...");        System.out.println("done");                 fail("Didn't get back the same TestSerializable");           s.getVector().get(2) != 3)           s.getVector().get(1) != 2 ||           s.getVector().get(0) != 1 ||           s.getVector().size() != 3 ||           ! s.getString().equals("woo") ||       if (s.getInt() != 1 ||        System.out.print("returned: "+s);       s = tri2.testSerializable((byte) 12, s, 13);       TestSerializable<String> s = new TestSerializable<String>(1, "woo", v);       v.add(3);       v.add(2);       v.add(1);       Vector<Integer> v = new Vector<Integer>();       System.out.print("testing custom serialization...");        System.out.println("done");              serverconn.sendSignal(new TestSignalInterface.TestArraySignal("/Test", tsl, tsm));       tsm.put(new UInt32(42), new TestStruct2(l, new Variant<UInt64>(new UInt64(789))));       tsm.put(new UInt32(1), new TestStruct2(l, new Variant<UInt64>(new UInt64(678))));       Map<UInt32, TestStruct2> tsm = new HashMap<UInt32, TestStruct2>();       tsl.add(new TestStruct2(l, new Variant<UInt64>(new UInt64(567)))); 