Buggy code:
@ RunWith ( SpringInstanceTestClassRunner . class ) @ ContextConfiguration ( "classpath:alfresco//application-context.xml" ) public abstract class AbstractRepoIntegrationTest implements InstanceTestClassListener { private static final Logger LOG = Logger . getLogger ( AbstractRepoIntegrationTest . class ) ; private static final String NAMESPACE_BEGIN = "" + ( QName . NAMESPACE_BEGIN ) ; private ThreadLocal < Boolean > _requiresNew = new ThreadLocal < Boolean > ( ) ; @ Autowired @ Qualifier ( "authenticationComponent" ) protected AuthenticationComponent _authenticationComponent ; @ Autowired @ Qualifier ( "TransactionService" ) protected TransactionService _transactionService ; protected static RetryingTransactionHelper _transactionHelper ; @ Autowired @ Qualifier ( "policyBehaviourFilter" ) protected BehaviourFilter _behaviourFilter ; @ Autowired @ Qualifier ( "repositoryHelper" ) protected Repository _repository ; @ Autowired @ Qualifier ( "SiteService" ) protected SiteService _siteService ; @ Autowired @ Qualifier ( "AuthenticationService" ) protected MutableAuthenticationService _authenticationService ; @ Autowired @ Qualifier ( "PersonService" ) protected PersonService _personService ; @ Autowired @ Qualifier ( "NodeService" ) protected NodeService _nodeService ; @ Autowired @ Qualifier ( "FileFolderService" ) protected FileFolderService _fileFolderService ; @ Autowired @ Qualifier ( "NamespaceService" ) protected NamespaceService _namespaceService ; @ Autowired @ Qualifier ( "ContentService" ) protected ContentService _contentService ; @ Autowired @ Qualifier ( "WorkflowService" ) protected WorkflowService _workflowService ; @ Autowired @ Qualifier ( "global-properties" ) protected Properties _properties ; @ Resource ( name = "OwnableService" ) private OwnableService _ownableService ; @ Override public void beforeClassSetup ( ) { } @ Override public void afterClassSetup ( ) { } protected NodeRef createUser ( String userId ) { } protected NodeRef createUser ( final String userId , final AbstractRepoIntegrationTest . CreateUserCallback callback ) { } protected void deleteUser ( final NodeRef personRef ) { } protected void deleteUser ( final String userName ) { } protected SiteInfo createSite ( final String preset , final String siteName , final SiteVisibility visibility , final QName siteType , final AbstractRepoIntegrationTest . CreateSiteCallback callback ) { } protected SiteInfo createSite ( final String preset ) { } protected SiteInfo createSite ( ) { } protected void deleteSite ( SiteInfo siteInfo ) { } protected void deleteSite ( final SiteInfo siteInfo , final AbstractRepoIntegrationTest . BeforeDeleteSiteCallback callback ) { } protected FileInfo uploadDocument ( SiteInfo site , String filename ) { } protected FileInfo uploadDocument ( SiteInfo site , String filename , InputStream inputStream ) { } protected FileInfo uploadDocument ( SiteInfo site , String filename , InputStream inputStream , List < String > folders ) { } protected FileInfo uploadDocument ( SiteInfo site , String filename , InputStream inputStream , List < String > folders , String name ) { } protected FileInfo uploadDocument ( SiteInfo site , String filename , InputStream inputStream , List < String > folders , String name , NodeRef parentNodeRef ) { } protected FileInfo uploadDocument ( SiteInfo site , String filename , InputStream inputStream , List < String > folders , String name , NodeRef parentNodeRef , String type ) { } protected FileInfo uploadDocument ( final SiteInfo site , final String filename , final InputStream inputStream , final List < String > folders , final String name , final NodeRef parentNodeRef , final String type , final Map < QName , Serializable > properties ) { return AbstractRepoIntegrationTest . _transactionHelper . doInTransaction ( new org . alfresco . repo . transaction . RetryingTransactionHelper . RetryingTransactionCallback < FileInfo > ( ) { @ Override public FileInfo execute ( ) throws Throwable { String finalName = ( StringUtils . isNotEmpty ( name ) ) ? name : FilenameUtils . getName ( filename ) ; NodeRef documentLibrary = ( site != null ) ? _siteService . getContainer ( site . getShortName ( ) , DOCUMENT_LIBRARY ) : _repository . getUserHome ( _repository . getPerson ( ) ) ; NodeRef finalParentNodeRef = ( parentNodeRef != null ) ? parentNodeRef : documentLibrary ; if ( folders != null ) { for ( String folder : folders ) { FileInfo folderInfo = _fileFolderService . create ( finalParentNodeRef , folder , TYPE_FOLDER ) ; finalParentNodeRef = folderInfo . getNodeRef ( ) ; } } QName nodeTypeQName = ( type == null ) ? ContentModel . TYPE_CONTENT : createQName ( type ) ; QName assocQName = QName . createQName ( CONTENT_MODEL_1_0_URI , QName . createValidLocalName ( finalName ) ) ; Map < QName , Serializable > creationProperites = ( properties != null ) ? properties : new HashMap < QName , Serializable > ( ) ; if ( ! ( creationProperites . containsKey ( PROP_NAME ) ) ) { <START_BUG> creationProperites . put ( PROP_NAME , filename ) ; <END_BUG> } final NodeRef document = _nodeService . createNode ( finalParentNodeRef , ASSOC_CONTAINS , assocQName , nodeTypeQName , creationProperites ) . getChildRef ( ) ; AuthenticationUtil . runAsSystem ( new org . alfresco . repo . security . authentication . AuthenticationUtil . RunAsWork < Void > ( ) { @ Override public Void doWork ( ) throws Exception { String username = AuthenticationUtil . getFullyAuthenticatedUser ( ) ; AbstractRepoIntegrationTest . LOG . debug ( ( ( ( ( "Setting<seq2seq4repair_space>owner<seq2seq4repair_space>of<seq2seq4repair_space>'" + document ) + "'<seq2seq4repair_space>to<seq2seq4repair_space>'" ) + username ) + "'" ) ) ; _ownableService . setOwner ( document , username ) ; return null ; } } ) ; FileInfo fileInfo = _fileFolderService . getFileInfo ( document ) ; ContentWriter writer = _contentService . getWriter ( document , PROP_CONTENT , true ) ; writer . guessEncoding ( ) ; writer . guessMimetype ( filename ) ; InputStream content = ( inputStream != null ) ? inputStream : Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( filename ) ; try { writer . putContent ( content ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } finally { IOUtils . closeQuietly ( content ) ; } return fileInfo ; } } , false , _requiresNew . get ( ) ) ; } protected QName createQName ( String s ) { }

Fix:
creationProperites . put ( PROP_NAME , finalName ) ;