head	1.45;
access;
symbols
	start:1.1.1.1 vendor:1.1.1;
locks; strict;
comment	@# @;


1.45
date	2002.02.13.22.25.01;	author tack;	state Exp;
branches;
next	1.44;

1.44
date	2001.08.19.21.55.51;	author tack;	state Exp;
branches;
next	1.43;

1.43
date	2001.08.17.03.04.23;	author tack;	state Exp;
branches;
next	1.42;

1.42
date	2001.08.17.02.40.54;	author tack;	state Exp;
branches;
next	1.41;

1.41
date	2001.08.16.17.33.29;	author tack;	state Exp;
branches;
next	1.40;

1.40
date	2001.08.14.01.04.23;	author tack;	state Exp;
branches;
next	1.39;

1.39
date	2001.06.06.23.38.40;	author tack;	state Exp;
branches;
next	1.38;

1.38
date	2001.06.06.22.59.23;	author tack;	state Exp;
branches;
next	1.37;

1.37
date	2001.06.05.03.13.36;	author tack;	state Exp;
branches;
next	1.36;

1.36
date	2001.06.04.23.49.08;	author tack;	state Exp;
branches;
next	1.35;

1.35
date	2001.06.04.03.26.46;	author tack;	state Exp;
branches;
next	1.34;

1.34
date	2001.06.03.02.20.48;	author tack;	state Exp;
branches;
next	1.33;

1.33
date	2001.06.03.01.46.46;	author tack;	state Exp;
branches;
next	1.32;

1.32
date	2001.06.03.01.41.00;	author tack;	state Exp;
branches;
next	1.31;

1.31
date	2001.06.03.00.00.11;	author tack;	state Exp;
branches;
next	1.30;

1.30
date	2001.05.28.19.36.26;	author tack;	state Exp;
branches;
next	1.29;

1.29
date	2001.05.28.19.33.12;	author tack;	state Exp;
branches;
next	1.28;

1.28
date	2001.05.28.04.33.58;	author tack;	state Exp;
branches;
next	1.27;

1.27
date	2001.05.27.23.03.57;	author tack;	state Exp;
branches;
next	1.26;

1.26
date	2001.05.25.04.22.36;	author tack;	state Exp;
branches;
next	1.25;

1.25
date	2001.05.24.18.07.32;	author tack;	state Exp;
branches;
next	1.24;

1.24
date	2001.05.24.13.52.34;	author tack;	state Exp;
branches;
next	1.23;

1.23
date	2001.05.24.02.28.21;	author tack;	state Exp;
branches;
next	1.22;

1.22
date	2001.05.21.03.37.56;	author tack;	state Exp;
branches;
next	1.21;

1.21
date	2001.05.21.02.19.16;	author tack;	state Exp;
branches;
next	1.20;

1.20
date	2001.05.17.17.28.03;	author tack;	state Exp;
branches;
next	1.19;

1.19
date	2001.05.10.02.37.46;	author tack;	state Exp;
branches;
next	1.18;

1.18
date	2001.05.10.02.36.49;	author tack;	state Exp;
branches;
next	1.17;

1.17
date	2001.04.12.04.31.50;	author tack;	state Exp;
branches;
next	1.16;

1.16
date	2001.04.12.00.37.13;	author tack;	state Exp;
branches;
next	1.15;

1.15
date	2001.04.11.16.26.13;	author tack;	state Exp;
branches;
next	1.14;

1.14
date	2001.04.02.01.07.31;	author tack;	state Exp;
branches;
next	1.13;

1.13
date	2001.03.29.13.05.13;	author tack;	state Exp;
branches;
next	1.12;

1.12
date	2001.03.29.00.20.24;	author tack;	state Exp;
branches;
next	1.11;

1.11
date	2001.01.27.23.29.27;	author tack;	state Exp;
branches;
next	1.10;

1.10
date	2001.01.27.23.23.35;	author lo-lan-do;	state Exp;
branches;
next	1.9;

1.9
date	2000.08.26.18.27.06;	author tack;	state Exp;
branches;
next	1.8;

1.8
date	2000.08.26.18.25.54;	author tack;	state Exp;
branches;
next	1.7;

1.7
date	2000.08.22.04.20.29;	author tack;	state Exp;
branches;
next	1.6;

1.6
date	2000.08.22.03.57.30;	author tack;	state Exp;
branches;
next	1.5;

1.5
date	2000.08.22.03.47.01;	author tack;	state Exp;
branches;
next	1.4;

1.4
date	2000.08.19.01.27.00;	author tack;	state Exp;
branches;
next	1.3;

