org.alfresco.repo.node
Class BaseNodeServiceTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.test.ConditionalTestCase
              extended by org.springframework.test.AbstractSpringContextTests
                  extended by org.springframework.test.AbstractSingleSpringContextTests
                      extended by org.springframework.test.AbstractDependencyInjectionSpringContextTests
                          extended by org.springframework.test.AbstractTransactionalSpringContextTests
                              extended by org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
                                  extended by org.alfresco.util.BaseSpringTest
                                      extended by org.alfresco.repo.node.BaseNodeServiceTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
DbNodeServiceImplTest, FullNodeServiceTest

public abstract class BaseNodeServiceTest
extends BaseSpringTest

Provides a base set of tests of the various NodeService implementations.

To test a specific incarnation of the service, the methods #getStoreService() and BaseNodeServiceTest.getNodeService() must be implemented.

See Also:
BaseNodeServiceTest.nodeService, BaseNodeServiceTest.rootNodeRef, BaseNodeServiceTest.buildNodeGraph()

Nested Class Summary
static class BaseNodeServiceTest.BadOnDeleteNodePolicy
           
static class BaseNodeServiceTest.MovePolicyTester
           
static class BaseNodeServiceTest.TestEnum
           
 
Field Summary
static org.alfresco.service.namespace.QName ASPECT_QNAME_MANDATORY
           
static org.alfresco.service.namespace.QName ASPECT_QNAME_TEST_MARKER
           
static org.alfresco.service.namespace.QName ASPECT_QNAME_TEST_MARKER2
           
static org.alfresco.service.namespace.QName ASPECT_QNAME_TEST_TITLED
           
static org.alfresco.service.namespace.QName ASPECT_QNAME_WITH_DEFAULT_VALUE
           
static org.alfresco.service.namespace.QName ASPECT_WITH_ASSOCIATIONS
           
static org.alfresco.service.namespace.QName ASPECT_WITH_ASSOCIATIONS_EXTRA
           
static org.alfresco.service.namespace.QName ASPECT_WITH_ENCRYPTED
           
static org.alfresco.service.namespace.QName ASSOC_ASPECT_CHILD_ASSOC
           
static org.alfresco.service.namespace.QName ASSOC_ASPECT_CHILD_ASSOC_01
           
static org.alfresco.service.namespace.QName ASSOC_ASPECT_CHILD_ASSOC_02
           
static org.alfresco.service.namespace.QName ASSOC_ASPECT_NORMAL_ASSOC
           
static org.alfresco.service.namespace.QName ASSOC_ASPECT_NORMAL_ASSOC_01
           
static org.alfresco.service.namespace.QName ASSOC_ASPECT_NORMAL_ASSOC_02
           
static org.alfresco.service.namespace.QName ASSOC_TYPE_QNAME_TEST_CHILDREN
           
static org.alfresco.service.namespace.QName ASSOC_TYPE_QNAME_TEST_CONTAINS
           
static org.alfresco.service.namespace.QName ASSOC_TYPE_QNAME_TEST_NEXT
           
protected  AuthenticationComponent authenticationComponent
           
static boolean behaviourExecuted
           
static java.lang.String DEFAULT_VALUE
           
protected  org.hibernate.dialect.Dialect dialect
           
protected  org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService
           
protected  MetadataEncryptor metadataEncryptor
           
static java.lang.String NAMESPACE
           
protected  org.alfresco.service.cmr.repository.NodeService nodeService
           
static java.lang.String NOT_DEFAULT_VALUE
           
protected  PolicyComponent policyComponent
           
static org.alfresco.service.namespace.QName PROP_QNAME_ANY_PROP_MULTIPLE
           
static org.alfresco.service.namespace.QName PROP_QNAME_ANY_PROP_SINGLE
           
static org.alfresco.service.namespace.QName PROP_QNAME_BOOLEAN_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_CATEGORY_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_CONTENT_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_DATE_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_DOUBLE_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_ENCRYPTED_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_FLOAT_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_INTEGER_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_LOCALE_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_LONG_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_MARKER_PROP
           
