[Zope-CVS] CVS: Products/AdaptableStorage/tests - SerialTestBase.py:1.3 testASStorage.py:1.2 testSerialization.py:1.2 testZope2FS.py:1.4

Shane Hathaway shane@zope.com
Fri, 6 Dec 2002 17:07:22 -0500


Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv8198/tests

Modified Files:
	SerialTestBase.py testASStorage.py testSerialization.py 
	testZope2FS.py 
Log Message:
Experiment: removed mapper_name from OIDs, with the intent of allowing
loading and storage by different mappers depending on what the classifier
specifies.  Not yet complete.  Involved changes to virtually every module. :-)

I may decide to revert this.  The shane-before-mapper-name-removal tag
was added just before this checkin.


=== Products/AdaptableStorage/tests/SerialTestBase.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/tests/SerialTestBase.py:1.2	Wed Dec  4 23:18:09 2002
+++ Products/AdaptableStorage/tests/SerialTestBase.py	Fri Dec  6 17:06:51 2002
@@ -55,12 +55,15 @@
 class SerialTestBase:
 
     def setUp(self):
-        dm = sfw.DomainMapper(None)
-        self.dm = dm
+        ser2 = sfw.ObjectSerializer('Persistence', 'PersistentMapping')
+        fixed_items_aspect = FixedPersistentMapping({'TestRoot': ('test',)})
+        ser2.addAspect('fixed_items', fixed_items_aspect)
+        ser2.addAspect('roll_call', RollCall())
 
-        class_info = (('Persistence', 'PersistentMapping'), None)
+        root_mapper = sfw.ObjectMapper(None, ser2, sfw.ObjectGateway())
+        self.root_mapper = root_mapper
 
-        ser1 = sfw.ObjectSerializer(class_info)
+        ser1 = sfw.ObjectSerializer('Persistence', 'PersistentMapping')
         items_aspect = SimpleItemsAspect()
         ser1.addAspect('items', items_aspect)
         props_aspect = StringDataAttribute('strdata')
@@ -75,18 +78,9 @@
         self.props_gw = props_gw
         gw1.addGateway('properties', props_gw)
 
-        om1 = sfw.ObjectMapper(ser1, gw1, dm)
+        om1 = sfw.ObjectMapper(root_mapper, ser1, gw1)
         self.om1 = om1
-        dm.addMapper('test', om1)
-
-        ser2 = sfw.ObjectSerializer(class_info)
-        fixed_items_aspect = FixedPersistentMapping({'TestRoot': ('test', '')})
-        ser2.addAspect('fixed_items', fixed_items_aspect)
-        ser2.addAspect('roll_call', RollCall())
-
-        om2 = sfw.ObjectMapper(ser2, sfw.ObjectGateway(), dm)
-        self.om2 = om2
-        dm.addMapper('root', om2)
+        root_mapper.addSubMapper('test', om1)
 
     def tearDown(self):
         pass


=== Products/AdaptableStorage/tests/testASStorage.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/tests/testASStorage.py:1.1	Wed Nov 27 13:37:08 2002
+++ Products/AdaptableStorage/tests/testASStorage.py	Fri Dec  6 17:06:51 2002
@@ -31,7 +31,7 @@
 
     def setUp(self):
         SerialTestBase.setUp(self)
-        resource = StaticResource(self.dm)
+        resource = StaticResource(self.root_mapper)
         storage = ASStorage(resource)
         self.storage = storage
         db = ASDB(storage, resource)
@@ -53,7 +53,7 @@
         try:
 
             # Load the root and create a new object
-            root = conn1['root:']
+            root = conn1.root()
             get_transaction().begin()
             root['TestRoot'] = ob
             get_transaction().commit()


=== Products/AdaptableStorage/tests/testSerialization.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/tests/testSerialization.py:1.1	Wed Nov 27 13:37:08 2002
+++ Products/AdaptableStorage/tests/testSerialization.py	Fri Dec  6 17:06:51 2002
@@ -37,7 +37,7 @@
         ob['a'] = 'b'
         ob['c'] = 'd'
         kos = self.getKeyedObjectSystem()
-        mapper = self.dm.getMapper('test')
+        mapper = self.root_mapper.getSubMapper('test')
         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.dm.getMapper('test')
+        mapper = self.root_mapper.getSubMapper('test')
         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.dm.getMapper('test')
+        mapper = self.root_mapper.getSubMapper('test')
         self.assertRaises(sfw.SerializationError,
                           mapper.getSerializer().serialize, mapper,
                           '', ob, kos)


=== Products/AdaptableStorage/tests/testZope2FS.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.3	Thu Dec  5 12:38:47 2002
+++ Products/AdaptableStorage/tests/testZope2FS.py	Fri Dec  6 17:06:51 2002
@@ -27,7 +27,7 @@
 from Products.AdaptableStorage.zodb.ASDB import ASDB
 from Products.AdaptableStorage.zodb.ASStorage import ASStorage
 from Products.AdaptableStorage.zodb.StaticResource import StaticResource
-from Products.AdaptableStorage.Zope2FS import createDomainMapper
+from Products.AdaptableStorage.Zope2FS import createMapper
 
 
 class Zope2FSTests (unittest.TestCase):
@@ -36,7 +36,7 @@
         path = mktemp()
         os.mkdir(path)
         self.path = path
-        dm, fs_conn = createDomainMapper(path)
+        dm, fs_conn = createMapper(path)
         self.dm = dm
         self.fs_conn = fs_conn
         resource = StaticResource(dm)