From 43da57ca0e196b32a06b139af8c45d1fb0c11efd Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Sun, 3 Feb 2008 11:26:13 +0000 Subject: add profile --- org/freedesktop/dbus/AbstractConnection.java | 1 + org/freedesktop/dbus/test/Profiler.java | 1 + org/freedesktop/dbus/test/ProfilerInstance.java | 1 + org/freedesktop/dbus/test/profile.java | 468 +++++++++++++----------- org/freedesktop/dbus/test/test.java | 19 +- 5 files changed, 266 insertions(+), 224 deletions(-) (limited to 'org') diff --git a/org/freedesktop/dbus/AbstractConnection.java b/org/freedesktop/dbus/AbstractConnection.java index 9ea2359..de66534 100644 --- a/org/freedesktop/dbus/AbstractConnection.java +++ b/org/freedesktop/dbus/AbstractConnection.java @@ -696,6 +696,7 @@ public abstract class AbstractConnection eo = exportedObjects.get(m.getPath()); } if (null != eo && null == eo.object.get()) { + if (Debug.debug) Debug.print(Debug.INFO, "Unexporting "+m.getPath()+" implicitly"); unExportObject(m.getPath()); eo = null; } diff --git a/org/freedesktop/dbus/test/Profiler.java b/org/freedesktop/dbus/test/Profiler.java index 155811c..8263f07 100644 --- a/org/freedesktop/dbus/test/Profiler.java +++ b/org/freedesktop/dbus/test/Profiler.java @@ -26,6 +26,7 @@ public interface Profiler extends DBusInterface } } public void array(int[] v); + public void stringarray(String[] v); public void map(Map m); public void list(List l); public void bytes(byte[] b); diff --git a/org/freedesktop/dbus/test/ProfilerInstance.java b/org/freedesktop/dbus/test/ProfilerInstance.java index 790f73a..775bf0e 100644 --- a/org/freedesktop/dbus/test/ProfilerInstance.java +++ b/org/freedesktop/dbus/test/ProfilerInstance.java @@ -17,6 +17,7 @@ public class ProfilerInstance implements Profiler { public boolean isRemote() { return false; } public void array(int[] v) { return; } + public void stringarray(String[] v) { return; } public void map(Map m) { return; } public void list(List l) { return; } public void bytes(byte[] b) { return; } diff --git a/org/freedesktop/dbus/test/profile.java b/org/freedesktop/dbus/test/profile.java index 56af3f8..40de278 100644 --- a/org/freedesktop/dbus/test/profile.java +++ b/org/freedesktop/dbus/test/profile.java @@ -54,6 +54,9 @@ public class profile public static final int ARRAY_OUTER = 100; public static final int ARRAY_INNER = 10; public static final int ARRAY_LENGTH = 1000; + public static final int STRING_ARRAY_OUTER = 10; + public static final int STRING_ARRAY_INNER = 1; + public static final int STRING_ARRAY_LENGTH = 20000; public static class Log { @@ -104,237 +107,266 @@ public class profile return Math.sqrt(sum / (current-1)); } } - public static void main(String[] args) throws DBusException + public static void main(String[] args) { - if (0==args.length) { - System.out.println("You must specify a profile type."); - System.out.println("Syntax: profile "); - System.exit(1); - } - DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); - conn.requestBusName("org.freedesktop.DBus.java.profiler"); - if ("pings".equals(args[0])) { - int count = PING_INNER*PING_OUTER; - System.out.print("Sending "+count+" pings..."); - Peer p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class); - Log l = new Log(count); - long t = System.currentTimeMillis(); - for (int i = 0; i < PING_OUTER; i++) { - for (int j = 0; j < PING_INNER; j++) { - l.start(); - p.Ping(); - l.stop(); - } - System.out.print("."); + try { + if (0==args.length) { + System.out.println("You must specify a profile type."); + System.out.println("Syntax: profile "); + System.exit(1); } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - } else if ("arrays".equals(args[0])) { - int count = ARRAY_INNER*ARRAY_OUTER; - System.out.print("Sending array of "+ARRAY_LENGTH+" ints "+count+" times."); - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); - int[] v = new int[ARRAY_LENGTH]; - Random r = new Random(); - for (int i = 0; i < ARRAY_LENGTH; i++) v[i] = r.nextInt(); - Log l = new Log(count); - long t = System.currentTimeMillis(); - for (int i = 0; i < ARRAY_OUTER; i++) { - for (int j = 0; j < ARRAY_INNER; j++) { - l.start(); - p.array(v); - l.stop(); + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + conn.requestBusName("org.freedesktop.DBus.java.profiler"); + if ("pings".equals(args[0])) { + int count = PING_INNER*PING_OUTER; + System.out.print("Sending "+count+" pings..."); + Peer p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < PING_OUTER; i++) { + for (int j = 0; j < PING_INNER; j++) { + l.start(); + p.Ping(); + l.stop(); + } + System.out.print("."); } - System.out.print("."); - } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - } else if ("maps".equals(args[0])) { - int count = MAP_INNER*MAP_OUTER; - System.out.print("Sending map of "+MAP_LENGTH+" string=>strings "+count+" times."); - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); - HashMap m = new HashMap(); - for (int i = 0; i < MAP_LENGTH; i++) - m.put(""+i, "hello"); - Log l = new Log(count); - long t = System.currentTimeMillis(); - for (int i = 0; i < MAP_OUTER; i++) { - for (int j=0; j < MAP_INNER; j++) { - l.start(); - p.map(m); - l.stop(); + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("strings".equals(args[0])) { + int count = STRING_ARRAY_INNER*STRING_ARRAY_OUTER; + System.out.print("Sending array of "+STRING_ARRAY_LENGTH+" strings "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + String[] v = new String[STRING_ARRAY_LENGTH]; + Random r = new Random(); + for (int i = 0; i < STRING_ARRAY_LENGTH; i++) v[i] = ""+r.nextInt(); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < STRING_ARRAY_OUTER; i++) { + for (int j = 0; j < STRING_ARRAY_INNER; j++) { + l.start(); + p.stringarray(v); + l.stop(); + } + System.out.print("."); } - System.out.print("."); - } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - } else if ("lists".equals(args[0])) { - int count = LIST_OUTER*LIST_INNER; - System.out.print("Sending list of "+LIST_LENGTH+" strings "+count+" times."); - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); - Vector v = new Vector(); - for (int i = 0; i < LIST_LENGTH; i++) - v.add("hello "+i); - Log l = new Log(count); - long t = System.currentTimeMillis(); - for (int i = 0; i < LIST_OUTER; i++) { - for (int j=0; j < LIST_INNER; j++) { - l.start(); - p.list(v); - l.stop(); + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("arrays".equals(args[0])) { + int count = ARRAY_INNER*ARRAY_OUTER; + System.out.print("Sending array of "+ARRAY_LENGTH+" ints "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + int[] v = new int[ARRAY_LENGTH]; + Random r = new Random(); + for (int i = 0; i < ARRAY_LENGTH; i++) v[i] = r.nextInt(); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < ARRAY_OUTER; i++) { + for (int j = 0; j < ARRAY_INNER; j++) { + l.start(); + p.array(v); + l.stop(); + } + System.out.print("."); } - System.out.print("."); - } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - } else if ("structs".equals(args[0])) { - int count = STRUCT_OUTER*STRUCT_INNER; - System.out.print("Sending a struct "+count+" times."); - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); - ProfileStruct ps = new ProfileStruct("hello", new UInt32(18), 500L); - Log l = new Log(count); - long t = System.currentTimeMillis(); - for (int i = 0; i < STRUCT_OUTER; i++) { - for (int j=0; j < STRUCT_INNER; j++) { - l.start(); - p.struct(ps); - l.stop(); + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("maps".equals(args[0])) { + int count = MAP_INNER*MAP_OUTER; + System.out.print("Sending map of "+MAP_LENGTH+" string=>strings "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + HashMap m = new HashMap(); + for (int i = 0; i < MAP_LENGTH; i++) + m.put(""+i, "hello"); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < MAP_OUTER; i++) { + for (int j=0; j < MAP_INNER; j++) { + l.start(); + p.map(m); + l.stop(); + } + System.out.print("."); } - System.out.print("."); - } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - } else if ("introspect".equals(args[0])) { - int count = INTROSPECTION_OUTER*INTROSPECTION_INNER; - System.out.print("Recieving introspection data "+count+" times."); - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Introspectable is = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Introspectable.class); - Log l = new Log(count); - long t = System.currentTimeMillis(); - String s = null; - for (int i = 0; i < INTROSPECTION_OUTER; i++) { - for (int j = 0; j < INTROSPECTION_INNER; j++) { - l.start(); - s = is.Introspect(); - l.stop(); + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("lists".equals(args[0])) { + int count = LIST_OUTER*LIST_INNER; + System.out.print("Sending list of "+LIST_LENGTH+" strings "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + Vector v = new Vector(); + for (int i = 0; i < LIST_LENGTH; i++) + v.add("hello "+i); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < LIST_OUTER; i++) { + for (int j=0; j < LIST_INNER; j++) { + l.start(); + p.list(v); + l.stop(); + } + System.out.print("."); } - System.out.print("."); - } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - System.out.println("Introspect data: "+s); - } else if ("bytes".equals(args[0])) { - System.out.print("Sending "+BYTES+" bytes"); - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); - byte[] bs = new byte[BYTES]; - for (int i = 0; i < BYTES; i++) - bs[i] = (byte) i; - long t = System.currentTimeMillis(); - p.bytes(bs); - System.out.println(" done in "+(System.currentTimeMillis()-t)+"ms."); - } else if ("rate".equals(args[0])) { - ProfilerInstance pi = new ProfilerInstance(); - conn.exportObject("/Profiler", pi); - Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); - Peer peer = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class); - long start = System.currentTimeMillis(); - int count = 0; - do { - peer.Ping(); - count++; - } while(count < 10000); - long end = System.currentTimeMillis(); - System.out.println("No payload: "+((count*1000)/(end-start))+" RT/second"); - int len = 256; - while (len <= 32768) { - byte[] bs = new byte[len]; - count = 0; - start = System.currentTimeMillis(); - do { - p.bytes(bs); - count++; - } while(count < 1000); - end = System.currentTimeMillis(); - long ms = end-start; - double cps = (count*1000)/ms; - double rate = (len*cps)/(1024.0*1024.0); - System.out.println(len+" byte array) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s"); - len <<= 1; - } - len = 256; - while (len <= 32768) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < len; i++) sb.append('a'); - String s = sb.toString(); - end = System.currentTimeMillis()+500; - count = 0; + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("structs".equals(args[0])) { + int count = STRUCT_OUTER*STRUCT_INNER; + System.out.print("Sending a struct "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + ProfileStruct ps = new ProfileStruct("hello", new UInt32(18), 500L); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < STRUCT_OUTER; i++) { + for (int j=0; j < STRUCT_INNER; j++) { + l.start(); + p.struct(ps); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("introspect".equals(args[0])) { + int count = INTROSPECTION_OUTER*INTROSPECTION_INNER; + System.out.print("Recieving introspection data "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Introspectable is = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Introspectable.class); + Log l = new Log(count); + long t = System.currentTimeMillis(); + String s = null; + for (int i = 0; i < INTROSPECTION_OUTER; i++) { + for (int j = 0; j < INTROSPECTION_INNER; j++) { + l.start(); + s = is.Introspect(); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + System.out.println("Introspect data: "+s); + } else if ("bytes".equals(args[0])) { + System.out.print("Sending "+BYTES+" bytes"); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + byte[] bs = new byte[BYTES]; + for (int i = 0; i < BYTES; i++) + bs[i] = (byte) i; + long t = System.currentTimeMillis(); + p.bytes(bs); + System.out.println(" done in "+(System.currentTimeMillis()-t)+"ms."); + } else if ("rate".equals(args[0])) { + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + Peer peer = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class); + long start = System.currentTimeMillis(); + int count = 0; do { - p.string(s); + peer.Ping(); count++; - } while(count < 1000); - long ms = end-start; - double cps = (count*1000)/ms; - double rate = (len*cps)/(1024.0*1024.0); - System.out.println(len+" string) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s"); - len <<= 1; - } - } else if ("signals".equals(args[0])) { - int count = SIGNAL_OUTER*SIGNAL_INNER; - System.out.print("Sending "+count+" signals"); - ProfileHandler ph = new ProfileHandler(); - conn.addSigHandler(Profiler.ProfileSignal.class, ph); - Log l = new Log(count); - Profiler.ProfileSignal ps = new Profiler.ProfileSignal("/"); - long t = System.currentTimeMillis(); - for (int i = 0; i < SIGNAL_OUTER; i++) { - for (int j = 0; j < SIGNAL_INNER; j++) { - l.start(); - conn.sendSignal(ps); - l.stop(); + } while(count < 10000); + long end = System.currentTimeMillis(); + System.out.println("No payload: "+((count*1000)/(end-start))+" RT/second"); + int len = 256; + while (len <= 32768) { + byte[] bs = new byte[len]; + count = 0; + start = System.currentTimeMillis(); + do { + p.bytes(bs); + count++; + } while(count < 1000); + end = System.currentTimeMillis(); + long ms = end-start; + double cps = (count*1000)/ms; + double rate = (len*cps)/(1024.0*1024.0); + System.out.println(len+" byte array) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s"); + len <<= 1; + } + len = 256; + while (len <= 32768) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < len; i++) sb.append('a'); + String s = sb.toString(); + end = System.currentTimeMillis()+500; + count = 0; + do { + p.string(s); + count++; + } while(count < 1000); + long ms = end-start; + double cps = (count*1000)/ms; + double rate = (len*cps)/(1024.0*1024.0); + System.out.println(len+" string) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s"); + len <<= 1; + } + } else if ("signals".equals(args[0])) { + int count = SIGNAL_OUTER*SIGNAL_INNER; + System.out.print("Sending "+count+" signals"); + ProfileHandler ph = new ProfileHandler(); + conn.addSigHandler(Profiler.ProfileSignal.class, ph); + Log l = new Log(count); + Profiler.ProfileSignal ps = new Profiler.ProfileSignal("/"); + long t = System.currentTimeMillis(); + for (int i = 0; i < SIGNAL_OUTER; i++) { + for (int j = 0; j < SIGNAL_INNER; j++) { + l.start(); + conn.sendSignal(ps); + l.stop(); + } + System.out.print("."); } - System.out.print("."); + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + while (ph.c < count) try { Thread.sleep(100); } + catch (InterruptedException Ie) {}; + } else { + conn.disconnect(); + System.out.println("Invalid profile ``"+args[0]+"''."); + System.out.println("Syntax: profile "); + System.exit(1); } - t = System.currentTimeMillis()-t; - System.out.println(" done."); - System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); - System.out.println("deviation: "+l.stddev()); - System.out.println("Total time: "+t+"ms"); - while (ph.c < count) try { Thread.sleep(100); } - catch (InterruptedException Ie) {}; - } else { conn.disconnect(); - System.out.println("Invalid profile ``"+args[0]+"''."); - System.out.println("Syntax: profile "); + } catch (Exception e) { + e.printStackTrace(); System.exit(1); } - conn.disconnect(); } } diff --git a/org/freedesktop/dbus/test/test.java b/org/freedesktop/dbus/test/test.java index 6dae9f7..64a062f 100644 --- a/org/freedesktop/dbus/test/test.java +++ b/org/freedesktop/dbus/test/test.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Map; import java.util.Vector; +import java.text.Collator; + import org.freedesktop.dbus.CallbackHandler; import org.freedesktop.dbus.DBusAsyncReply; import org.freedesktop.dbus.DBusCallInfo; @@ -166,7 +168,7 @@ class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignal } public String getName() { - return test.NAMESTRING; + return "This Is A UTF-8 Name: س !!"; } public boolean check() { @@ -385,7 +387,10 @@ class callbackhandler implements CallbackHandler public void handle(String r) { System.out.println("Handling callback: "+r); - if (!test.NAMESTRING.equals(r)) + Collator col = Collator.getInstance(); + col.setDecomposition(Collator.FULL_DECOMPOSITION); + col.setStrength(Collator.PRIMARY); + if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!", r)) test.fail("call with callback, wrong return value"); test.done4 = true; } @@ -396,7 +401,6 @@ class callbackhandler implements CallbackHandler */ public class test { - public static final String NAMESTRING = "This Is A UTF-8 Name: س !!"; public static boolean done1 = false; public static boolean done2 = false; public static boolean done3 = false; @@ -502,7 +506,10 @@ public class test /** Call the remote object and get a response. */ String rname = tri.getName(); System.out.println("Got Remote Name: "+rname); - if (!NAMESTRING.equals(rname)) + Collator col = Collator.getInstance(); + col.setDecomposition(Collator.FULL_DECOMPOSITION); + col.setStrength(Collator.PRIMARY); + if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!", rname)) fail("getName return value incorrect"); System.out.println("sending it to sleep"); tri.waitawhile(); @@ -615,7 +622,7 @@ public class test System.out.print("Calling the other introspect method: "); String intro2 = tri2.Introspect(); System.out.println(intro2); - if (!"Not XML".equals(intro2)) + if (0 != col.compare("Not XML", intro2)) fail("Introspect return value incorrect"); /** Call the remote object and get a response. */ @@ -687,7 +694,7 @@ public class test System.out.print("testing recursion..."); - if (!NAMESTRING.equals(tri2.recursionTest())) fail("recursion test failed"); + if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!",tri2.recursionTest())) fail("recursion test failed"); System.out.println("done"); -- cgit v1.2.3