static org.alfresco.service.namespace.QName PROP_QNAME_ML_TEXT_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_MULTI_ML_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_MULTI_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_NODEREF_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_NULL_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_PATH_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_PERIOD_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_PROP1
           
static org.alfresco.service.namespace.QName PROP_QNAME_PROP2
           
static org.alfresco.service.namespace.QName PROP_QNAME_QNAME_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_SERIALIZABLE_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_STRING_PROP_MULTIPLE
           
static org.alfresco.service.namespace.QName PROP_QNAME_STRING_PROP_SINGLE
           
static org.alfresco.service.namespace.QName PROP_QNAME_STRING_VALUE
           
static org.alfresco.service.namespace.QName PROP_QNAME_TEST_CONTENT
           
static org.alfresco.service.namespace.QName PROP_QNAME_TEST_DESCRIPTION
           
static org.alfresco.service.namespace.QName PROP_QNAME_TEST_TITLE
           
protected  RetryingTransactionHelper retryingTransactionHelper
           
protected  org.alfresco.service.cmr.repository.NodeRef rootNodeRef
          populated during setup
static java.lang.String TEST_PREFIX
           
protected  TransactionService transactionService
           
static org.alfresco.service.namespace.QName TYPE_QNAME_EXTENDED_CONTENT
           
static org.alfresco.service.namespace.QName TYPE_QNAME_TEST_CONTENT
           
static org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MANY_ML_PROPERTIES
           
static org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MANY_PROPERTIES
           
static org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MANY_PROPERTIES_ENCRYPTED
           
static org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MULTIPLE_TESTER
           
 
Fields inherited from class org.alfresco.util.BaseSpringTest
sessionFactory
 
Fields inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
jdbcTemplate
 
Fields inherited from class org.springframework.test.AbstractTransactionalSpringContextTests
transactionDefinition, transactionManager, transactionStatus
 
Fields inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests
AUTOWIRE_BY_NAME, AUTOWIRE_BY_TYPE, AUTOWIRE_NO
 
Fields inherited from class org.springframework.test.AbstractSingleSpringContextTests
applicationContext
 
Fields inherited from class org.springframework.test.ConditionalTestCase
logger
 
Constructor Summary
BaseNodeServiceTest()
           
 
Method Summary
 java.util.Map buildNodeGraph()
           
static java.util.Map buildNodeGraph(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef rootNodeRef)
          Builds a graph of child associations as follows:
protected  void fillProperties(org.alfresco.service.namespace.QName qname, java.util.Map properties)
          Fills the given property map with some values according to the property definitions on the given class
protected  void getExpectedPropertyValues(java.util.Map checkProperties)
          Apply any changes to the PROP_QNAME_XXX_VALUE used for checking the following:
protected abstract  org.alfresco.service.cmr.repository.NodeService getNodeService()
          Usually just implemented by fetching the bean directly from the bean factory, for example:
static org.alfresco.service.cmr.dictionary.DictionaryService loadModel(org.springframework.context.ApplicationContext applicationContext)
          Loads the test model required for building the node graphs
protected  void onSetUpInTransaction()
           
