Exemplo n.º 1
0
    def testGetChildren(self):
        """ Tests the normal behavior of the getChildren method. """

        adapter = DataWebdavAdapter(
            "/identifier", SimpleMock(), SimpleMock("/Path"),
            SimpleMock(_VALID_GETCHILDREN_WEBDAV_RESULT))
        self.assertEquals(adapter.getChildren(), _VALID_GETCHILDREN_RESULT)
Exemplo n.º 2
0
    def setUp(self):
        """ Creates default adapter usable by test cases. """

        self._defaultAdapter = DataWebdavAdapter("/path/identifier",
                                                 SimpleMock(),
                                                 SimpleMock("identifier"),
                                                 SimpleMock(SimpleMock()))
Exemplo n.º 3
0
 def testExists(self):
     """ Tests the normal behavior of the exists method. """
     
     adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(SimpleMock()))
     self.assertTrue(adapter.exists())
     adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(error=WebdavError("", 404)))
     self.assertFalse(adapter.exists())
     adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(error=WebdavError("")))
     self.assertRaises(PersistenceError, adapter.exists)
Exemplo n.º 4
0
    def testIsLink(self):
        """ Tests the normal behavior of the isLink method. """

        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertTrue(adapter.isLink)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertFalse(adapter.isLink)
Exemplo n.º 5
0
    def testLinkTarget(self):
        """ Tests the link target property. """

        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertEquals(adapter.linkTarget, "/thelinkTargetPath")
        self.assertTrue(adapter.isLink)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertEquals(adapter.linkTarget, None)
        self.assertFalse(adapter.isLink)
Exemplo n.º 6
0
    def testIsCollection(self):
        """ Tests the normal behavior of the isCollection method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (True, None)}))
        self.assertTrue(adapter.isCollection)
        self.assertTrue(adapter.canAddChildren)
        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertFalse(adapter.isCollection)
        self.assertFalse(adapter.canAddChildren)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertFalse(adapter.isCollection)
        self.assertFalse(adapter.canAddChildren)
Exemplo n.º 7
0
    def testErrorHandlingOnLibraryInstanceCreation(self):
        """ Tests the error handling when creating concrete library instances. """

        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock("anotherIdentifier"),
                                    SimpleMock(error=PersistenceError("")))
        try:
            self.assertFalse(adapter.isLink)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isLeaf)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isCollection)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        self.assertRaises(PersistenceError, adapter.createLink,
                          self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.createResource)
        self.assertRaises(PersistenceError, adapter.createCollection)
        self.assertRaises(PersistenceError, adapter.getChildren)
        self.assertRaises(PersistenceError, adapter.writeData, StringIO(""))
        self.assertRaises(PersistenceError, adapter.readData)
        self.assertRaises(PersistenceError, adapter.delete)
        self.assertRaises(PersistenceError, adapter.move, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.copy, self._defaultAdapter)
Exemplo n.º 8
0
    def testCreateResource(self):
        """ Tests the normal behavior of the createResource method. """

        self._defaultAdapter.createResource()
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(""),
                                    SimpleMock(SimpleMock()))
        self.assertRaises(PersistenceError, adapter.createResource)
Exemplo n.º 9
0
    def testExists(self):
        """ Tests the normal behavior of the exists method. """

        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(), SimpleMock(SimpleMock()))
        self.assertTrue(adapter.exists())
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(),
                                    SimpleMock(error=WebdavError("", 404)))
        self.assertFalse(adapter.exists())
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(),
                                    SimpleMock(error=WebdavError("")))
        self.assertRaises(PersistenceError, adapter.exists)
Exemplo n.º 10
0
    def createDataStorer(self, identifier):
        """ 
        Factory Method providing a WebDAV-specific data storer. 
        
        @return: WebDAV-specific implementation of the data interface.
        @rtype: L{DataWebdavAdapter<datafinder.persistence.adapters.webdav_.
        data.adapter.DataWebdavAdapter>
        """

        return DataWebdavAdapter(identifier,
                                 self._connectionPool,
                                 ItemIdentifierMapper(
                                     self._configuration.baseUrl),
                                 resourceTypeCache=self._resourceTypeCache)
Exemplo n.º 11
0
    def testErrorHandlingUsingLibraryInstances(self):
        """ Tests the error handling when using concrete library instances. """

        connectionHelperMock = SimpleMock(methodNameResultMap={
            "determineResourceType": (None, WebdavError(""))
        })
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(""), connectionHelperMock)
        try:
            self.assertFalse(adapter.isLink)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isLeaf)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isCollection)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        self.assertRaises(PersistenceError, adapter.getChildren)

        connectionHelperMock = SimpleMock(SimpleMock(error=WebdavError("")))
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(""), connectionHelperMock)
        self.assertRaises(PersistenceError, adapter.createLink,
                          self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.createResource)
        self.assertRaises(PersistenceError, adapter.createCollection)
        self.assertRaises(PersistenceError, adapter.writeData, StringIO(""))
        self.assertRaises(PersistenceError, adapter.readData)
        self.assertRaises(PersistenceError, adapter.delete)
        self.assertRaises(PersistenceError, adapter.move, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.copy, self._defaultAdapter)
Exemplo n.º 12
0
    def testReadData(self):
        """ Tests the normal behavior of the readData method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock(SimpleMock(StringIO(""))))
        self.assertTrue(isinstance(adapter.readData(), StringIO))
