Class SerializationTest

  • All Implemented Interfaces:
    junit.framework.Test

    public class SerializationTest
    extends AbstractJCRTest
    SerializationTest contains the test cases for the method Workspace.exportSysView() and Session.importSysView().

    This class exports and re-imports the repository. The tests check for differences between the original and the re-imported repository.

    • Constructor Detail

      • SerializationTest

        public SerializationTest()
    • Method Detail

      • doTestVersioningExceptionFileParent

        public void doTestVersioningExceptionFileParent​(boolean useWorkspace,
                                                        boolean useHandler)
                                                 throws Exception
        Throws:
        Exception
      • doTestVersioningExceptionFileChild

        public void doTestVersioningExceptionFileChild​(boolean useWorkspace,
                                                       boolean useHandler)
                                                throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileParentWorkspaceContentHandler

        public void testVersioningExceptionFileParentWorkspaceContentHandler()
                                                                      throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileParentSessionContentHandler

        public void testVersioningExceptionFileParentSessionContentHandler()
                                                                    throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileParentWorkspace

        public void testVersioningExceptionFileParentWorkspace()
                                                        throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileParentSession

        public void testVersioningExceptionFileParentSession()
                                                      throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileChildWorkspaceContentHandler

        public void testVersioningExceptionFileChildWorkspaceContentHandler()
                                                                     throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileChildSessionContentHandler

        public void testVersioningExceptionFileChildSessionContentHandler()
                                                                   throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileChildWorkspace

        public void testVersioningExceptionFileChildWorkspace()
                                                       throws Exception
        Throws:
        Exception
      • testVersioningExceptionFileChildSession

        public void testVersioningExceptionFileChildSession()
                                                     throws Exception
        Throws:
        Exception
      • doTestLockException

        public void doTestLockException​(boolean useWorkspace,
                                        boolean useHandler)
                                 throws Exception
        Tests whether importing a tree respects locking.
        Throws:
        Exception
      • testLockExceptionWorkspaceWithHandler

        public void testLockExceptionWorkspaceWithHandler()
                                                   throws Exception
        Throws:
        Exception
      • testLockExceptionSessionWithHandler

        public void testLockExceptionSessionWithHandler()
                                                 throws Exception
        Throws:
        Exception
      • testLockExceptionWorkspace

        public void testLockExceptionWorkspace()
                                        throws Exception
        Throws:
        Exception
      • testLockExceptionSession

        public void testLockExceptionSession()
                                      throws Exception
        Throws:
        Exception
      • testInvalidXmlThrowsInvalidSerializedDataException

        public void testInvalidXmlThrowsInvalidSerializedDataException()
                                                                throws RepositoryException,
                                                                       IOException
        Tests whether importing an invalid XML file throws a InvalidSerializedDataException. The file used here is more or less garbage.
        Throws:
        RepositoryException
        IOException
      • testWorkspaceGetImportContentHandlerExceptions

        public void testWorkspaceGetImportContentHandlerExceptions()
                                                            throws RepositoryException
        Supplying an invalid repository path for import must throw a PathNotFoundException
        Throws:
        RepositoryException
      • testSessionGetImportContentHandlerExceptions

        public void testSessionGetImportContentHandlerExceptions()
                                                          throws RepositoryException
        Supplying an invalid repository path for import must throw a PathNotFoundException
        Throws:
        RepositoryException
      • doTestOverwriteException

        public void doTestOverwriteException​(boolean useWorkspace,
                                             boolean useHandler)
                                      throws Exception
        Tries to overwrite an existing node. This only works for nodes that do not allow same-name siblings.
        Throws:
        Exception
      • testOverwriteExceptionWorkspaceWithHandler

        public void testOverwriteExceptionWorkspaceWithHandler()
                                                        throws Exception
        Throws:
        Exception
      • testOverwriteExceptionSessionWithHandler

        public void testOverwriteExceptionSessionWithHandler()
                                                      throws Exception
        Throws:
        Exception
      • testOverwriteExceptionWorkspace

        public void testOverwriteExceptionWorkspace()
                                             throws Exception
        Throws:
        Exception
      • testOverwriteExceptionSession

        public void testOverwriteExceptionSession()
                                           throws Exception
        Throws:
        Exception
      • doTestNodeTypeConstraintViolation

        public void doTestNodeTypeConstraintViolation​(boolean useWorkspace,
                                                      boolean useHandler)
                                               throws Exception
        Create a node named ntBase with node type nt:base and creates a tree in the repository which will be exported and reimported below the node ntBase.
        Parameters:
        useWorkspace -
        useHandler -
        Throws:
        RepositoryException
        FileNotFoundException
        IOException
        Exception
      • testNodeTypeConstraintViolationWorkspaceWithHandler

        public void testNodeTypeConstraintViolationWorkspaceWithHandler()
                                                                 throws Exception
        Throws:
        Exception
      • testNodeTypeConstraintViolationSessionWithHandler

        public void testNodeTypeConstraintViolationSessionWithHandler()
                                                               throws Exception
        Throws:
        Exception
      • testNodeTypeConstraintViolationWorkspace

        public void testNodeTypeConstraintViolationWorkspace()
                                                      throws Exception
        Throws:
        Exception
      • testNodeTypeConstraintViolationSession

        public void testNodeTypeConstraintViolationSession()
                                                    throws Exception
        Throws:
        Exception
      • testSessionGetContentHandler

        public void testSessionGetContentHandler()
                                          throws Exception
        Makes sure that importing into the session does not save anything if the session is closed.
        Throws:
        Exception
      • doImport

        public void doImport​(String absPath,
                             FileInputStream in,
                             boolean useWorkspace,
                             boolean useHandler)
                      throws Exception
        Helper method which imports the given FileInputStream using Workspace or Session and via the methods importXML respective getImportContentHandler. The target node of the import is specified with its absolute path.
        Parameters:
        absPath -
        in -
        useWorkspace -
        useHandler -
        Throws:
        RepositoryException
        IOException
        Exception
      • testExportSysView_stream_workspace_skipBinary_noRecurse

        public void testExportSysView_stream_workspace_skipBinary_noRecurse()
                                                                     throws Exception
        Throws:
        Exception
      • testExportSysView_stream_workspace_skipBinary_recurse

        public void testExportSysView_stream_workspace_skipBinary_recurse()
                                                                   throws Exception
        Throws:
        Exception
      • testExportSysView_stream_workspace_saveBinary_noRecurse

        public void testExportSysView_stream_workspace_saveBinary_noRecurse()
                                                                     throws Exception
        Throws:
        Exception
      • testExportSysView_stream_workspace_saveBinary_recurse

        public void testExportSysView_stream_workspace_saveBinary_recurse()
                                                                   throws Exception
        Throws:
        Exception
      • testExportSysView_stream_session_skipBinary_noRecurse

        public void testExportSysView_stream_session_skipBinary_noRecurse()
                                                                   throws Exception
        Throws:
        Exception
      • testExportSysView_stream_session_skipBinary_recurse

        public void testExportSysView_stream_session_skipBinary_recurse()
                                                                 throws Exception
        Throws:
        Exception
      • testExportSysView_stream_session_saveBinary_noRecurse

        public void testExportSysView_stream_session_saveBinary_noRecurse()
                                                                   throws Exception
        Throws:
        Exception
      • testExportSysView_stream_session_saveBinary_recurse

        public void testExportSysView_stream_session_saveBinary_recurse()
                                                                 throws Exception
        Throws:
        Exception
      • testExportSysView_handler_workspace_skipBinary_noRecurse

        public void testExportSysView_handler_workspace_skipBinary_noRecurse()
                                                                      throws Exception
        Throws:
        Exception
      • testExportSysView_handler_workspace_skipBinary_recurse

        public void testExportSysView_handler_workspace_skipBinary_recurse()
                                                                    throws Exception
        Throws:
        Exception
      • testExportSysView_handler_workspace_saveBinary_noRecurse

        public void testExportSysView_handler_workspace_saveBinary_noRecurse()
                                                                      throws Exception
        Throws:
        Exception
      • testExportSysView_handler_workspace_saveBinary_recurse

        public void testExportSysView_handler_workspace_saveBinary_recurse()
                                                                    throws Exception
        Throws:
        Exception
      • testExportSysView_handler_session_skipBinary_noRecurse

        public void testExportSysView_handler_session_skipBinary_noRecurse()
                                                                    throws Exception
        Throws:
        Exception
      • testExportSysView_handler_session_skipBinary_recurse

        public void testExportSysView_handler_session_skipBinary_recurse()
                                                                  throws Exception
        Throws:
        Exception
      • testExportSysView_handler_session_saveBinary_noRecurse

        public void testExportSysView_handler_session_saveBinary_noRecurse()
                                                                    throws Exception
        Throws:
        Exception
      • testExportSysView_handler_session_saveBinary_recurse

        public void testExportSysView_handler_session_saveBinary_recurse()
                                                                  throws Exception
        Throws:
        Exception
      • importRepository

        public void importRepository​(boolean useHandler,
                                     boolean workspace)
                              throws Exception
        Imports the repository
        Parameters:
        useHandler - True = use the import handler, false = use file input stream
        workspace - True = import into workspace, false = import into session
        Throws:
        Exception