protected  void onTearDownInTransaction()
           
 void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map before, java.util.Map after)
           
 void testAddBogusChild()
           
 void testAddChild()
           
 void testAddProperties()
           
 void testAR1303()
           
 void testAR1414()
          Check that Serializable properties do not remain connected to the L1 session
 void testAR782()
          Checks that unconvertable property values cannot be persisted.
 void testAspectRemoval()
           
 void testAspectRemovalCascadeDelete()
          Test ALFCOM-2299
 void testAspects()
          Checks that aspects can be added, removed and queried.
 void testAspectsAddedAutomatically()
           
 void testAspectWithChildAssociationsCreationAndRetrieval()
           
 void testBigCollections()
          Checks that large collections can be persisted
 void testCascadeDelete()
           
 void testCreateAndRemoveAssociation()
           
 void testCreateNode()
           
 void testCreateNodeNoProperties()
           
 void testCreateNodeWithId()
          Tests node creation with a pre-determined uuid.
 void testCreateNodeWithProperties()
           
 void testCreateStore()
           
 void testCreateWithTooLongPathLocalname()
           
 void testDefaultPropertyOverride_AddAspect()
           
 void testDefaultPropertyOverride_CreateNode()
           
 void testDefaultPropertyOverride_SpecializeWithoutProperty()
           
 void testDefaultPropertyOverride_SpecializeWithProperty()
           
 void testDefaultValues()
          Test that default values are set when nodes are created and aspects applied
 void testDelete()
           
 void testDeleteAndAddSameName()
          Checks that the unique constraint doesn't break delete and create within the same transaction.
 void testDeleteStore()
           
 void testDeleteWithBadlyBehavedBeforeDeletePolicies()
          This test is similar to the test above but beforeDelete does nasty stuff such as creating children of the soon to be deleted children.
 void testDeleteWithBadlyBehavedOnDeletePolicies()
          This test is similar to the test above but onDelete does nasty stuff such as creating siblings of the soon to be deleted children.
 void testDuplicateAssociationDetection()
           
 void testDuplicateAssocsWithoutSuppliedName()
          Create some nodes that have the no cm:name and use associations that enforce uniqueness.
 void testDuplicateCatch()
          Check that the duplicate child name is detected and thrown correctly
 void testDuplicateChildAssocCleanup()
           
 void testEmptyCollections()
          Checks that empty collections can be persisted
 void testEncryptedProperties()
          Check that d:encrypted properties work correctly.
 void testEncryptionAndDecryptionOfProperties()
           
 void testExists()
           
 void testGetByName()
           
 void testGetChildAssocs()
           
 void testGetChildAssocsByChildType()
           
 void testGetNodeRefById()
           
 void testGetParentAssocs()
           
 void testGetPath()
           
 void testGetPaths()
           
 void testGetReferencableProperties()
          Checks that the referencable properties are present
 void testGetRootNode()
           
 void testGetSourceAssocs()
           
 void testGetStores()
           
 void testGetTargetAssocs()
           
 void testGetType()
           
 void testGetUnknownProperty()
          Makes a read-only transaction and then looks for a property using a non-existent QName.
 void testLargeStrings()
           
 void testLocalizedAspect()
           
 void testMandatoryAspects()
           
 void testMoveNode()
           
 void testMultiProp()
           
 void testMultivaluedSerializable()
          Ensures that d:any types are handled correctly when adding values
 void testMultiValueMLTextProperties()
           
 void testNonDuplicateAssocsWithSuppliedName()
          Create some nodes that have the same cm:name but use associations that don't enforce uniqueness.
 void testPrimaryPathCascadeDelete()
           
 void testProperties()
           
 void testPropertyLocaleBehaviour()
           
 void testPropertyTypes()
          Check that properties go in and come out in the correct format.
 void testReferencePropertySet()
           
 void testRemoveChildByRef()
           
 void testRemoveProperty()
           
 void testRemoveSpecificChild()
           
 void testSerializableProperties()
          Ensures that the type you get out of a d:any property is the type that you put in.
 void testSetType()
           
 void testSetUp()
           
 void testTargetAssoc_Ordering()
           
 
Methods inherited from class org.alfresco.util.BaseSpringTest
flushAndClear, getConfigLocations, getSession, loadContext, setSessionFactory
 
Methods inherited from class org.springframework.test.AbstractTransactionalDataSourceSpringContextTests
countRowsInTable, deleteFromTables, executeSqlScript, getJdbcTemplate, setComplete, setDataSource, setSqlScriptEncoding
 
