summaryrefslogtreecommitdiff
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/freedesktop/dbus/ObjectPath.java6
-rw-r--r--org/freedesktop/dbus/Path.java4
-rw-r--r--org/freedesktop/dbus/test/TestRemoteInterface.java4
-rw-r--r--org/freedesktop/dbus/test/TestSignalInterface.java15
-rw-r--r--org/freedesktop/dbus/test/test.java44
-rw-r--r--org/freedesktop/dbus/test/test_p2p_server.java3
6 files changed, 68 insertions, 8 deletions
diff --git a/org/freedesktop/dbus/ObjectPath.java b/org/freedesktop/dbus/ObjectPath.java
index 2cd177e..409d26d 100644
--- a/org/freedesktop/dbus/ObjectPath.java
+++ b/org/freedesktop/dbus/ObjectPath.java
@@ -10,16 +10,14 @@
*/
package org.freedesktop.dbus;
-class ObjectPath
+class ObjectPath extends Path
{
public String source;
- public String path;
// public DBusConnection conn;
public ObjectPath(String source, String path/*, DBusConnection conn*/)
{
+ super(path);
this.source = source;
- this.path = path;
// this.conn = conn;
}
- public String toString() { return path; }
}
diff --git a/org/freedesktop/dbus/Path.java b/org/freedesktop/dbus/Path.java
index 449604d..baaa7a6 100644
--- a/org/freedesktop/dbus/Path.java
+++ b/org/freedesktop/dbus/Path.java
@@ -10,9 +10,9 @@
*/
package org.freedesktop.dbus;
-public final class Path implements Comparable<Path>
+public class Path implements Comparable<Path>
{
- private String path;
+ protected String path;
public Path(String path)
{
this.path = path;
diff --git a/org/freedesktop/dbus/test/TestRemoteInterface.java b/org/freedesktop/dbus/test/TestRemoteInterface.java
index 0379d4e..4417695 100644
--- a/org/freedesktop/dbus/test/TestRemoteInterface.java
+++ b/org/freedesktop/dbus/test/TestRemoteInterface.java
@@ -49,4 +49,8 @@ public interface TestRemoteInterface extends DBusInterface
public int[][] teststructstruct(TestStruct3 in);
@Description("Regression test for #13291")
public void reg13291(byte[] as, byte[] bs);
+ /* test lots of things involving Path */
+ public Path pathrv(Path a);
+ public List<Path> pathlistrv(List<Path> a);
+ public Map<Path,Path> pathmaprv(Map<Path,Path> a);
}
diff --git a/org/freedesktop/dbus/test/TestSignalInterface.java b/org/freedesktop/dbus/test/TestSignalInterface.java
index 18cf3e6..dc3d1be 100644
--- a/org/freedesktop/dbus/test/TestSignalInterface.java
+++ b/org/freedesktop/dbus/test/TestSignalInterface.java
@@ -14,10 +14,12 @@ import org.freedesktop.DBus.Description;
import org.freedesktop.dbus.DBusInterface;
import org.freedesktop.dbus.DBusMemberName;
import org.freedesktop.dbus.DBusSignal;
+import org.freedesktop.dbus.Path;
import org.freedesktop.dbus.UInt32;
import org.freedesktop.dbus.exceptions.DBusException;
import java.util.List;
+import java.util.Map;
/**
* A sample signal with two parameters
@@ -61,4 +63,17 @@ public interface TestSignalInterface extends DBusInterface
this.otherpath = otherpath;
}
}
+ public static class TestPathSignal extends DBusSignal
+ {
+ public final Path otherpath;
+ public final List<Path> pathlist;
+ public final Map<Path,Path> pathmap;
+ public TestPathSignal(String path, Path otherpath, List<Path> pathlist, Map<Path,Path> pathmap) throws DBusException
+ {
+ super(path, otherpath, pathlist, pathmap);
+ this.otherpath = otherpath;
+ this.pathlist = pathlist;
+ this.pathmap = pathmap;
+ }
+ }
}
diff --git a/org/freedesktop/dbus/test/test.java b/org/freedesktop/dbus/test/test.java
index 5333723..ff7210c 100644
--- a/org/freedesktop/dbus/test/test.java
+++ b/org/freedesktop/dbus/test/test.java
@@ -299,6 +299,9 @@ class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignal
for (int i = 0; i < as.length; i++)
if (as[i] != bs[i]) test.fail("didn't receive identical byte arrays");
}
+ public Path pathrv(Path a) { return a; }
+ public List<Path> pathlistrv(List<Path> a) { return a; }
+ public Map<Path,Path> pathmaprv(Map<Path,Path> a) { return a; }
}
/**
@@ -324,6 +327,18 @@ class renamedsignalhandler implements DBusSigHandler<TestSignalInterface2.TestRe
/**
* Typed signal handler
*/
+class pathsignalhandler implements DBusSigHandler<TestSignalInterface.TestPathSignal>
+{
+ /** Handling a signal */
+ public void handle(TestSignalInterface.TestPathSignal t)
+ {
+ System.out.println("Path sighandler: "+t);
+ }
+}
+
+/**
+ * Typed signal handler
+ */
class signalhandler implements DBusSigHandler<TestSignalInterface.TestSignal>
{
/** Handling a signal */
@@ -467,6 +482,7 @@ public class test
String source = dbus.GetNameOwner("foo.bar.Test");
clientconn.addSigHandler(TestSignalInterface.TestArraySignal.class, source, peer, new arraysignalhandler());
clientconn.addSigHandler(TestSignalInterface.TestObjectSignal.class, new objectsignalhandler());
+ clientconn.addSigHandler(TestSignalInterface.TestPathSignal.class, new pathsignalhandler());
badarraysignalhandler<TestSignalInterface.TestSignal> bash = new badarraysignalhandler<TestSignalInterface.TestSignal>();
clientconn.addSigHandler(TestSignalInterface.TestSignal.class, bash);
clientconn.removeSigHandler(TestSignalInterface.TestSignal.class, bash);
@@ -511,10 +527,10 @@ public class test
/** This gets a remote object matching our bus name and exported object path. */
Introspectable intro = clientconn.getRemoteObject("foo.bar.Test", "/", Introspectable.class);
/** Get introspection data */
- String data = intro.Introspect();
+ String data;/* = intro.Introspect();
if (null == data || !data.startsWith("<!DOCTYPE"))
fail("Introspection data invalid");
- System.out.println("Got Introspection Data: \n"+data);
+ System.out.println("Got Introspection Data: \n"+data);*/
intro = clientconn.getRemoteObject("foo.bar.Test", "/Test", Introspectable.class);
/** Get introspection data */
data = intro.Introspect();
@@ -538,6 +554,30 @@ public class test
/** Call the remote object and get a response. */
String rname = tri.getName();
System.out.println("Got Remote Name: "+rname);
+
+ Path path = new Path("/nonexistantwooooooo");
+ Path p = tri.pathrv(path);
+ System.out.println(path.toString()+" => "+p.toString());
+ if (!path.equals(p)) fail("pathrv incorrect");
+ List<Path> paths = new Vector<Path>();
+ paths.add(path);
+ List<Path> ps = tri.pathlistrv(paths);
+ System.out.println(paths.toString()+" => "+ps.toString());
+ if (!paths.equals(ps)) fail("pathlistrv incorrect");
+ Map<Path, Path> pathm = new HashMap<Path, Path>();
+ pathm.put(path, path);
+ Map<Path, Path> pm = tri.pathmaprv(pathm);
+ System.out.println(pathm.toString()+" => "+pm.toString());
+ System.out.println(pm.containsKey(path)+" "+pm.get(path)+" "+path.equals(pm.get(path)));
+ System.out.println(pm.containsKey(p)+" "+pm.get(p)+" "+p.equals(pm.get(p)));
+ for (Path q: pm.keySet()) {
+ System.out.println(q);
+ System.out.println(pm.get(q));
+ }
+ if (!pm.containsKey(path) || !path.equals(pm.get(path))) fail("pathmaprv incorrect");
+
+ serverconn.sendSignal(new TestSignalInterface.TestPathSignal("/Test", path, paths, pathm));
+
Collator col = Collator.getInstance();
col.setDecomposition(Collator.FULL_DECOMPOSITION);
col.setStrength(Collator.PRIMARY);
diff --git a/org/freedesktop/dbus/test/test_p2p_server.java b/org/freedesktop/dbus/test/test_p2p_server.java
index 1025bda..10201a9 100644
--- a/org/freedesktop/dbus/test/test_p2p_server.java
+++ b/org/freedesktop/dbus/test/test_p2p_server.java
@@ -65,6 +65,9 @@ public class test_p2p_server implements TestRemoteInterface
public void reg13291(byte[] as, byte[] bs)
{
}
+ public Path pathrv(Path a) { return a; }
+ public List<Path> pathlistrv(List<Path> a) { return a; }
+ public Map<Path,Path> pathmaprv(Map<Path,Path> a) { return a; }
public boolean isRemote() { return false; }
public float testfloat(float[] f)
{