Package org.apache.jackrabbit.test.api
Class SerializationTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.apache.jackrabbit.test.JUnitTest
-
- org.apache.jackrabbit.test.AbstractJCRTest
-
- org.apache.jackrabbit.test.api.SerializationTest
-
- All Implemented Interfaces:
junit.framework.Test
public class SerializationTest extends AbstractJCRTest
SerializationTest
contains the test cases for the methodWorkspace.exportSysView()
andSession.importSysView()
.This class exports and re-imports the repository. The tests check for differences between the original and the re-imported repository.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
CONTENTHANDLER
protected File
file
protected boolean
NORECURSE
protected boolean
RECURSE
protected boolean
SAVEBINARY
protected Session
session
protected boolean
SESSION
protected boolean
SKIPBINARY
protected boolean
STREAM
protected org.apache.jackrabbit.test.api.TreeComparator
treeComparator
protected Workspace
workspace
protected boolean
WORKSPACE
-
Fields inherited from class org.apache.jackrabbit.test.AbstractJCRTest
isReadOnly, jcrBaseVersion, jcrCopiedFrom, jcrCreated, jcrFrozenNode, jcrFrozenUuid, jcrIsCheckedOut, jcrlockIsDeep, jcrLockOwner, jcrMergeFailed, jcrMixinTypes, jcrPredecessors, jcrPrimaryType, jcrRootVersion, jcrSuccessors, jcrSystem, jcrUUID, jcrVersionHistory, mixLockable, mixReferenceable, mixShareable, mixSimpleVersionable, mixTitle, mixVersionable, nodeName1, nodeName2, nodeName3, nodeName4, NS_JCR_URI, NS_MIX_URI, NS_NT_URI, NS_SV_URI, ntActivity, ntBase, ntFrozenNode, ntQuery, ntUnstructured, ntVersion, ntVersionHistory, ntVersionLabels, propertyName1, propertyName2, superuser, testNodeType, testNodeTypeNoChildren, testNodeTypeTestRoot, testPath, testRoot, testRootNode, vf, workspaceName
-
-
Constructor Summary
Constructors Constructor Description SerializationTest()
-
Method Summary
-
Methods inherited from class org.apache.jackrabbit.test.AbstractJCRTest
checkSupportedOption, cleanUp, cleanUpTestRoot, createRandomString, ensureCanSetProperty, ensureCanSetProperty, ensureCanSetProperty, ensureKnowsNodeType, ensureLockingSupported, ensureMixinType, ensureMultipleWorkspacesSupported, getHelper, getJcrValue, getLocalName, getNonExistingWorkspaceName, getPrefix, getProperty, getProperty, getQualifiedName, getSize, isSupported, needsMixin, run
-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, runBare, runTest, setName, toString
-
-
-
-
Field Detail
-
workspace
protected Workspace workspace
-
file
protected File file
-
treeComparator
protected org.apache.jackrabbit.test.api.TreeComparator treeComparator
-
CONTENTHANDLER
protected final boolean CONTENTHANDLER
- See Also:
- Constant Field Values
-
STREAM
protected final boolean STREAM
- See Also:
- Constant Field Values
-
WORKSPACE
protected final boolean WORKSPACE
- See Also:
- Constant Field Values
-
SESSION
protected final boolean SESSION
- See Also:
- Constant Field Values
-
SKIPBINARY
protected final boolean SKIPBINARY
- See Also:
- Constant Field Values
-
SAVEBINARY
protected final boolean SAVEBINARY
- See Also:
- Constant Field Values
-
NORECURSE
protected final boolean NORECURSE
- See Also:
- Constant Field Values
-
RECURSE
protected final boolean RECURSE
- See Also:
- Constant Field Values
-
session
protected Session session
-
-
Method Detail
-
setUp
public void setUp() throws RepositoryException, Exception
- Overrides:
setUp
in classAbstractJCRTest
- Throws:
RepositoryException
Exception
-
tearDown
public void tearDown() throws Exception
- Overrides:
tearDown
in classAbstractJCRTest
- Throws:
Exception
-
initVersioningException
protected Node initVersioningException(boolean returnParent) throws RepositoryException, NotExecutableException, IOException
Creates a simple target tree consisting of a checked-in node and an ordinary child node below. Throws aNotExecutableException
ifAbstractJCRTest.testNodeType
is not versionable.- Parameters:
returnParent
- Whether the method returns a checked-in parent or the child of a checked-in parent.- Returns:
- The requested node (a node that is checked in or that has a parent that is checked in).
- Throws:
RepositoryException
NotExecutableException
IOException
-
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
-
testInvalidXmlThrowsSaxException
public void testInvalidXmlThrowsSaxException() throws IOException, ParserConfigurationException
Tests whether importing an invalid XML file throws a SAX exception. The file used here is more or less garbage.
-
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
-
testSessionImportXmlExceptions
public void testSessionImportXmlExceptions() throws RepositoryException, IOException
Tests the exception when importing: If the parent node does not exist.- Throws:
RepositoryException
IOException
-
testWorkspaceImportXmlExceptions
public void testWorkspaceImportXmlExceptions() throws RepositoryException, IOException
Tests the exceptions when importing: If the parent node does not exist, and if an IO error occurs.- Throws:
RepositoryException
IOException
-
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
-
testSessionImportXml
public void testSessionImportXml() throws RepositoryException, IOException
Makes sure that importing into the session does not save anything if the session is closed.- Throws:
RepositoryException
IOException
-
testSessionGetContentHandler
public void testSessionGetContentHandler() throws Exception
Makes sure that importing into the session does not save anything if the session is closed.- Throws:
Exception
-
testStreamHandling
public void testStreamHandling() throws RepositoryException, IOException
Tests whetherSession.importXML
andWorkspace.importXML
obey the stream handling contract.- Throws:
RepositoryException
IOException
-
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
-
doImportNoSave
public void doImportNoSave(String absPath, FileInputStream in, boolean useHandler) throws Exception
- Throws:
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
-
-