Exemplo n.º 13
0
    def testGetChildren(self):
        """ Tests the normal behavior of the getChildren method. """

        adapter = DataWebdavAdapter("/identifier", SimpleMock(), SimpleMock("/Path"), 
                                    SimpleMock(_VALID_GETCHILDREN_WEBDAV_RESULT))
        self.assertEquals(adapter.getChildren(), _VALID_GETCHILDREN_RESULT)
Exemplo n.º 14
0
    def testCopy(self):
        """ Tests the normal behavior of the copy method. """

        destination = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                        SimpleMock(), SimpleMock(SimpleMock()))
        self._defaultAdapter.copy(destination)
Exemplo n.º 15
0
    def testReadData(self):
        """ Tests the normal behavior of the readData method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock(SimpleMock(StringIO(""))))
        self.assertTrue(isinstance(adapter.readData(), StringIO))
Exemplo n.º 16
0
class DataWebdavAdapterTestCase(unittest.TestCase):
    """ Tests the data adapter implementation. """
    
    def setUp(self):
        """ Creates default adapter usable by test cases. """
        
        self._defaultAdapter = DataWebdavAdapter("/path/identifier", SimpleMock(), SimpleMock("identifier"), SimpleMock(SimpleMock()))
        
    def testLinkTarget(self):
        """ Tests the link target property. """
        
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, "/thelinkTargetPath")}))
        self.assertEquals(adapter.linkTarget, "/thelinkTargetPath")
        self.assertTrue(adapter.isLink)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, None)}))
        self.assertEquals(adapter.linkTarget, None)
        self.assertFalse(adapter.isLink)

    def testIsLink(self):
        """ Tests the normal behavior of the isLink method. """
        
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, "/thelinkTargetPath")}))
        self.assertTrue(adapter.isLink)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, None)}))
        self.assertFalse(adapter.isLink)

    def testIsLeaf(self):
        """ Tests the normal behavior of the isLeaf method. """
        
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(True, None)}))
        self.assertFalse(adapter.isLeaf)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, "/thelinkTargetPath")}))
        self.assertFalse(adapter.isLeaf)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, None)}))
        self.assertTrue(adapter.isLeaf)
        
    def testIsCollection(self):
        """ Tests the normal behavior of the isCollection method. """
        
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(True, None)}))
        self.assertTrue(adapter.isCollection)
        self.assertTrue(adapter.canAddChildren)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, "/thelinkTargetPath")}))
        self.assertFalse(adapter.isCollection)
        self.assertFalse(adapter.canAddChildren)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock({"/":(False, None)}))
        self.assertFalse(adapter.isCollection)
        self.assertFalse(adapter.canAddChildren)
    
    def testCreateResource(self):
        """ Tests the normal behavior of the createResource method. """

        self._defaultAdapter.createResource()
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(""), SimpleMock(SimpleMock()))
        self.assertRaises(PersistenceError, adapter.createResource)
        
    def testCreateLink(self):
        """ Tests the normal behavior of the createLink method. """

        self._defaultAdapter.createLink(self._defaultAdapter)
        
    def testCreateCollection(self):
        """ Tests the normal behavior of the createCollection method. """

        self._defaultAdapter.createCollection()
        self._defaultAdapter.createCollection(True)
        
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(""), SimpleMock(SimpleMock()))
        self.assertRaises(PersistenceError, adapter.createCollection)
 
    def testGetChildren(self):
        """ Tests the normal behavior of the getChildren method. """

        adapter = DataWebdavAdapter("/identifier", SimpleMock(), SimpleMock("/Path"), 
                                    SimpleMock(_VALID_GETCHILDREN_WEBDAV_RESULT))
        self.assertEquals(adapter.getChildren(), _VALID_GETCHILDREN_RESULT)
        
    def testWriteData(self):
        """ Tests the normal behavior of the writeData method. """

        self._defaultAdapter.writeData(StringIO(""))
        
    def testReadData(self):
        """ Tests the normal behavior of the readData method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(), SimpleMock(SimpleMock(StringIO(""))))
        self.assertTrue(isinstance(adapter.readData(), StringIO))
        
    def testDelete(self):
        """ Tests the normal behavior of the delete method. """
        
        self._defaultAdapter.delete()

    def testMove(self):
        """ Tests the normal behavior of the move method. """
        
        destination = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(SimpleMock()))
        self._defaultAdapter.move(destination)
    
    def testCopy(self):
        """ Tests the normal behavior of the copy method. """
        
        destination = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(SimpleMock()))
        self._defaultAdapter.copy(destination)
        
    def testExists(self):
        """ Tests the normal behavior of the exists method. """
        
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(SimpleMock()))
        self.assertTrue(adapter.exists())
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(error=WebdavError("", 404)))
        self.assertFalse(adapter.exists())
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(), SimpleMock(error=WebdavError("")))
        self.assertRaises(PersistenceError, adapter.exists)

    def testErrorHandlingOnLibraryInstanceCreation(self):
        """ Tests the error handling when creating concrete library instances. """

        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock("anotherIdentifier"), 
                                    SimpleMock(error=PersistenceError("")))
        try:
            self.assertFalse(adapter.isLink)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isLeaf)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isCollection)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        self.assertRaises(PersistenceError, adapter.createLink, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.createResource)
        self.assertRaises(PersistenceError, adapter.createCollection)
        self.assertRaises(PersistenceError, adapter.getChildren)
        self.assertRaises(PersistenceError, adapter.writeData, StringIO(""))
        self.assertRaises(PersistenceError, adapter.readData)
        self.assertRaises(PersistenceError, adapter.delete)
        self.assertRaises(PersistenceError, adapter.move, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.copy, self._defaultAdapter)

    def testErrorHandlingUsingLibraryInstances(self):
        """ Tests the error handling when using concrete library instances. """

        connectionHelperMock = SimpleMock(methodNameResultMap={"determineResourceType": (None, WebdavError(""))})
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(""), connectionHelperMock)
        try:
            self.assertFalse(adapter.isLink)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isLeaf)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isCollection)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        self.assertRaises(PersistenceError, adapter.getChildren)
        
        connectionHelperMock = SimpleMock(SimpleMock(error=WebdavError("")))
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(), SimpleMock(""), connectionHelperMock)
        self.assertRaises(PersistenceError, adapter.createLink, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.createResource)
        self.assertRaises(PersistenceError, adapter.createCollection)
        self.assertRaises(PersistenceError, adapter.writeData, StringIO(""))
        self.assertRaises(PersistenceError, adapter.readData)
        self.assertRaises(PersistenceError, adapter.delete)
        self.assertRaises(PersistenceError, adapter.move, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.copy, self._defaultAdapter)
