[Zope-CVS] CVS: Products/AdaptableStorage/tests - SerialTestBase.py:1.4 testASStorage.py:1.3 testSerialization.py:1.3 testZope2FS.py:1.5
Shane Hathaway
shane@zope.com
Sat, 7 Dec 2002 00:59:15 -0500
Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv21888/tests
Modified Files:
SerialTestBase.py testASStorage.py testSerialization.py
testZope2FS.py
Log Message:
Fixed the bugs in the new strategy (OIDs no longer include mapper_names,
allowing more flexibility in loading and storage). Did not resolve new
key generation yet, but everything else seems to be in good shape.
=== Products/AdaptableStorage/tests/SerialTestBase.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/tests/SerialTestBase.py:1.3 Fri Dec 6 17:06:51 2002
+++ Products/AdaptableStorage/tests/SerialTestBase.py Sat Dec 7 00:59:14 2002
@@ -22,7 +22,8 @@
from Products.AdaptableStorage.serial import public as sfw
from Products.AdaptableStorage.serial_std.public import \
- StringDataAttribute, MappingGateway, FixedPersistentMapping, RollCall
+ StringDataAttribute, MappingGateway, FixedPersistentMapping, RollCall, \
+ FixedClassifier
class SimpleItemsAspect:
@@ -55,12 +56,17 @@
class SerialTestBase:
def setUp(self):
+ classifier = FixedClassifier()
+ classifier.register('test', 'test_mapper')
+
ser2 = sfw.ObjectSerializer('Persistence', 'PersistentMapping')
- fixed_items_aspect = FixedPersistentMapping({'TestRoot': ('test',)})
+ fixed_items_aspect = FixedPersistentMapping()
+ fixed_items_aspect.add('TestRoot', ('test',), ('test_mapper',))
ser2.addAspect('fixed_items', fixed_items_aspect)
ser2.addAspect('roll_call', RollCall())
- root_mapper = sfw.ObjectMapper(None, ser2, sfw.ObjectGateway())
+ root_mapper = sfw.ObjectMapper(None, ser2, sfw.ObjectGateway(),
+ classifier)
self.root_mapper = root_mapper
ser1 = sfw.ObjectSerializer('Persistence', 'PersistentMapping')
@@ -80,7 +86,7 @@
om1 = sfw.ObjectMapper(root_mapper, ser1, gw1)
self.om1 = om1
- root_mapper.addSubMapper('test', om1)
+ root_mapper.addSubMapper('test_mapper', om1)
def tearDown(self):
pass
=== Products/AdaptableStorage/tests/testASStorage.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/tests/testASStorage.py:1.2 Fri Dec 6 17:06:51 2002
+++ Products/AdaptableStorage/tests/testASStorage.py Sat Dec 7 00:59:14 2002
@@ -57,14 +57,14 @@
get_transaction().begin()
root['TestRoot'] = ob
get_transaction().commit()
- ob1 = conn1['test:']
+ ob1 = conn1.loadStub(('test',))
self.assertEqual(ob1.strdata, ob.strdata)
self.assertEqual(ob1.items(), ob.items())
# Verify a new object was stored and make a change
get_transaction().begin()
conn2 = self.db.open()
- ob2 = conn2['test:']
+ ob2 = conn2.loadStub(('test',))
self.assertEqual(ob2.strdata, ob.strdata)
self.assertEqual(ob2.items(), ob.items())
ob2.strdata = '678'
@@ -72,7 +72,7 @@
# Verify the change was stored and make another change
conn3 = self.db.open()
- ob3 = conn3['test:']
+ ob3 = conn3.loadStub(('test',))
self.assertEqual(ob3.strdata, '678')
self.assertEqual(ob3.items(), ob.items())
ob3.strdata = '901'
@@ -80,7 +80,7 @@
conn3.close()
conn3 = None
conn3 = self.db.open()
- ob3 = conn3['test:']
+ ob3 = conn3.loadStub(('test',))
self.assertEqual(ob3.strdata, '901')
# Verify we didn't accidentally change the original object
=== Products/AdaptableStorage/tests/testSerialization.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/tests/testSerialization.py:1.2 Fri Dec 6 17:06:51 2002
+++ Products/AdaptableStorage/tests/testSerialization.py Sat Dec 7 00:59:14 2002
@@ -37,7 +37,7 @@
ob['a'] = 'b'
ob['c'] = 'd'
kos = self.getKeyedObjectSystem()
- mapper = self.root_mapper.getSubMapper('test')
+ mapper = self.root_mapper.getSubMapper('test_mapper')
full_state, refs = mapper.getSerializer().serialize(
mapper, '', ob, kos)
ob2 = PersistentMapping()
@@ -51,7 +51,7 @@
ob['a'] = 'b'
ob['c'] = 'd'
kos = self.getKeyedObjectSystem()
- mapper = self.root_mapper.getSubMapper('test')
+ mapper = self.root_mapper.getSubMapper('test_mapper')
full_state, refs = mapper.getSerializer().serialize(
mapper, '', ob, kos)
mapper.getGateway().store(mapper, '', full_state)
@@ -68,7 +68,7 @@
ob['a'] = 'b'
ob['c'] = 'd'
kos = self.getKeyedObjectSystem()
- mapper = self.root_mapper.getSubMapper('test')
+ mapper = self.root_mapper.getSubMapper('test_mapper')
self.assertRaises(sfw.SerializationError,
mapper.getSerializer().serialize, mapper,
'', ob, kos)
=== Products/AdaptableStorage/tests/testZope2FS.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.4 Fri Dec 6 17:06:51 2002
+++ Products/AdaptableStorage/tests/testZope2FS.py Sat Dec 7 00:59:14 2002
@@ -112,7 +112,8 @@
get_transaction().commit()
for folder in (f, f2, f3):
- mapper, key = conn.getOIDInfo(folder._p_oid)
+ keychain = conn.db()._oid_encoder.decode(folder._p_oid)
+ key = keychain[-1]
text = self.fs_conn.readSection(key, 'classification')
self.assertEqual(text.strip(), 'meta_type=Folder')
finally: