org.alfresco.repo.content
Class AbstractReadOnlyContentStoreTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.alfresco.repo.content.AbstractReadOnlyContentStoreTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractWritableContentStoreTest, ReadOnlyFileContentStoreTest

public abstract class AbstractReadOnlyContentStoreTest
extends junit.framework.TestCase

Abstract base class that provides a set of tests for implementations of ContentStore.

See Also:
ContentStore, ContentReader, ContentWriter

Field Summary
protected static org.springframework.context.ApplicationContext ctx
           
protected  TransactionService transactionService
           
 
Constructor Summary
AbstractReadOnlyContentStoreTest()
           
 
Method Summary
protected  java.lang.String getExistingContentUrl()
          Fetch a valid URL from the store.
protected  org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
          Gets a reader for the given content URL from the store
protected abstract  ContentStore getStore()
          Fetch the store to be used during a test.
 void setUp()
          Starts a transaction
 void tearDown()
          Rolls back the transaction
 void testBlockedWriteOperations()
           
 void testGetReaderForExistingContentUrl()
          Checks that the various methods of obtaining a reader are supported.
 void testIllegalReadableContentUrls()
          Checks that the error handling for inappropriate content URLs
 void testRandomAccessRead()
          Tests random access reading
 void testSetUp()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ctx

protected static final org.springframework.context.ApplicationContext ctx

transactionService

protected TransactionService transactionService
Constructor Detail

AbstractReadOnlyContentStoreTest

public AbstractReadOnlyContentStoreTest()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Starts a transaction

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
Rolls back the transaction

Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

getStore

protected abstract ContentStore getStore()
Fetch the store to be used during a test. This method is invoked once per test - it is therefore safe to use setUp to initialise resources.

Usually tests will construct a static instance of the store to use throughout all the tests.

Returns:
Returns the same instance of a store for all invocations.

getReader

protected final org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
Gets a reader for the given content URL from the store

See Also:
AbstractReadOnlyContentStoreTest.getStore()

getExistingContentUrl

protected java.lang.String getExistingContentUrl()
Fetch a valid URL from the store. The default implementation will attempt to get all the available URLs from the store and pick the first one. Writable store tests can create some content to be sure of its existence.

Returns:
Return any valid URL for the store, or null if the store is empty.

testSetUp

public void testSetUp()
               throws java.lang.Exception
Throws:
java.lang.Exception

testIllegalReadableContentUrls

public void testIllegalReadableContentUrls()
Checks that the error handling for inappropriate content URLs


testGetReaderForExistingContentUrl

public void testGetReaderForExistingContentUrl()
                                        throws java.lang.Exception
Checks that the various methods of obtaining a reader are supported.

Throws:
java.lang.Exception

testRandomAccessRead

public void testRandomAccessRead()
                          throws java.lang.Exception
Tests random access reading

Only executes if the reader implements RandomAccessContent.

Throws:
java.lang.Exception

testBlockedWriteOperations

public void testBlockedWriteOperations()
                                throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.