org.alfresco.repo.content
Class AbstractWritableContentStoreTest

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

public abstract class AbstractWritableContentStoreTest
extends AbstractReadOnlyContentStoreTest

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

See Also:
ContentStore, ContentReader, ContentWriter

Field Summary
 
Fields inherited from class org.alfresco.repo.content.AbstractReadOnlyContentStoreTest
ctx, transactionService
 
Constructor Summary
AbstractWritableContentStoreTest()
           
 
Method Summary
protected  java.lang.String getExistingContentUrl()
          Fetch a valid URL from the store.
protected  org.alfresco.service.cmr.repository.ContentWriter getWriter()
          Get a writer into the store.
 void testClosedState()
           
 void testDeleteReaderStates()
          Tests deletion of content.
 void testDeleteSimple()
           
 void testGetReader()
          Checks that the various methods of obtaining a reader are supported.
 void testGetUrls()
           
 void testIllegalWritableContentUrls()
          Checks that the error handling for inappropriate content URLs
 void testListUrls()
          Tests retrieval of all content URLs
 void testMimetypAndEncodingAndLocale()
           
 void testRandomAccessRead()
          Tests random access reading
 void testRandomAccessWrite()
          Tests random access writing
 void testReadAndWriteFile()
           
 void testReadAndWriteStreamByPull()
           
 void testReadAndWriteStreamByPush()
           
 void testReaderImmutability()
          Check that a reader is immutable, i.e.
 void testRootLocation()
          Just check that the method doesn't blow up
 void testSetUp()
           
 void testSimpleUse()
          Get a writer and write a little bit of content before reading it.
 void testSpaceFree()
          Just checks that the method doesn't blow up
 void testSpaceTotal()
          Just checks that the method doesn't blow up
 void testSpaceUsed()
          Just check that the method doesn't blow up
 void testStringTruncation()
           
 void testWritable()
           
 void testWriteAndReadString()
          The simplest test.
 void testWriteStreamListener()
          Checks that the writer can have a listener attached
 
Methods inherited from class org.alfresco.repo.content.AbstractReadOnlyContentStoreTest
getReader, getStore, setUp, tearDown, testBlockedWriteOperations, testGetReaderForExistingContentUrl, testIllegalReadableContentUrls
 
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
 

Constructor Detail

AbstractWritableContentStoreTest

public AbstractWritableContentStoreTest()
Method Detail

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.

This implementation creates some content in the store and returns the new content URL.

Overrides:
getExistingContentUrl in class AbstractReadOnlyContentStoreTest
Returns:
Return any valid URL for the store, or null if the store is empty.

getWriter

protected org.alfresco.service.cmr.repository.ContentWriter getWriter()
Get a writer into the store. This test class assumes that the store is writable and that it therefore supports the ability to write content.

Returns:
Returns a writer for new content

testSetUp

public void testSetUp()
               throws java.lang.Exception
Overrides:
testSetUp in class AbstractReadOnlyContentStoreTest
Throws:
java.lang.Exception

testWritable

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

testSpaceUsed

public void testSpaceUsed()
                   throws java.lang.Exception
Just check that the method doesn't blow up

Throws:
java.lang.Exception

testSpaceFree

public void testSpaceFree()
                   throws java.lang.Exception
Just checks that the method doesn't blow up

Throws:
java.lang.Exception

testSpaceTotal

public void testSpaceTotal()
                    throws java.lang.Exception
Just checks that the method doesn't blow up

Throws:
java.lang.Exception

testRootLocation

public void testRootLocation()
                      throws java.lang.Exception
Just check that the method doesn't blow up

Throws:
java.lang.Exception

testIllegalWritableContentUrls

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


testSimpleUse

public void testSimpleUse()
Get a writer and write a little bit of content before reading it.


testGetReader

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

Throws:
java.lang.Exception

testReaderImmutability

public void testReaderImmutability()
Check that a reader is immutable, i.e. that a reader fetched before a write doesn't suddenly become aware of the content once it has been written.


testMimetypAndEncodingAndLocale

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

testClosedState

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

testGetUrls

public void testGetUrls()

testDeleteSimple

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

testDeleteReaderStates

public void testDeleteReaderStates()
                            throws java.lang.Exception
Tests deletion of content.

Only applies when AbstractReadOnlyContentStoreTest.getStore() returns a value.

Throws:
java.lang.Exception

testWriteStreamListener

public void testWriteStreamListener()
                             throws java.lang.Exception
Checks that the writer can have a listener attached

Throws:
java.lang.Exception

testWriteAndReadString

public void testWriteAndReadString()
                            throws java.lang.Exception
The simplest test. Write a string and read it again, checking that we receive the same values. If the resource accessed by #getReader() and AbstractWritableContentStoreTest.getWriter() is not the same, then values written and read won't be the same.

Throws:
java.lang.Exception

testStringTruncation

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

testReadAndWriteFile

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

testReadAndWriteStreamByPull

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

testReadAndWriteStreamByPush

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

testListUrls

public void testListUrls()
                  throws java.lang.Exception
Tests retrieval of all content URLs

Only applies when AbstractReadOnlyContentStoreTest.getStore() returns a value.

Throws:
java.lang.Exception

testRandomAccessWrite

public void testRandomAccessWrite()
                           throws java.lang.Exception
Tests random access writing

Only executes if the writer implements RandomAccessContent.

Throws:
java.lang.Exception

testRandomAccessRead

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

Only executes if the reader implements RandomAccessContent.

Overrides:
testRandomAccessRead in class AbstractReadOnlyContentStoreTest
Throws:
java.lang.Exception


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