org.exoplatform.services.jcr.ext.replication.test
Class BaseReplicationTestCase

java.lang.Object
  extended by org.exoplatform.services.jcr.ext.replication.test.BaseReplicationTestCase
Direct Known Subclasses:
BandwidthAllocationTestCase, BasePriorityTestCase, ConcurrentModificationTestCase, CopyMoveTestCase, DeleteTestCase, DocviewImportTestCase, ExportTestCase, LockTestCase, NtFileTestCase, VersionTestCase

public abstract class BaseReplicationTestCase
extends java.lang.Object

Created by The eXo Platform SAS.

Version:
$Id: BaseReplicationTestCase.java 36667 2009-09-02 09:22:37Z rainf0x $
Author:
Alex Reshetnyak

Field Summary
protected static int BUFFER_SIZE
          Definition the size of buffer.
static int DIVIDER
          Definition the divider.
protected static org.apache.commons.logging.Log log
          The apache logger.
static double ONE_SECONDS
          Definition the constants to on seconds.
protected  javax.jcr.Repository repository
          The JCR repository.
protected  javax.jcr.Node rootNode
          The root node in workspace.
protected  javax.jcr.Session session
          The JCR session.
 
Constructor Summary
BaseReplicationTestCase(RepositoryService repositoryService, java.lang.String reposytoryName, java.lang.String workspaceName, java.lang.String userName, java.lang.String password)
          BaseReplicationTestCase constructor.
 
Method Summary
protected  javax.jcr.Node addNodePath(java.lang.String repoPath)
          addNodePath.
protected  void compareStream(java.io.InputStream etalon, java.io.InputStream data)
          compareStream.
protected  void compareStream(java.io.InputStream etalon, java.io.InputStream data, long etalonPos, long dataPos, long length)
          Compare etalon stream with data stream begining from the offset in etalon and position in data.
protected  java.lang.String getNormalizePath(java.lang.String repoPath)
          getNormalizePath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
The apache logger.


BUFFER_SIZE

protected static final int BUFFER_SIZE
Definition the size of buffer.

See Also:
Constant Field Values

DIVIDER

public static final int DIVIDER
Definition the divider.

See Also:
Constant Field Values

ONE_SECONDS

public static final double ONE_SECONDS
Definition the constants to on seconds.

See Also:
Constant Field Values

session

protected javax.jcr.Session session
The JCR session.


rootNode

protected javax.jcr.Node rootNode
The root node in workspace.


repository

protected javax.jcr.Repository repository
The JCR repository.

Constructor Detail

BaseReplicationTestCase

public BaseReplicationTestCase(RepositoryService repositoryService,
                               java.lang.String reposytoryName,
                               java.lang.String workspaceName,
                               java.lang.String userName,
                               java.lang.String password)
BaseReplicationTestCase constructor.

Parameters:
repositoryService - the RepositoryService.
reposytoryName - the repository name
workspaceName - the workspace name
userName - the user name
password - the password
Method Detail

addNodePath

protected javax.jcr.Node addNodePath(java.lang.String repoPath)
                              throws javax.jcr.RepositoryException
addNodePath.

Parameters:
repoPath - the repository path
Returns:
Node the Node
Throws:
javax.jcr.RepositoryException - will be generated the RepositoryException.

getNormalizePath

protected java.lang.String getNormalizePath(java.lang.String repoPath)
getNormalizePath.

Parameters:
repoPath - the repository path split '::'
Returns:
String return the repository path split '/'

compareStream

protected void compareStream(java.io.InputStream etalon,
                             java.io.InputStream data)
                      throws java.lang.Exception
compareStream.

Parameters:
etalon - the eatalon stream
data - the testing stream
Throws:
java.lang.Exception - will be generated the Exception.

compareStream

protected void compareStream(java.io.InputStream etalon,
                             java.io.InputStream data,
                             long etalonPos,
                             long dataPos,
                             long length)
                      throws java.lang.Exception
Compare etalon stream with data stream begining from the offset in etalon and position in data. Length bytes will be readed and compared. if length is lower 0 then compare streams till one of them will be read.

Parameters:
etalon - the etalon stream
data - testing stream
etalonPos - etalon position
dataPos - testing position
length - the length
Throws:
java.lang.Exception - will be generated the Exception


Copyright © 2012 eXo Platform SAS. All Rights Reserved.