[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - serialtestbase.py:1.2 testserialization.py:1.2 teststorage.py:1.2 testzope2fs.py:1.2 testzope2sql.py:1.3
Shane Hathaway
shane@zope.com
Tue, 29 Apr 2003 18:12:22 -0400
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv9561/tests
Modified Files:
serialtestbase.py testserialization.py teststorage.py
testzope2fs.py testzope2sql.py
Log Message:
- Added IGatewayEvent, the base interface for ILoadEvent and
IStoreEvent.
- Filesystem gateways no longer refer directly to a connection. They
get the connection from the event. This is to permit replacing the
connection with a zip/tar file reader/writer or some other interesting
thing.
- Added checkConnection() to gateways for checking the connection
configuration early.
- Added ConfigurationError and changed some places that were raising
RuntimeError to raise ConfigurationError instead.
- Changed some calls to getKeyChain()[-1] to simply getKey()
- Updated module import style in some places
- Various other style improvements
=== Products/Ape/lib/apelib/tests/serialtestbase.py 1.1 => 1.2 ===
--- Products/Ape/lib/apelib/tests/serialtestbase.py:1.1 Wed Apr 9 23:09:57 2003
+++ Products/Ape/lib/apelib/tests/serialtestbase.py Tue Apr 29 18:11:51 2003
@@ -63,6 +63,8 @@
class SerialTestBase:
def setUp(self):
+ self.conns = {}
+
classifier = FixedClassifier()
classifier.register('test', 'test_mapper')
classifier.register('test2', 'test_mapper_2')
@@ -74,8 +76,7 @@
ser2.addSerializer('fixed_items', fixed_items_serializer)
ser2.addSerializer('roll_call', RollCall())
- root_mapper = Mapper(None, ser2, CompositeGateway(),
- classifier)
+ root_mapper = Mapper(None, ser2, CompositeGateway(), classifier)
self.root_mapper = root_mapper
# Create "test_mapper", which allows a "strdata" attribute.
=== Products/Ape/lib/apelib/tests/testserialization.py 1.1 => 1.2 ===
--- Products/Ape/lib/apelib/tests/testserialization.py:1.1 Wed Apr 9 23:09:57 2003
+++ Products/Ape/lib/apelib/tests/testserialization.py Tue Apr 29 18:11:51 2003
@@ -63,10 +63,10 @@
mapper = self.root_mapper.getSubMapper('test_mapper')
event = SerializationEvent(kos, mapper, ('',), ob)
full_state = mapper.getSerializer().serialize(ob, event)
- event = StoreEvent(mapper, ('',))
+ event = StoreEvent(mapper, ('',), self.conns)
mapper.getGateway().store(event, full_state)
- event = LoadEvent(mapper, ('',))
+ event = LoadEvent(mapper, ('',), self.conns)
full_state, serial = mapper.getGateway().load(event)
ob2 = PersistentMapping()
event = DeserializationEvent(kos, mapper, ('',), ob2)
@@ -97,11 +97,11 @@
mapper = self.root_mapper.getSubMapper('test_mapper_2')
event = SerializationEvent(kos, mapper, ('',), ob)
full_state = mapper.getSerializer().serialize(ob, event)
- event = StoreEvent(mapper, ('',))
+ event = StoreEvent(mapper, ('',), self.conns)
mapper.getGateway().store(event, full_state)
# Now load the state into a different object
- event = LoadEvent(mapper, ('',))
+ event = LoadEvent(mapper, ('',), self.conns)
full_state, serial = mapper.getGateway().load(event)
ob2 = PersistentMapping()
event = DeserializationEvent(kos, mapper, ('',), ob2)
=== Products/Ape/lib/apelib/tests/teststorage.py 1.1 => 1.2 ===
--- Products/Ape/lib/apelib/tests/teststorage.py:1.1 Wed Apr 9 23:09:57 2003
+++ Products/Ape/lib/apelib/tests/teststorage.py Tue Apr 29 18:11:51 2003
@@ -49,7 +49,7 @@
def setUp(self):
SerialTestBase.setUp(self)
resource = StaticResource(self.root_mapper)
- storage = ApeStorage(resource)
+ storage = ApeStorage(resource, self.conns)
self.storage = storage
db = ApeDB(storage, resource)
self.db = db
=== Products/Ape/lib/apelib/tests/testzope2fs.py 1.1 => 1.2 ===
--- Products/Ape/lib/apelib/tests/testzope2fs.py:1.1 Wed Apr 9 23:09:57 2003
+++ Products/Ape/lib/apelib/tests/testzope2fs.py Tue Apr 29 18:11:51 2003
@@ -56,7 +56,7 @@
dm, conns = self._createMapper(tmpdir)
self.dm = dm
assert len(conns) == 1
- self.conn = conns[0]
+ self.conn = conns['fs']
resource = StaticResource(dm)
storage = ApeStorage(resource, conns)
self.storage = storage
=== Products/Ape/lib/apelib/tests/testzope2sql.py 1.2 => 1.3 ===
--- Products/Ape/lib/apelib/tests/testzope2sql.py:1.2 Sat Apr 12 16:56:26 2003
+++ Products/Ape/lib/apelib/tests/testzope2sql.py Tue Apr 29 18:11:51 2003
@@ -53,7 +53,7 @@
for gw in self.gws:
if hasattr(gw, 'clear'):
gw.clear()
- for conn in self.conns:
+ for conn in self.conns.values():
conn.db.commit()
def tearDown(self):