diff options
Diffstat (limited to 'cs')
-rwxr-xr-x | cs/allDemos.py | 132 | ||||
-rw-r--r-- | cs/demo/Glacier2/callback/CallbackI.cs | 2 | ||||
-rwxr-xr-x | cs/demo/Glacier2/callback/expect.py | 39 | ||||
-rw-r--r-- | cs/demo/Ice/async/Client.cs | 2 | ||||
-rwxr-xr-x | cs/demo/Ice/async/expect.py | 33 | ||||
-rwxr-xr-x | cs/demo/Ice/bidir/expect.py | 31 | ||||
-rwxr-xr-x | cs/demo/Ice/callback/expect.py | 33 | ||||
-rwxr-xr-x | cs/demo/Ice/hello/expect.py | 33 | ||||
-rwxr-xr-x | cs/demo/Ice/invoke/expect.py | 33 | ||||
-rwxr-xr-x | cs/demo/Ice/latency/expect.py | 36 | ||||
-rwxr-xr-x | cs/demo/Ice/minimal/expect.py | 35 | ||||
-rwxr-xr-x | cs/demo/Ice/nested/expect.py | 33 | ||||
-rwxr-xr-x | cs/demo/Ice/session/expect.py | 31 | ||||
-rwxr-xr-x | cs/demo/Ice/throughput/expect.py | 32 | ||||
-rwxr-xr-x | cs/demo/Ice/value/Client.cs | 4 | ||||
-rwxr-xr-x | cs/demo/Ice/value/expect.py | 32 | ||||
-rwxr-xr-x | cs/demo/IceBox/hello/expect.py | 50 | ||||
-rwxr-xr-x | cs/demo/IceGrid/simple/expect.py | 32 | ||||
-rwxr-xr-x | cs/demo/IceStorm/clock/expect.py | 28 | ||||
-rwxr-xr-x | cs/demo/book/lifecycle/expect.py | 33 | ||||
-rw-r--r-- | cs/demo/book/lifecycle/generated/.gitignore | 1 | ||||
-rwxr-xr-x | cs/demo/book/printer/expect.py | 35 | ||||
-rwxr-xr-x | cs/demo/book/simple_filesystem/expect.py | 35 |
23 files changed, 751 insertions, 4 deletions
diff --git a/cs/allDemos.py b/cs/allDemos.py new file mode 100755 index 00000000000..9dc7a42dc29 --- /dev/null +++ b/cs/allDemos.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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, getopt + +def isCygwin(): + # The substring on sys.platform is required because some cygwin + # versions return variations like "cygwin_nt-4.01". + return sys.platform[:6] == "cygwin" + +def runDemos(args, demos, num = 0): + rootPath = "demo" + if not os.path.exists(rootPath): + rootPath = "." + + if not os.path.exists(os.path.join(rootPath, os.path.normpath(demos[0]))): + print "Unable to locate first demo. Check directory structure and location of scripts" + sys.exit(1) + + # + # Run each of the demos. + # + for i in demos: + + i = os.path.normpath(i) + dir = os.path.join(rootPath, i) + + print + if(num > 0): + print "[" + str(num) + "]", + print "*** running demo in " + dir, + print + + status = os.system("cd %s ; %s %s" % (dir, "./expect.py", args)) + + if status: + if(num > 0): + print "[" + str(num) + "]", + print "test in " + dir + " failed with exit status", status, + sys.exit(status) + +# +# List of all basic demos. +# +demos = [ "Ice/async", + "Ice/bidir", + "Ice/callback", + "Ice/hello", + "Ice/invoke", + "Ice/latency", + "Ice/minimal", + "Ice/nested", + "Ice/session", + "Ice/throughput", + "Ice/value", + "IceBox/hello", + "IceStorm/clock", + "IceGrid/simple", + "Glacier2/callback", + "book/simple_filesystem", + "book/printer", + "book/lifecycle", + ] + +# +# These demos are currently disabled on cygwin +# +if isCygwin() == 0: + demos += [ ] + +def usage(): + print "usage: " + sys.argv[0] + " --fast --trace --start=<demo> -l -r <regex> -R <regex> --debug --host host" + sys.exit(2) + +try: + opts, args = getopt.getopt(sys.argv[1:], "lr:R:", ["start=", "fast", "trace", "debug", "host="]) +except getopt.GetoptError: + usage() + +if(args): + usage() + +loop = 0 +args = "" +for o, a in opts: + if o == "-l": + loop = 1 + if o == "-r" or o == '-R': + import re + regexp = re.compile(a) + if o == '-r': + def rematch(x): return regexp.search(x) + else: + def rematch(x): return not regexp.search(x) + demos = filter(rematch, demos) + if o == "--protocol": + if a not in ( "ssl", "tcp"): + usage() + args += " " + o + " " + a + if o == "--host" : + args += " " + o + " " + a + if o in ( "--fast", "--trace", "--debug"): + args += " " + o + if o == '--start': + import re + regexp = re.compile(a) + found = False + nt = [] + for t in demos: + if not found and regexp.search(t): + found = True + if found: + nt.append(t) + if len(nt) == 0: + print "test %s not found. no demos to run" % (a) + sys.exit(2) + demos = nt + +if loop: + num = 1 + while 1: + runDemos(args, demos, num) + num += 1 +else: + runDemos(args, demos) diff --git a/cs/demo/Glacier2/callback/CallbackI.cs b/cs/demo/Glacier2/callback/CallbackI.cs index 20d05798817..1a1d307855e 100644 --- a/cs/demo/Glacier2/callback/CallbackI.cs +++ b/cs/demo/Glacier2/callback/CallbackI.cs @@ -14,7 +14,7 @@ public sealed class CallbackI : CallbackDisp_ { public override void initiateCallback(CallbackReceiverPrx proxy, Ice.Current current) { - Console.WriteLine("initiating callback"); + Console.WriteLine("initiating callback to: " + current.adapter.getCommunicator().proxyToString(proxy)); try { proxy.callback(current.ctx); diff --git a/cs/demo/Glacier2/callback/expect.py b/cs/demo/Glacier2/callback/expect.py new file mode 100755 index 00000000000..2eee49d32b1 --- /dev/null +++ b/cs/demo/Glacier2/callback/expect.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Glacier2.callback + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +sessionserver = demoscript.Util.spawn('%ssessionserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +sessionserver.expect('.* ready') + +glacier2 = demoscript.Util.spawn('glacier2router --Ice.Config=config.glacier2 --Ice.PrintAdapterReady --Glacier2.SessionTimeout=5') +glacier2.expect('Glacier2.Client ready') +glacier2.expect('Glacier2.Server ready') + +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) + +demoscript.Glacier2.callback.run(client, server, sessionserver, glacier2) diff --git a/cs/demo/Ice/async/Client.cs b/cs/demo/Ice/async/Client.cs index ea7ab3aed85..e1149f464fe 100644 --- a/cs/demo/Ice/async/Client.cs +++ b/cs/demo/Ice/async/Client.cs @@ -22,7 +22,7 @@ public class Client : Ice.Application { if(ex is RequestCanceledException) { - Console.Error.WriteLine("Request canceled"); + Console.Error.WriteLine("RequestCanceledException"); } else { diff --git a/cs/demo/Ice/async/expect.py b/cs/demo/Ice/async/expect.py new file mode 100755 index 00000000000..2076b186786 --- /dev/null +++ b/cs/demo/Ice/async/expect.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.async + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect('.*==>') + +demoscript.Ice.async.run(client, server) diff --git a/cs/demo/Ice/bidir/expect.py b/cs/demo/Ice/bidir/expect.py new file mode 100755 index 00000000000..ef7f0c7bab2 --- /dev/null +++ b/cs/demo/Ice/bidir/expect.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.bidir + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +demoscript.Ice.bidir.run('%sclient.exe' % (demoscript.Util.mono()), server) diff --git a/cs/demo/Ice/callback/expect.py b/cs/demo/Ice/callback/expect.py new file mode 100755 index 00000000000..8c55b78350e --- /dev/null +++ b/cs/demo/Ice/callback/expect.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.callback + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect('.*==>') + +demoscript.Ice.callback.run(client, server) diff --git a/cs/demo/Ice/hello/expect.py b/cs/demo/Ice/hello/expect.py new file mode 100755 index 00000000000..02143df5c15 --- /dev/null +++ b/cs/demo/Ice/hello/expect.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.hello + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect('.*==>') + +demoscript.Ice.hello.run(client, server) diff --git a/cs/demo/Ice/invoke/expect.py b/cs/demo/Ice/invoke/expect.py new file mode 100755 index 00000000000..2645e7ca4c1 --- /dev/null +++ b/cs/demo/Ice/invoke/expect.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.invoke + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect('.*==>') + +demoscript.Ice.invoke.run(client, server) diff --git a/cs/demo/Ice/latency/expect.py b/cs/demo/Ice/latency/expect.py new file mode 100755 index 00000000000..9e6e7d8bbb6 --- /dev/null +++ b/cs/demo/Ice/latency/expect.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +print "testing ping... ", +sys.stdout.flush() +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect(pexpect.EOF, timeout=100) +print "ok" + +print client.before diff --git a/cs/demo/Ice/minimal/expect.py b/cs/demo/Ice/minimal/expect.py new file mode 100755 index 00000000000..16ea852d00a --- /dev/null +++ b/cs/demo/Ice/minimal/expect.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +print "testing...", +sys.stdout.flush() +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect(pexpect.EOF) +server.expect('Hello World!') +print "ok" diff --git a/cs/demo/Ice/nested/expect.py b/cs/demo/Ice/nested/expect.py new file mode 100755 index 00000000000..726b0d8f750 --- /dev/null +++ b/cs/demo/Ice/nested/expect.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.nested + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe --Ice.Override.Timeout=2000' % (demoscript.Util.mono())) +client.expect('.*for exit:') + +demoscript.Ice.nested.run(client, server) diff --git a/cs/demo/Ice/session/expect.py b/cs/demo/Ice/session/expect.py new file mode 100755 index 00000000000..fc50eb8a1d8 --- /dev/null +++ b/cs/demo/Ice/session/expect.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.session + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +demoscript.Ice.session.run('%sclient.exe' % (demoscript.Util.mono()), server) diff --git a/cs/demo/Ice/throughput/expect.py b/cs/demo/Ice/throughput/expect.py new file mode 100755 index 00000000000..80adfff8442 --- /dev/null +++ b/cs/demo/Ice/throughput/expect.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.throughput + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) + +demoscript.Ice.throughput.run(client, server) diff --git a/cs/demo/Ice/value/Client.cs b/cs/demo/Ice/value/Client.cs index 9d877701c53..3818ef3692b 100755 --- a/cs/demo/Ice/value/Client.cs +++ b/cs/demo/Ice/value/Client.cs @@ -92,7 +92,7 @@ public class Client : Ice.Application Console.In.ReadLine(); Printer derivedAsBase = initial.getDerivedPrinter(); - Console.Out.WriteLine("The type ID of the received object is \"" + derivedAsBase.ice_id() + "\""); + Console.Out.WriteLine("==> The type ID of the received object is \"" + derivedAsBase.ice_id() + "\""); Debug.Assert(derivedAsBase.ice_id().Equals("::Demo::Printer")); Console.Out.WriteLine(); @@ -108,7 +108,7 @@ public class Client : Ice.Application DerivedPrinter derived = (DerivedPrinter)derivedAsBase; Console.Out.WriteLine("==> class cast to derived object succeded"); - Console.Out.WriteLine("The type ID of the received object is \"" + derived.ice_id() + "\""); + Console.Out.WriteLine("==> The type ID of the received object is \"" + derived.ice_id() + "\""); Console.Out.WriteLine(); Console.Out.WriteLine("Let's print the message contained in the derived object, and"); diff --git a/cs/demo/Ice/value/expect.py b/cs/demo/Ice/value/expect.py new file mode 100755 index 00000000000..096ad9e882d --- /dev/null +++ b/cs/demo/Ice/value/expect.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.Ice.value + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) + +demoscript.Ice.value.run(client, server) diff --git a/cs/demo/IceBox/hello/expect.py b/cs/demo/IceBox/hello/expect.py new file mode 100755 index 00000000000..ff1c5590278 --- /dev/null +++ b/cs/demo/IceBox/hello/expect.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.IceBox.hello + +if demoscript.Util.defaultHost: + args = ' --IceBox.UseSharedCommunicator.IceStorm=1' +else: + args = '' + +iceboxnet = "iceboxnet.exe" +if len(demoscript.Util.mono()) > 0: + prefix = [ "../../..", "/usr" ] + if os.environ.has_key("ICE_HOME"): + prefix.append(os.environ["ICE_HOME"]) + for p in prefix: + path = os.path.join(p, "bin", iceboxnet) + if os.path.exists(path): + iceboxnet = path + break +# TODO: This doesn't setup LD_LIBRARY_PATH +server = demoscript.Util.spawn('%s%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % ( + demoscript.Util.mono(), iceboxnet, args)) +server.expect('.* ready') +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect('.*==>') + +demoscript.IceBox.hello.run(client, server) diff --git a/cs/demo/IceGrid/simple/expect.py b/cs/demo/IceGrid/simple/expect.py new file mode 100755 index 00000000000..c36b0b735d8 --- /dev/null +++ b/cs/demo/IceGrid/simple/expect.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.IceGrid.simple + +if demoscript.Util.isWin32(): + demoscript.IceGrid.simple.run('%sclient.exe' % (demoscript.Util.mono())) +else: + print "Not supported yet with mono!" + diff --git a/cs/demo/IceStorm/clock/expect.py b/cs/demo/IceStorm/clock/expect.py new file mode 100755 index 00000000000..62ae936ef3b --- /dev/null +++ b/cs/demo/IceStorm/clock/expect.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.IceStorm.clock + +demoscript.IceStorm.clock.run('%ssubscriber.exe' % (demoscript.Util.mono()), '%spublisher.exe' % (demoscript.Util.mono())) diff --git a/cs/demo/book/lifecycle/expect.py b/cs/demo/book/lifecycle/expect.py new file mode 100755 index 00000000000..0f4dd41c438 --- /dev/null +++ b/cs/demo/book/lifecycle/expect.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +import demoscript.book.lifecycle + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) + +demoscript.book.lifecycle.run(client, server) diff --git a/cs/demo/book/lifecycle/generated/.gitignore b/cs/demo/book/lifecycle/generated/.gitignore new file mode 100644 index 00000000000..39af5887579 --- /dev/null +++ b/cs/demo/book/lifecycle/generated/.gitignore @@ -0,0 +1 @@ +# Dummy file, so that git retains this otherwise empty directory. diff --git a/cs/demo/book/printer/expect.py b/cs/demo/book/printer/expect.py new file mode 100755 index 00000000000..16ea852d00a --- /dev/null +++ b/cs/demo/book/printer/expect.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +print "testing...", +sys.stdout.flush() +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect(pexpect.EOF) +server.expect('Hello World!') +print "ok" diff --git a/cs/demo/book/simple_filesystem/expect.py b/cs/demo/book/simple_filesystem/expect.py new file mode 100755 index 00000000000..9a48e980e25 --- /dev/null +++ b/cs/demo/book/simple_filesystem/expect.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2007 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 pexpect, sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util + +server = demoscript.Util.spawn('%sserver.exe --Ice.PrintAdapterReady' % (demoscript.Util.mono())) +server.expect('.* ready') + +print "testing...", +sys.stdout.flush() +client = demoscript.Util.spawn('%sclient.exe' % (demoscript.Util.mono())) +client.expect('Contents of root directory:\r{1,2}\n.*Down to a sunless sea.') +client.expect(pexpect.EOF) +print "ok" |