1.3
date	2000.03.16.17.03.14;	author tack;	state Exp;
branches;
next	1.2;

1.2
date	2000.03.16.16.32.57;	author tack;	state Exp;
branches;
next	1.1;

1.1
date	2000.03.14.21.13.25;	author tack;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.03.14.21.13.25;	author tack;	state Exp;
branches;
next	;


desc
@@


1.45
log
@Bug fixes and union spec compliance
@
text
@#!/usr/bin/python

# This test suite is deprecated and is basically used for quick tests.
# Look at test-suite/ and examples/ for something useful.

import CORBA
import sys
import Fruit, Fruit__POA
import random

class Instance(Fruit__POA.Instance):
	def __init__(self, fruit):
		self.fruit = fruit
		self.left = 100

	def noop(self): pass

	def bite(self, size):
		if self.left - size < 0:
			exdata = Fruit.Instance.BigBite(too_much_by = size - self.left)
			raise Fruit.Instance.BigBite, exdata
			return

		self.left = self.left - size
		print "Eating %d%%, %d%% left" % (size, self.left)
		if self.left == 0:
			raise Fruit.Instance.AllEaten

	def get_factory(self):
		return Factory()._this()

	def discard_factory(self, ref):
		servant = poa.reference_to_servant(ref)
		poa.deactivate_object(servant)


class Factory(Fruit__POA.Factory):
	def __init__(self):
		self.fruit_list = []

	def raise_ex(self):
		raise Fruit.Factory.AlreadyExists

	def add_fruit(self, f):
		for fruit in self.fruit_list:
			if fruit.name == f.name:
				raise Fruit.Factory.AlreadyExists
		self.fruit_list.append(f)

	def get_instance(self, fruit):
		return Instance(fruit)._this()

	def get_one_instance(self):
		print "----------------------------------------------------------------"
		return Instance(self.fruit_list[0])._this()

	def discard_instance(self, ref):
		servant = poa.reference_to_servant(ref)
		poa.deactivate_object(servant)

	def get_random_fruit(self):
		#return 0, self.fruit_list[0]
		print "--- get random fruit -------------------------------------"
		index = random.randint(0, len(self.fruit_list) - 1)
		return index, self.fruit_list[index]

	def test_union(self, color):
		if color == Fruit.orange:
			return Fruit.Factory.TestUnion(color, "foobar")
		elif color == Fruit.red:
			return Fruit.Factory.TestUnion(color, 42)
		elif color == Fruit.yellow:
			return Fruit.Factory.TestUnion(color, 2.71828)
		elif color == Fruit.green:
			return Fruit.Factory.TestUnion(color, CORBA.TRUE)

	def test_any(self):
		pick = random.randint(0, 2)
		if pick == 0:
			return CORBA.Any(CORBA.TypeCode("IDL:CORBA/String:1.0"), "abc123")
		elif pick == 1:
			return CORBA.Any(CORBA.TypeCode("IDL:CORBA/Short:1.0"), 42)
		elif pick == 2:
			new_props = Fruit.Properties(name = "pineapple", color = Fruit.yellow)
			return CORBA.Any(CORBA.TypeCode(new_props), new_props)

	def test_list(self, n):
		return list(range (n))

	def die(self):
		orb.shutdown(CORBA.TRUE)

	def quickcall(self): pass

	def foobar(self): return "blub"

	def get_objseq(self):
		seq = [Blah()._this(), Blah()._this(), Blah()._this(), Blah()._this()]
		return seq

	def clean_objseq(self, o):
		for z in o:
			servant = poa.reference_to_servant(z)
			poa.deactivate_object(servant)
	
	def test_inst(self):
		return Blah()._this()

	def clean_inst(self, o):
		servant = poa.reference_to_servant(o)
		poa.deactivate_object(servant)

	def get_prop(self):
		f = Fruit.Properties(name = "orange", color = Fruit.orange)
		return Instance(f)._this()

	def set_prop(self, o):
		print o

	def test_octseq(self, o):
		print map(ord, o) == [0x31, 0x58, 0x68, 0x78, 0x78, 0x68]
		print map(ord, o) == (0x31, 0x58, 0x68, 0x78, 0x78, 0x68)
		for c in o:
			print ord(c)

	def get_octseq(self):
		return ('a', 'b', 'c', 'd')
#		return "abcd"

orb = CORBA.ORB_init()
f = Factory()
poa = orb.resolve_initial_references("RootPOA")
ref = f._this() # implicit activatin
open("./test-server.ior", "w").write(orb.object_to_string(ref))