Methods inherited from class org.springframework.test.AbstractTransactionalSpringContextTests
endTransaction, isDefaultRollback, isRollback, onSetUp, onSetUpBeforeTransaction, onTearDown, onTearDownAfterTransaction, preventTransaction, setDefaultRollback, setTransactionDefinition, setTransactionManager, startNewTransaction
 
Methods inherited from class org.springframework.test.AbstractDependencyInjectionSpringContextTests
getAutowireMode, injectDependencies, isDependencyCheck, isPopulateProtectedVariables, prepareTestInstance, setAutowireMode, setDependencyCheck, setPopulateProtectedVariables
 
Methods inherited from class org.springframework.test.AbstractSingleSpringContextTests
contextKey, createApplicationContext, createBeanDefinitionReader, customizeBeanFactory, getApplicationContext, getConfigPath, getConfigPaths, getLoadCount, loadContextLocations, prepareApplicationContext, setDirty, setUp, tearDown
 
Methods inherited from class org.springframework.test.AbstractSpringContextTests
addContext, contextKeyString, getContext, hasCachedContext, isContextKeyEmpty, setDirty
 
Methods inherited from class org.springframework.test.ConditionalTestCase
getDisabledTestCount, isDisabledInThisEnvironment, recordDisabled, runBare
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, 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

NAMESPACE

public static final java.lang.String NAMESPACE
See Also:
Constant Field Values

TEST_PREFIX

public static final java.lang.String TEST_PREFIX
See Also:
Constant Field Values

DEFAULT_VALUE

public static final java.lang.String DEFAULT_VALUE
See Also:
Constant Field Values

NOT_DEFAULT_VALUE

public static final java.lang.String NOT_DEFAULT_VALUE
See Also:
Constant Field Values

TYPE_QNAME_TEST_CONTENT

public static final org.alfresco.service.namespace.QName TYPE_QNAME_TEST_CONTENT

TYPE_QNAME_TEST_MANY_PROPERTIES

public static final org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MANY_PROPERTIES

TYPE_QNAME_TEST_MANY_PROPERTIES_ENCRYPTED

public static final org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MANY_PROPERTIES_ENCRYPTED

TYPE_QNAME_TEST_MANY_ML_PROPERTIES

public static final org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MANY_ML_PROPERTIES

TYPE_QNAME_EXTENDED_CONTENT

public static final org.alfresco.service.namespace.QName TYPE_QNAME_EXTENDED_CONTENT

ASPECT_QNAME_TEST_TITLED

public static final org.alfresco.service.namespace.QName ASPECT_QNAME_TEST_TITLED

ASPECT_QNAME_TEST_MARKER

public static final org.alfresco.service.namespace.QName ASPECT_QNAME_TEST_MARKER

ASPECT_QNAME_TEST_MARKER2

public static final org.alfresco.service.namespace.QName ASPECT_QNAME_TEST_MARKER2

ASPECT_QNAME_MANDATORY

public static final org.alfresco.service.namespace.QName ASPECT_QNAME_MANDATORY

ASPECT_QNAME_WITH_DEFAULT_VALUE

public static final org.alfresco.service.namespace.QName ASPECT_QNAME_WITH_DEFAULT_VALUE

PROP_QNAME_TEST_TITLE

public static final org.alfresco.service.namespace.QName PROP_QNAME_TEST_TITLE

PROP_QNAME_TEST_DESCRIPTION

public static final org.alfresco.service.namespace.QName PROP_QNAME_TEST_DESCRIPTION

PROP_QNAME_TEST_CONTENT

public static final org.alfresco.service.namespace.QName PROP_QNAME_TEST_CONTENT

PROP_QNAME_BOOLEAN_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_BOOLEAN_VALUE

PROP_QNAME_INTEGER_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_INTEGER_VALUE

PROP_QNAME_LONG_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_LONG_VALUE

PROP_QNAME_FLOAT_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_FLOAT_VALUE

PROP_QNAME_DOUBLE_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_DOUBLE_VALUE

PROP_QNAME_STRING_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_STRING_VALUE

PROP_QNAME_ML_TEXT_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_ML_TEXT_VALUE