Exemplo n.º 17
0
 def setUp(self):
     """ Creates default adapter usable by test cases. """
     
     self._defaultAdapter = DataWebdavAdapter("/path/identifier", SimpleMock(), SimpleMock("identifier"), SimpleMock(SimpleMock()))
Exemplo n.º 18
0
class DataWebdavAdapterTestCase(unittest.TestCase):
    """ Tests the data adapter implementation. """
    def setUp(self):
        """ Creates default adapter usable by test cases. """

        self._defaultAdapter = DataWebdavAdapter("/path/identifier",
                                                 SimpleMock(),
                                                 SimpleMock("identifier"),
                                                 SimpleMock(SimpleMock()))

    def testLinkTarget(self):
        """ Tests the link target property. """

        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertEquals(adapter.linkTarget, "/thelinkTargetPath")
        self.assertTrue(adapter.isLink)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertEquals(adapter.linkTarget, None)
        self.assertFalse(adapter.isLink)

    def testIsLink(self):
        """ Tests the normal behavior of the isLink method. """

        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertTrue(adapter.isLink)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertFalse(adapter.isLink)

    def testIsLeaf(self):
        """ Tests the normal behavior of the isLeaf method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (True, None)}))
        self.assertFalse(adapter.isLeaf)
        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertFalse(adapter.isLeaf)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertTrue(adapter.isLeaf)

    def testIsCollection(self):
        """ Tests the normal behavior of the isCollection method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (True, None)}))
        self.assertTrue(adapter.isCollection)
        self.assertTrue(adapter.canAddChildren)
        adapter = DataWebdavAdapter(
            "identifier", SimpleMock(), SimpleMock(),
            SimpleMock({"/": (False, "/thelinkTargetPath")}))
        self.assertFalse(adapter.isCollection)
        self.assertFalse(adapter.canAddChildren)
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock({"/": (False, None)}))
        self.assertFalse(adapter.isCollection)
        self.assertFalse(adapter.canAddChildren)

    def testCreateResource(self):
        """ Tests the normal behavior of the createResource method. """

        self._defaultAdapter.createResource()
        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(""),
                                    SimpleMock(SimpleMock()))
        self.assertRaises(PersistenceError, adapter.createResource)

    def testCreateLink(self):
        """ Tests the normal behavior of the createLink method. """

        self._defaultAdapter.createLink(self._defaultAdapter)

    def testCreateCollection(self):
        """ Tests the normal behavior of the createCollection method. """

        self._defaultAdapter.createCollection()
        self._defaultAdapter.createCollection(True)

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(""),
                                    SimpleMock(SimpleMock()))
        self.assertRaises(PersistenceError, adapter.createCollection)

    def testGetChildren(self):
        """ Tests the normal behavior of the getChildren method. """

        adapter = DataWebdavAdapter(
            "/identifier", SimpleMock(), SimpleMock("/Path"),
            SimpleMock(_VALID_GETCHILDREN_WEBDAV_RESULT))
        self.assertEquals(adapter.getChildren(), _VALID_GETCHILDREN_RESULT)

    def testWriteData(self):
        """ Tests the normal behavior of the writeData method. """

        self._defaultAdapter.writeData(StringIO(""))

    def testReadData(self):
        """ Tests the normal behavior of the readData method. """

        adapter = DataWebdavAdapter("identifier", SimpleMock(), SimpleMock(),
                                    SimpleMock(SimpleMock(StringIO(""))))
        self.assertTrue(isinstance(adapter.readData(), StringIO))

    def testDelete(self):
        """ Tests the normal behavior of the delete method. """

        self._defaultAdapter.delete()

    def testMove(self):
        """ Tests the normal behavior of the move method. """

        destination = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                        SimpleMock(), SimpleMock(SimpleMock()))
        self._defaultAdapter.move(destination)

    def testCopy(self):
        """ Tests the normal behavior of the copy method. """

        destination = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                        SimpleMock(), SimpleMock(SimpleMock()))
        self._defaultAdapter.copy(destination)

    def testExists(self):
        """ Tests the normal behavior of the exists method. """

        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(), SimpleMock(SimpleMock()))
        self.assertTrue(adapter.exists())
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(),
                                    SimpleMock(error=WebdavError("", 404)))
        self.assertFalse(adapter.exists())
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(),
                                    SimpleMock(error=WebdavError("")))
        self.assertRaises(PersistenceError, adapter.exists)

    def testErrorHandlingOnLibraryInstanceCreation(self):
        """ Tests the error handling when creating concrete library instances. """

        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock("anotherIdentifier"),
                                    SimpleMock(error=PersistenceError("")))
        try:
            self.assertFalse(adapter.isLink)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isLeaf)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isCollection)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        self.assertRaises(PersistenceError, adapter.createLink,
                          self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.createResource)
        self.assertRaises(PersistenceError, adapter.createCollection)
        self.assertRaises(PersistenceError, adapter.getChildren)
        self.assertRaises(PersistenceError, adapter.writeData, StringIO(""))
        self.assertRaises(PersistenceError, adapter.readData)
        self.assertRaises(PersistenceError, adapter.delete)
        self.assertRaises(PersistenceError, adapter.move, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.copy, self._defaultAdapter)

    def testErrorHandlingUsingLibraryInstances(self):
        """ Tests the error handling when using concrete library instances. """

        connectionHelperMock = SimpleMock(methodNameResultMap={
            "determineResourceType": (None, WebdavError(""))
        })
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(""), connectionHelperMock)
        try:
            self.assertFalse(adapter.isLink)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isLeaf)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        try:
            self.assertFalse(adapter.isCollection)
            self.fail("PersistenceError not raised.")
        except PersistenceError:
            self.assertTrue(True)
        self.assertRaises(PersistenceError, adapter.getChildren)

        connectionHelperMock = SimpleMock(SimpleMock(error=WebdavError("")))
        adapter = DataWebdavAdapter("/anotherIdentifier", SimpleMock(),
                                    SimpleMock(""), connectionHelperMock)
        self.assertRaises(PersistenceError, adapter.createLink,
                          self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.createResource)
        self.assertRaises(PersistenceError, adapter.createCollection)
        self.assertRaises(PersistenceError, adapter.writeData, StringIO(""))
        self.assertRaises(PersistenceError, adapter.readData)
        self.assertRaises(PersistenceError, adapter.delete)
        self.assertRaises(PersistenceError, adapter.move, self._defaultAdapter)
        self.assertRaises(PersistenceError, adapter.copy, self._defaultAdapter)