o = CORBA.ORB_init()
poa.the_POAManager.activate()
orb.run()
@


1.44
log
@Rework of IDL operation return values in operation_skel
@
text
@a10 3
class Blah(Fruit__POA.Blah):
	pass

@


1.43
log
@Fix for octet sequences
@
text
@d2 4
d66 1
d100 2
a101 7
	def test_objseq(self):
#		a = Fruit.Properties(name = "orange", color = Fruit.orange)
#		b = Fruit.Properties(name = "orange1", color = Fruit.orange)
#		c = Fruit.Properties(name = "orange2", color = Fruit.orange)
#		d = Fruit.Properties(name = "orange3", color = Fruit.orange)
#		seq = (Instance(a)._this(), Instance(b)._this(), Instance(c)._this(), Instance(d)._this())
		seq = (Blah()._this(), Blah()._this(), Blah()._this(), Blah()._this())
d128 4
@


1.42
log
@Fix leaks
@
text
@d123 6
@


1.41
log
@Return correct exceptions; map object seqs to strings
@
text
@d7 3
d94 21
@


1.40
log
@Updates for pending 0.3.0 release
@
text
@d90 8
@


1.39
log
@Lots of leak fixes
@
text
@a84 3
	def get_string_seq(self): 
		return "Bar"

a87 4
	def foobar(self):
		return Instance(Fruit.Properties(name="orange",color=Fruit.orange))._this()
		return Factory()._this()

a89 3
class Fac2(Factory):
	pass

a91 10
"""
import time
print "Sleeping, note now"
while 1:
	f = Factory()
	f._this()
	poa.deactivate_object(f)
	f._this()
	poa.deactivate_object(f)
"""
a94 19
#f = Factory()
#print f
#import pickle
#print pickle.dump(f, open("o.pickle", "w"))
#f = pickle.load(open("o.pickle"))
#print f
#ref = f._this()
#print ref

"""
Factory()
Fac2()
print "Here"
o = Fac2()
print o
ref = o._this()
print o, ref
print dir(ref)
"""
a98 2
print "Running"
#print ref.foobar()
@


1.38
log
@Leak fixes
@
text
@d114 1
a114 7
while 1:
	poa.activate_object(f)
	a = poa.servant_to_reference(f)
	b = poa.servant_to_reference(f)
	poa.deactivate_object(f)
	print "----------------------------------"
#ref = f._this() # implicit activatin
@


1.37
log
@Implement PyORBit_Any_Get
@
text
@a112 2
for i in range(100):
	poa = orb.resolve_initial_references("RootPOA")
d114 6
a119 1
ref = f._this()
@


1.36
log
@Test suite corrections
@
text
@a115 1
print poa
a116 2
poa.deactivate_object(f)
poa.activate_object(f)
@


1.35
log
@Resurrected POA::the_POAManager, fixed module names for stub idl classes, and created the echo example
@
text
@d113 8
a120 1
ref = f._this() # implicit activation
d142 1
a142 1
poa = orb.resolve_initial_references("RootPOA")
@


1.34
log
@Fix for import cases with __POA
@
text
@d136 2
a137 1
poa._get_the_POAManager().activate()
@


1.33
log
@Fix segfault if ORB is not init'ed
@
text
@d101 1
a101 1
#orb = CORBA.ORB_init()
@


1.32
log
@Implemented activate_object_with_id
@
text
@d101 1
a101 3
orb = CORBA.ORB_init()
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
a112 2
id = poa.activate_object_with_id("foobar", f)
print "activated with id", id
@


1.31
log
@implicit activation in servant_to_reference; _default_POA() calls resolve_initial_references for RootPOA if needed
@
text
@d103 1
a103 1
#poa = orb.resolve_initial_references("RootPOA")
d115 2
@


1.30
log
@sync
@
text
@d101 1
d103 1
a103 1
poa = orb.resolve_initial_references("RootPOA")
d137 1
@


1.29
log
@Attach ORB to objrefs
@
text
@a72 1
		return CORBA.Any(CORBA.TypeCode("IDL:CORBA/Short:1.0"), 42)
@


1.28
log
@Leak plugging
@
text
@d73 1
@


1.27
log
@Mass changes all over the place
@
text
@d5 1
d12 2
d28 4
d37 3
d49 4
d58 1
a58 1
		import random
a72 1
		import random
d83 4
a86 1
		return range (n)
d114 1
a114 5
poa.activate_object(f)
poa.servant_to_reference(f)
poa.deactivate_object(f)
poa.activate_object(f)
ref = Factory()._this() # implicit activation
@


