RepositorySession repositorySession = mock( RepositorySession.class );
when( repositorySession.getRepository() ).thenReturn( metadataRepository );
RepositorySessionFactory repositorySessionFactory = mock( RepositorySessionFactory.class );
when( repositorySessionFactory.createSession() ).thenReturn( repositorySession );
listenerControl = MockControl.createControl( RepositoryListener.class );
listener = (RepositoryListener) listenerControl.getMock();
roleManagerControl = MockControl.createControl( RoleManager.class );