PROP_QNAME_DATE_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_DATE_VALUE

PROP_QNAME_SERIALIZABLE_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_SERIALIZABLE_VALUE

PROP_QNAME_NODEREF_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_NODEREF_VALUE

PROP_QNAME_QNAME_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_QNAME_VALUE

PROP_QNAME_CONTENT_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_CONTENT_VALUE

PROP_QNAME_PATH_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_PATH_VALUE

PROP_QNAME_CATEGORY_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_CATEGORY_VALUE

PROP_QNAME_LOCALE_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_LOCALE_VALUE

PROP_QNAME_NULL_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_NULL_VALUE

PROP_QNAME_MULTI_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_MULTI_VALUE

PROP_QNAME_PERIOD_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_PERIOD_VALUE

PROP_QNAME_MULTI_ML_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_MULTI_ML_VALUE

PROP_QNAME_MARKER_PROP

public static final org.alfresco.service.namespace.QName PROP_QNAME_MARKER_PROP

PROP_QNAME_PROP1

public static final org.alfresco.service.namespace.QName PROP_QNAME_PROP1

PROP_QNAME_PROP2

public static final org.alfresco.service.namespace.QName PROP_QNAME_PROP2

ASSOC_TYPE_QNAME_TEST_CHILDREN

public static final org.alfresco.service.namespace.QName ASSOC_TYPE_QNAME_TEST_CHILDREN

ASSOC_TYPE_QNAME_TEST_CONTAINS

public static final org.alfresco.service.namespace.QName ASSOC_TYPE_QNAME_TEST_CONTAINS

ASSOC_TYPE_QNAME_TEST_NEXT

public static final org.alfresco.service.namespace.QName ASSOC_TYPE_QNAME_TEST_NEXT

ASPECT_WITH_ASSOCIATIONS

public static final org.alfresco.service.namespace.QName ASPECT_WITH_ASSOCIATIONS

ASSOC_ASPECT_CHILD_ASSOC

public static final org.alfresco.service.namespace.QName ASSOC_ASPECT_CHILD_ASSOC

ASSOC_ASPECT_NORMAL_ASSOC

public static final org.alfresco.service.namespace.QName ASSOC_ASPECT_NORMAL_ASSOC

ASPECT_WITH_ASSOCIATIONS_EXTRA

public static final org.alfresco.service.namespace.QName ASPECT_WITH_ASSOCIATIONS_EXTRA

ASSOC_ASPECT_CHILD_ASSOC_01

public static final org.alfresco.service.namespace.QName ASSOC_ASPECT_CHILD_ASSOC_01

ASSOC_ASPECT_CHILD_ASSOC_02

public static final org.alfresco.service.namespace.QName ASSOC_ASPECT_CHILD_ASSOC_02

ASSOC_ASPECT_NORMAL_ASSOC_01

public static final org.alfresco.service.namespace.QName ASSOC_ASPECT_NORMAL_ASSOC_01

ASSOC_ASPECT_NORMAL_ASSOC_02

public static final org.alfresco.service.namespace.QName ASSOC_ASPECT_NORMAL_ASSOC_02

TYPE_QNAME_TEST_MULTIPLE_TESTER

public static final org.alfresco.service.namespace.QName TYPE_QNAME_TEST_MULTIPLE_TESTER

PROP_QNAME_STRING_PROP_SINGLE

public static final org.alfresco.service.namespace.QName PROP_QNAME_STRING_PROP_SINGLE

PROP_QNAME_STRING_PROP_MULTIPLE

public static final org.alfresco.service.namespace.QName PROP_QNAME_STRING_PROP_MULTIPLE

PROP_QNAME_ANY_PROP_SINGLE

public static final org.alfresco.service.namespace.QName PROP_QNAME_ANY_PROP_SINGLE

PROP_QNAME_ANY_PROP_MULTIPLE

public static final org.alfresco.service.namespace.QName PROP_QNAME_ANY_PROP_MULTIPLE