1.26
log
@More objref breakage.
@
text
@d87 10
d100 2
@


1.25
log
@More big breakage
@
text
@a87 2
print f._foo
print f._foo()
@


1.24
log
@Breaking stuff
@
text
@d1 1
a1 1
#!/usr/bin/env python
d79 2
d93 9
@


1.23
log
@Added CORBA_Object.*
@
text
@d86 2
@


1.22
log
@*** empty log message ***
@
text
@d76 1
@


1.21
log
@Small fixes
@
text
@d84 3
@


1.20
log
@Added _Get macros to API for Johan
@
text
@d98 1
a98 1
#print ref.test_list(5)
@


1.19
log
@Clean up cruft from test suite
@
text
@d75 3
@


1.18
log
@Set ob_type on fixed, typecode, any, and client/server types.
@
text
@a71 4
	def foobar(self, l):
		for fruit in l:
			print fruit.name

@


1.17
log
@More exceptions commits
@
text
@d72 4
@


1.16
log
@Tons of exception updates
@
text
@a69 4
#		raise CORBA.SystemException , (0, CORBA.COMPLETED_YES)
		print "Raising exception now"
#		raise CORBA.UNKNOWN, "Foo"
		raise CORBA.NO_MEMORY, (0, CORBA.COMPLETED_MAYBE)
d95 1
@


1.15
log
@More mapping spec stuff
@
text
@d70 4
@


1.14
log
@Delegation fixes, code cleaning
@
text
@d68 1
d75 4
d82 10
@


1.13
log
@Added forward decl support
@
text
@d23 1
a23 3
		new_fac = Factory()
		new_fac._this()
		return poa.servant_to_reference(new_fac)
d37 1
a37 3
		new_instance = Instance(fruit)
		new_instance._this()
		return poa.servant_to_reference(new_instance)
d76 1
a76 4

servant = Factory()
servant._this()
ref = poa.servant_to_reference(servant)
@


1.12
log
@Big process_idl.c update, misc small fixes
@
text
@d22 6
@


1.11
log
@Add configure script for those people who don't want to patch automake
@
text
@d69 3
@


1.10
log
@Added a test-suite demonstrating a bug with the sequence demarshalling
code (with ORBit >= 0.5.5).
@
text
@a4 1
import whrandom
@


1.9
log
@Removed thread test code from test-server
@
text
@d2 1
a2 1
import CORBA, PortableServer
d5 1
d67 2
a68 1

@


1.8
log
@Added interpreter unlocking to support threading
@
text
@a76 8
from threading import *
import time
def foo():
	for i in range(1,1000):
		print i
		time.sleep(1)
thread = Thread(None, foo)
thread.start()
@


1.7
log
@Fixed a bug in test-client
@
text
@d77 8
@


1.6
log
@Small cosmetic updates
@
text
@a58 1
		pick = 2
@


1.5
log
@Updated test suite for design changes
@
text
@d34 1
a34 1
		print new_instance._this().fruit
@


1.4
log
@
Plenty of bug/leak fixes, some feature additions, cleanups, etc.
@
text
@d4 1
d6 1
a6 1
class Instance:
d22 1
a22 1
class Factory:
d33 2
a34 2
		new_instance = POA.Fruit.Instance(Instance(fruit))
		poa.activate_object(new_instance)
d59 1
a68 2
CORBA.load_idl("test-suite.idl")
CORBA.load_idl("/usr/share/idl/name-service.idl")
d72 2
a73 2
servant = POA.Fruit.Factory(Factory())
poa.activate_object(servant)
d77 1
a77 1
poa.the_POAManager.activate()
@


1.3
log
@
Made CORBA.ORB_init more conformant
@
text
@d2 2
a3 1
import CORBA
a20 5
	def throw_out(self):
		print "Client threw me (%s) in garbage!" % self.fruit.name
		poa.deactivate_object(self._servant)


a28 1
				return
d36 4
d65 1
a65 1
		
d69 1
a69 1
orb = CORBA.ORB_init((), CORBA.ORB_ID)
@


1.2
log
@
resolve_initial_references handles RootPOA; cleaned exception handling by check_corba_ex
@
text
@d70 1
a70 1
orb = CORBA.ORB_init("orbit-local-orb")
@


1.1
log
@Initial revision
@
text
@d69 1
d71 1
a71 1
poa = PortableServer.RootPOA(orb)
@


1.1.1.1
log
@
Initial project import.
@
text
@@
