[Zope-CVS] CVS: Products/AdaptableStorage/tests - testInterfaceImpl.py:1.3 testZope2FS.py:1.8

Shane Hathaway shane@zope.com
Mon, 23 Dec 2002 23:30:05 -0500


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

Modified Files:
	testInterfaceImpl.py testZope2FS.py 
Log Message:
Provided a way to configure ObjectMappers, with the intent of making
AdaptableStorage easier to explain.  Added IConfigurableObjectMapper
and converted all the mapper setup code to use it.  Included a
checkConfiguration() method which validates the entire object mapper
tree.  Then converted the DBTab-based configuration to use a mapper
factory, which can point to any mapper factory function installed
anywhere.  Tangents to this:

- Refactored Zope2FS and Zope2SQL to use the same code for setting up
mappers, leaving "holes" for the gateways.

- Added connect() and close() methods to ITPCConnection (which doesn't
technically exist yet since I need to choose a name for it. ;-) )

- Factored out common parts of the SQL gateways.

- Implemented the newKey() method of IKeyedObjectSystem, which will
help ZEO environments, in theory.



=== Products/AdaptableStorage/tests/testInterfaceImpl.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/tests/testInterfaceImpl.py:1.2	Mon Dec  9 13:25:29 2002
+++ Products/AdaptableStorage/tests/testInterfaceImpl.py	Mon Dec 23 23:29:34 2002
@@ -28,11 +28,7 @@
     def _testObjectImpl(self, c):
         try:
             impl = c.__implements__
-            if isinstance(impl, ListType) or isinstance(impl, TupleType):
-                for iface in impl:
-                    self._verify(iface, c)
-            else:
-                self._verify(impl, c)
+            self._verify(impl, c)
         except:
             print 'Bad implementation of', repr(c)
             raise
@@ -44,9 +40,13 @@
                 self._testObjectImpl(value)
 
     def _verify(self, iface, c):
-        verifyClass(iface, c)
-        for base in iface.getBases():
-            self._verify(base, c)
+        if isinstance(iface, ListType) or isinstance(iface, TupleType):
+            for item in iface:
+                self._verify(item, c)
+        else:
+            verifyClass(iface, c)
+            for base in iface.getBases():
+                self._verify(base, c)
 
     def testSerialPublicImplementations(self):
         from Products.AdaptableStorage.serial import public
@@ -62,6 +62,10 @@
 
     def testGatewayFSImplementations(self):
         from Products.AdaptableStorage.gateway_fs import public
+        self._testAllInModule(public)
+
+    def testZODBImplementations(self):
+        from Products.AdaptableStorage.zodb import public
         self._testAllInModule(public)
 
 if __name__ == '__main__':


=== Products/AdaptableStorage/tests/testZope2FS.py 1.7 => 1.8 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.7	Mon Dec  9 17:11:07 2002
+++ Products/AdaptableStorage/tests/testZope2FS.py	Mon Dec 23 23:29:34 2002
@@ -54,11 +54,12 @@
         path = mktemp()
         os.mkdir(path)
         self.path = path
-        dm, fs_conn = createMapper(path)
+        dm, conns = createMapper(path)
         self.dm = dm
-        self.fs_conn = fs_conn
+        assert len(conns) == 1
+        self.conn = conns[0]
         resource = StaticResource(dm)
-        storage = ASStorage(resource, [fs_conn])
+        storage = ASStorage(resource, conns)
         self.storage = storage
         db = ASDB(storage, resource)
         self.db = db
@@ -130,7 +131,7 @@
             for folder in (f, f2, f3):
                 keychain = conn.db()._oid_encoder.decode(folder._p_oid)
                 key = keychain[-1]
-                text = self.fs_conn.readSection(key, 'classification')
+                text = self.conn.readSection(key, 'classification')
                 self.assert_(text.find('meta_type=Folder') >= 0)
         finally:
             conn.close()