ASPECT_WITH_ENCRYPTED

public static final org.alfresco.service.namespace.QName ASPECT_WITH_ENCRYPTED

PROP_QNAME_ENCRYPTED_VALUE

public static final org.alfresco.service.namespace.QName PROP_QNAME_ENCRYPTED_VALUE

policyComponent

protected PolicyComponent policyComponent

dictionaryService

protected org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService

transactionService

protected TransactionService transactionService

retryingTransactionHelper

protected RetryingTransactionHelper retryingTransactionHelper

authenticationComponent

protected AuthenticationComponent authenticationComponent

nodeService

protected org.alfresco.service.cmr.repository.NodeService nodeService

metadataEncryptor

protected MetadataEncryptor metadataEncryptor

dialect

protected org.hibernate.dialect.Dialect dialect

rootNodeRef

protected org.alfresco.service.cmr.repository.NodeRef rootNodeRef
populated during setup


behaviourExecuted

public static boolean behaviourExecuted
Constructor Detail

BaseNodeServiceTest

public BaseNodeServiceTest()
Method Detail

onSetUpInTransaction

protected void onSetUpInTransaction()
                             throws java.lang.Exception
Overrides:
onSetUpInTransaction in class org.springframework.test.AbstractTransactionalSpringContextTests
Throws:
java.lang.Exception

onTearDownInTransaction

protected void onTearDownInTransaction()
                                throws java.lang.Exception
Overrides:
onTearDownInTransaction in class org.springframework.test.AbstractTransactionalSpringContextTests
Throws:
java.lang.Exception

loadModel

public static org.alfresco.service.cmr.dictionary.DictionaryService loadModel(org.springframework.context.ApplicationContext applicationContext)
Loads the test model required for building the node graphs


getNodeService

protected abstract org.alfresco.service.cmr.repository.NodeService getNodeService()
Usually just implemented by fetching the bean directly from the bean factory, for example:

      return (NodeService) applicationContext.getBean("dbNodeService");
 
The NodeService returned must support cascade deletion.

Returns:
Returns the implementation of NodeService to be used for this test. It must have transaction demarcation.

testSetUp

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

buildNodeGraph

public java.util.Map buildNodeGraph()
                             throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
BaseNodeServiceTest.buildNodeGraph(NodeService, NodeRef)

buildNodeGraph

public static java.util.Map buildNodeGraph(org.alfresco.service.cmr.repository.NodeService nodeService,
                                           org.alfresco.service.cmr.repository.NodeRef rootNodeRef)
                                    throws java.lang.Exception
Builds a graph of child associations as follows:
 Level 0:     root
 Level 1:     root_p_n1   root_p_n2
 Level 2:     n1_p_n3     n2_p_n4     n1_n4       n2_p_n5     n1_n8
 Level 3:     n3_p_n6     n4_n6       n5_p_n7
 Level 4:     n6_p_n8     n7_n8
 

  • Apart from the root node having the root aspect, node 6 (n6) also has the root aspect.
  • n3 has properties animal = monkey and reference = n2.toString().
  • All nodes are of type container with the exception of n8, which is of type test:content

The namespace URI for all associations is BaseNodeServiceTest.NAMESPACE.

The naming convention is:

 n2_p_n5
 n4_n5
 where
      n5 is the node number of the node
      n2 is the primary parent node number
      n4 is any other non-primary parent
 

The session is flushed to ensure that persistence occurs correctly. It is cleared to ensure that fetches against the created data are correct.

Returns:
Returns a map ChildAssocRef instances keyed by qualified assoc name
Throws:
java.lang.Exception

testCreateStore

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

testGetStores

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

testDeleteStore

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

testExists

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

testGetRootNode

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

testCreateNode

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

testCreateWithTooLongPathLocalname

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

testCreateNodeWithId

public void testCreateNodeWithId()
                          throws java.lang.Exception
Tests node creation with a pre-determined uuid.

Throws:
java.lang.Exception

