summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/test/Glacier2/router/CallbackClient.java50
-rw-r--r--java/test/Glacier2/router/CallbackServer.java10
-rw-r--r--java/test/Glacier2/router/passwords2
-rwxr-xr-xjava/test/Glacier2/router/run.py2
4 files changed, 57 insertions, 7 deletions
diff --git a/java/test/Glacier2/router/CallbackClient.java b/java/test/Glacier2/router/CallbackClient.java
index 4a38723882b..c9cab08f6b5 100644
--- a/java/test/Glacier2/router/CallbackClient.java
+++ b/java/test/Glacier2/router/CallbackClient.java
@@ -61,7 +61,7 @@ class CallbackClient extends Ice.Application
{
System.out.print("testing stringToProxy for server object... ");
System.out.flush();
- base = communicator().stringToProxy("callback:tcp -p 12345 -t 10000");
+ base = communicator().stringToProxy("c1/callback:tcp -p 12345 -t 10000");
System.out.println("ok");
}
@@ -86,7 +86,7 @@ class CallbackClient extends Ice.Application
System.out.flush();
try
{
- session = router.createSession("dummy", "xxx");
+ session = router.createSession("userid", "xxx");
test(false);
}
catch(Glacier2.PermissionDeniedException ex)
@@ -118,7 +118,7 @@ class CallbackClient extends Ice.Application
System.out.flush();
try
{
- session = router.createSession("dummy", "abc123");
+ session = router.createSession("userid", "abc123");
}
catch(Glacier2.PermissionDeniedException ex)
{
@@ -136,7 +136,7 @@ class CallbackClient extends Ice.Application
System.out.flush();
try
{
- router.createSession("dummy", "abc123");
+ router.createSession("userid", "abc123");
test(false);
}
catch(Glacier2.PermissionDeniedException ex)
@@ -261,6 +261,48 @@ class CallbackClient extends Ice.Application
}
}
+ {
+ System.out.print("testing whether other allowed category is accepted... ");
+ System.out.flush();
+ java.util.Map context = new java.util.HashMap();
+ context.put("_fwd", "t");
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_newIdentity(Ice.Util.stringToIdentity("c2/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ test(callbackReceiverImpl.callbackOK());
+ System.out.println("ok");
+ }
+
+ {
+ System.out.print("testing whether disallowed category gets rejected... ");
+ System.out.flush();
+ java.util.Map context = new java.util.HashMap();
+ context.put("_fwd", "t");
+ try
+ {
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_newIdentity(Ice.Util.stringToIdentity("c3/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ System.out.println("ok");
+ }
+ }
+
+ {
+ System.out.print("testing whether user-id as category is accepted... ");
+ System.out.flush();
+ java.util.Map context = new java.util.HashMap();
+ context.put("_fwd", "t");
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_newIdentity(Ice.Util.stringToIdentity("_userid/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ test(callbackReceiverImpl.callbackOK());
+ System.out.println("ok");
+ }
+
{
System.out.print("testing server shutdown... ");
System.out.flush();
diff --git a/java/test/Glacier2/router/CallbackServer.java b/java/test/Glacier2/router/CallbackServer.java
index 8f285d6ca54..f6584f4f61a 100644
--- a/java/test/Glacier2/router/CallbackServer.java
+++ b/java/test/Glacier2/router/CallbackServer.java
@@ -16,8 +16,14 @@ class CallbackServer extends Ice.Application
{
communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12345 -t 10000");
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
- CallbackPrx self = CallbackPrxHelper.uncheckedCast(adapter.createProxy(Ice.Util.stringToIdentity("callback")));
- adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback"));
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category.
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category.
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category.
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
adapter.activate();
communicator().waitForShutdown();
return 0;
diff --git a/java/test/Glacier2/router/passwords b/java/test/Glacier2/router/passwords
index 2b10070db5c..a1527dec2b9 100644
--- a/java/test/Glacier2/router/passwords
+++ b/java/test/Glacier2/router/passwords
@@ -1 +1 @@
-dummy xxMqsnnDcK8tw \ No newline at end of file
+userid xxMqsnnDcK8tw \ No newline at end of file
diff --git a/java/test/Glacier2/router/run.py b/java/test/Glacier2/router/run.py
index c0e770f4ada..6e15e0d9316 100755
--- a/java/test/Glacier2/router/run.py
+++ b/java/test/Glacier2/router/run.py
@@ -30,6 +30,8 @@ router = os.path.join(ice_home, "bin", "glacier2router")
command = router + TestUtil.clientServerOptions + \
r' --Ice.PrintProcessId' \
+ r' --Glacier2.AllowCategories="c1 c2"' + \
+ r' --Glacier2.AddUserToAllowCategories="2"' + \
r' --Glacier2.RouterIdentity="abc/def"' + \
r' --Glacier2.AdminIdentity="ABC/DEF"' + \
r' --Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \