summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
Diffstat (limited to 'php')
-rw-r--r--php/test/Ice/acm/.depend1
-rw-r--r--php/test/Ice/acm/.depend.mak1
-rw-r--r--php/test/Ice/acm/.gitignore1
-rw-r--r--php/test/Ice/acm/Client.php97
-rw-r--r--php/test/Ice/acm/Makefile26
-rw-r--r--php/test/Ice/acm/Makefile.mak24
-rw-r--r--php/test/Ice/acm/Test.ice37
-rwxr-xr-xphp/test/Ice/acm/run.py23
8 files changed, 210 insertions, 0 deletions
diff --git a/php/test/Ice/acm/.depend b/php/test/Ice/acm/.depend
new file mode 100644
index 00000000000..f6d6205e60d
--- /dev/null
+++ b/php/test/Ice/acm/.depend
@@ -0,0 +1 @@
+Test.php: Test.ice $(SLICE2PHP) $(SLICEPARSERLIB)
diff --git a/php/test/Ice/acm/.depend.mak b/php/test/Ice/acm/.depend.mak
new file mode 100644
index 00000000000..8751ce66bf8
--- /dev/null
+++ b/php/test/Ice/acm/.depend.mak
@@ -0,0 +1 @@
+Test.php: Test.ice "$(SLICE2PHP)" "$(SLICEPARSERLIB)"
diff --git a/php/test/Ice/acm/.gitignore b/php/test/Ice/acm/.gitignore
new file mode 100644
index 00000000000..bed01730acc
--- /dev/null
+++ b/php/test/Ice/acm/.gitignore
@@ -0,0 +1 @@
+Test.php
diff --git a/php/test/Ice/acm/Client.php b/php/test/Ice/acm/Client.php
new file mode 100644
index 00000000000..42ccae18448
--- /dev/null
+++ b/php/test/Ice/acm/Client.php
@@ -0,0 +1,97 @@
+<?
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+error_reporting(E_ALL | E_STRICT);
+
+if(!extension_loaded("ice"))
+{
+ echo "\nerror: Ice extension is not loaded.\n\n";
+ exit(1);
+}
+
+$NS = function_exists("Ice\\initialize");
+require_once ($NS ? 'Ice_ns.php' : 'Ice.php');
+require_once 'Test.php';
+
+function test($b)
+{
+ if(!$b)
+ {
+ $bt = debug_backtrace();
+ die("\ntest failed in ".$bt[0]["file"]." line ".$bt[0]["line"]."\n");
+ }
+}
+
+function allTests($communicator)
+{
+ global $NS;
+
+ echo "testing setACM/getACM... ";
+ flush();
+
+ $ref = "communicator:default -p 12010";
+ $com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator");
+
+ $adapter = $com->createObjectAdapter(-1, -1, -1);
+
+ $initData = $NS ? eval("return new Ice\\InitializationData;") : new Ice_InitializationData;
+ $initData->properties = $communicator->getProperties()->clone();
+ $initData->properties->setProperty("Ice.ACM.Timeout", "1");
+ $initData->properties->setProperty("Ice.ACM.Client.Timeout", "15");
+ $initData->properties->setProperty("Ice.ACM.Client.Close", "4");
+ $initData->properties->setProperty("Ice.ACM.Client.Heartbeat", "2");
+ $testCommunicator = $NS ? eval("return Ice\\initialize(\$initData);") : Ice_initialize($initData);
+ $proxy = $testCommunicator->stringToProxy($adapter->getTestIntf()->ice_toString())->ice_uncheckedCast(
+ "::Test::TestIntf");
+ $proxy->ice_getConnection();
+
+ $CloseOnIdleForceful =
+ $NS ? constant("Ice\\ACMClose::CloseOnIdleForceful") : constant("Ice_ACMClose::CloseOnIdleForceful");
+ $CloseOnInvocationAndIdle =
+ $NS ? constant("Ice\\ACMClose::CloseOnInvocationAndIdle") : constant("Ice_ACMClose::CloseOnInvocationAndIdle");
+ $HeartbeatOnIdle =
+ $NS ? constant("Ice\\ACMHeartbeat::HeartbeatOnIdle") : constant("Ice_ACMHeartbeat::HeartbeatOnIdle");
+ $HeartbeatOnInvocation =
+ $NS ? constant("Ice\\ACMHeartbeat::HeartbeatOnInvocation") :
+ constant("Ice_ACMHeartbeat::HeartbeatOnInvocation");
+
+ $acm = $proxy->ice_getCachedConnection()->getACM();
+ test($acm->timeout == 15);
+ test($acm->close == $CloseOnIdleForceful);
+ test($acm->heartbeat == $HeartbeatOnIdle);
+
+ $proxy->ice_getCachedConnection()->setACM(Ice_Unset, Ice_Unset, Ice_Unset);
+ $acm = $proxy->ice_getCachedConnection()->getACM();
+ test($acm->timeout == 15);
+ test($acm->close == $CloseOnIdleForceful);
+ test($acm->heartbeat == $HeartbeatOnIdle);
+
+ $proxy->ice_getCachedConnection()->setACM(20, $CloseOnInvocationAndIdle, $HeartbeatOnInvocation);
+ $acm = $proxy->ice_getCachedConnection()->getACM();
+ test($acm->timeout == 20);
+ test($acm->close == $CloseOnInvocationAndIdle);
+ test($acm->heartbeat == $HeartbeatOnInvocation);
+
+ $adapter->deactivate();
+ $testCommunicator->destroy();
+ echo "ok\n";
+
+ echo "shutting down... ";
+ flush();
+ $com->shutdown();
+ echo "ok\n";
+}
+
+$communicator = Ice_initialize($argv);
+allTests($communicator);
+$communicator->destroy();
+
+exit();
+?>
diff --git a/php/test/Ice/acm/Makefile b/php/test/Ice/acm/Makefile
new file mode 100644
index 00000000000..f8d515d687f
--- /dev/null
+++ b/php/test/Ice/acm/Makefile
@@ -0,0 +1,26 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ../../..
+
+SLICE_SRCS = Test.ice
+
+include $(top_srcdir)/config/Make.rules.php
+
+SRCS = Test.php
+
+all:: $(SRCS)
+
+%.php: %.ice
+ $(SLICE2PHP) $(SLICE2PHPFLAGS) $<
+
+clean::
+ rm -f $(SRCS)
+
+include .depend
diff --git a/php/test/Ice/acm/Makefile.mak b/php/test/Ice/acm/Makefile.mak
new file mode 100644
index 00000000000..53c8f118100
--- /dev/null
+++ b/php/test/Ice/acm/Makefile.mak
@@ -0,0 +1,24 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ..\..\..
+
+!include $(top_srcdir)\config\Make.rules.mak.php
+
+SRCS = Test.php
+
+all:: $(SRCS)
+
+$(SRCS): $*.ice
+ -"$(SLICE2PHP)" $(SLICE2PHPFLAGS) $*.ice
+
+clean::
+ del /q $(SRCS)
+
+include .depend.mak
diff --git a/php/test/Ice/acm/Test.ice b/php/test/Ice/acm/Test.ice
new file mode 100644
index 00000000000..3289856d9e1
--- /dev/null
+++ b/php/test/Ice/acm/Test.ice
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+module Test
+{
+
+interface TestIntf
+{
+ void sleep(int seconds);
+ void sleepAndHold(int seconds);
+ void interruptSleep();
+};
+
+interface RemoteObjectAdapter
+{
+ TestIntf* getTestIntf();
+ void activate();
+ void hold();
+ void deactivate();
+};
+
+interface RemoteCommunicator
+{
+ RemoteObjectAdapter* createObjectAdapter(int acmTimeout, int close, int heartbeat);
+ void shutdown();
+};
+
+};
+
diff --git a/php/test/Ice/acm/run.py b/php/test/Ice/acm/run.py
new file mode 100755
index 00000000000..33fc2e8f3ac
--- /dev/null
+++ b/php/test/Ice/acm/run.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.clientServerTest()