testGetType

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

testSetType

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

fillProperties

protected void fillProperties(org.alfresco.service.namespace.QName qname,
                              java.util.Map properties)
Fills the given property map with some values according to the property definitions on the given class


testAspects

public void testAspects()
                 throws java.lang.Exception
Checks that aspects can be added, removed and queried. Failure to detect inadequate properties is also checked.

Throws:
java.lang.Exception

testAspectsAddedAutomatically

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

testAspectRemoval

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

testAspectRemovalCascadeDelete

public void testAspectRemovalCascadeDelete()
                                    throws java.lang.Exception
Test ALFCOM-2299

Throws:
java.lang.Exception

testAspectWithChildAssociationsCreationAndRetrieval

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

testCreateNodeNoProperties

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

testLargeStrings

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

testCreateNodeWithProperties

public void testCreateNodeWithProperties()
                                  throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
BaseNodeServiceTest.ASPECT_QNAME_TEST_TITLED

testCascadeDelete

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

testDelete

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

testDeleteWithBadlyBehavedOnDeletePolicies

public void testDeleteWithBadlyBehavedOnDeletePolicies()
                                                throws java.lang.Exception
This test is similar to the test above but onDelete does nasty stuff such as creating siblings of the soon to be deleted children. In particular, it verifies that we don't get stuck in an infinite loop.

Throws:
java.lang.Exception

testDeleteWithBadlyBehavedBeforeDeletePolicies

public void testDeleteWithBadlyBehavedBeforeDeletePolicies()
                                                    throws java.lang.Exception
This test is similar to the test above but beforeDelete does nasty stuff such as creating children of the soon to be deleted children. In particular, it verifies that we don't get stuck in an infinite loop.

Throws:
java.lang.Exception

testAddBogusChild

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

testAddChild

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

testRemoveSpecificChild

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

testRemoveChildByRef

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

testProperties

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

testAddProperties

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

testDefaultPropertyOverride_AddAspect

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

testDefaultPropertyOverride_CreateNode

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

testDefaultPropertyOverride_SpecializeWithoutProperty

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

testDefaultPropertyOverride_SpecializeWithProperty

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

testRemoveProperty

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

testGetUnknownProperty

public void testGetUnknownProperty()
                            throws java.lang.Exception
Makes a read-only transaction and then looks for a property using a non-existent QName. The QName persistence must not lazily create QNameEntity instances for queries.

Throws:
java.lang.Exception

testSerializableProperties

public void testSerializableProperties()
                                throws java.lang.Exception
Ensures that the type you get out of a d:any property is the type that you put in.

Throws:
java.lang.Exception

testEncryptionAndDecryptionOfProperties

public void testEncryptionAndDecryptionOfProperties()

testEncryptedProperties

public void testEncryptedProperties()
                             throws java.lang.Exception
Check that d:encrypted properties work correctly.

Throws:
java.lang.Exception

testMultiProp

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

getExpectedPropertyValues

protected void getExpectedPropertyValues(java.util.Map checkProperties)
Apply any changes to the PROP_QNAME_XXX_VALUE used for checking the following:
        properties.put(PROP_QNAME_BOOLEAN_VALUE, true);
        properties.put(PROP_QNAME_INTEGER_VALUE, 123);
        properties.put(PROP_QNAME_LONG_VALUE, 123L);
        properties.put(PROP_QNAME_FLOAT_VALUE, 123.0F);
        properties.put(PROP_QNAME_DOUBLE_VALUE, 123.0);
        properties.put(PROP_QNAME_STRING_VALUE, "123.0");
        properties.put(PROP_QNAME_ML_TEXT_VALUE, new MLText("This is ML text in the default language"));
        properties.put(PROP_QNAME_DATE_VALUE, new Date());
        properties.put(PROP_QNAME_SERIALIZABLE_VALUE, "456");
        properties.put(PROP_QNAME_NODEREF_VALUE, rootNodeRef);
        properties.put(PROP_QNAME_QNAME_VALUE, TYPE_QNAME_TEST_CONTENT);
        properties.put(PROP_QNAME_PATH_VALUE, pathProperty);
        properties.put(PROP_QNAME_CONTENT_VALUE, new ContentData("url", "text/plain", 88L, "UTF-8"));
        properties.put(PROP_QNAME_CATEGORY_VALUE, cat);
        properties.put(PROP_QNAME_LOCALE_VALUE, Locale.CHINESE);
        properties.put(PROP_QNAME_NULL_VALUE, null);
        properties.put(PROP_QNAME_MULTI_VALUE, listProperty);
        


testPropertyTypes

public void testPropertyTypes()
                       throws java.lang.Exception
Check that properties go in and come out in the correct format.

Throws:
java.lang.Exception
See Also:
#getCheckPropertyValues(Map)

testPropertyLocaleBehaviour

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

testEmptyCollections

public void testEmptyCollections()
                          throws java.lang.Exception
Checks that empty collections can be persisted

Throws:
java.lang.Exception

testBigCollections

public void testBigCollections()
                        throws java.lang.Exception
Checks that large collections can be persisted

Throws:
java.lang.Exception

testMultiValueMLTextProperties

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

testMultivaluedSerializable

public void testMultivaluedSerializable()
                                 throws java.lang.Exception
Ensures that d:any types are handled correctly when adding values

Throws:
java.lang.Exception

testGetReferencableProperties

public void testGetReferencableProperties()
                                   throws java.lang.Exception
Checks that the referencable properties are present

Throws:
java.lang.Exception

testReferencePropertySet

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

testGetParentAssocs

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

testGetChildAssocs

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

testDuplicateChildAssocCleanup

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

testGetChildAssocsByChildType

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

testMoveNode

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

testDuplicateAssociationDetection

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

testCreateAndRemoveAssociation

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

testGetTargetAssocs

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

testTargetAssoc_Ordering

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

testGetSourceAssocs

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

testGetPath

public void testGetPath()
                 throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
BaseNodeServiceTest.buildNodeGraph()

testGetPaths

public void testGetPaths()
                  throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
BaseNodeServiceTest.buildNodeGraph()

testPrimaryPathCascadeDelete

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

testDefaultValues

public void testDefaultValues()
                       throws java.lang.Exception
Test that default values are set when nodes are created and aspects applied

Throws:
java.lang.Exception

testMandatoryAspects

public void testMandatoryAspects()

testDuplicateCatch

public void testDuplicateCatch()
                        throws java.lang.Exception
Check that the duplicate child name is detected and thrown correctly

Throws:
java.lang.Exception

testNonDuplicateAssocsWithSuppliedName

public void testNonDuplicateAssocsWithSuppliedName()
                                            throws java.lang.Throwable
Create some nodes that have the same cm:name but use associations that don't enforce uniqueness.

Throws:
java.lang.Throwable

testDuplicateAssocsWithoutSuppliedName

public void testDuplicateAssocsWithoutSuppliedName()
                                            throws java.lang.Throwable
Create some nodes that have the no cm:name and use associations that enforce uniqueness.

ALF-5001: cm:name uniqueness check can fail if the property is not set

Throws:
java.lang.Throwable

testDeleteAndAddSameName

public void testDeleteAndAddSameName()
                              throws java.lang.Exception
Checks that the unique constraint doesn't break delete and create within the same transaction.

Throws:
java.lang.Exception

testGetByName

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

testLocalizedAspect

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

testAR1303

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

onUpdateProperties

public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                               java.util.Map before,
                               java.util.Map after)

testAR782

public void testAR782()
               throws java.lang.Exception
Checks that unconvertable property values cannot be persisted.

Throws:
java.lang.Exception

testAR1414

public void testAR1414()
                throws java.lang.Exception
Check that Serializable properties do not remain connected to the L1 session

Throws:
java.lang.Exception

testGetNodeRefById

public void testGetNodeRefById()


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