@BeforeClass
  public static void initTestsContext() throws Exception {
    ApplicationContext testContext = APP_CONTEXT_INIT.getApplicationContext();

    PRIVATE_REMOTE_CREDENTIALS_SERVICE =
        (RemoteCredentialsService) testContext.getBean("remoteCredentialsService");
    REMOTE_CREDENTIALS_SERVICE =
        (RemoteCredentialsService) testContext.getBean("RemoteCredentialsService");

    AUTHENTICATION_SERVICE =
        (MutableAuthenticationService) testContext.getBean("authenticationService");
    BEHAVIOUR_FILTER = (BehaviourFilter) testContext.getBean("policyBehaviourFilter");
    DICTIONARY_SERVICE = (DictionaryService) testContext.getBean("dictionaryService");
    NAMESPACE_SERVICE = (NamespaceService) testContext.getBean("namespaceService");
    REPOSITORY_HELPER = (Repository) testContext.getBean("repositoryHelper");
    NODE_SERVICE = (NodeService) testContext.getBean("nodeService");
    PUBLIC_NODE_SERVICE = (NodeService) testContext.getBean("NodeService");
    PERSON_SERVICE = (PersonService) testContext.getBean("personService");
    TRANSACTION_HELPER =
        (RetryingTransactionHelper) testContext.getBean("retryingTransactionHelper");
    TRANSACTION_SERVICE = (TransactionService) testContext.getBean("TransactionService");
    PERMISSION_SERVICE = (PermissionService) testContext.getBean("permissionService");

    // Switch to a test shared system container
    RemoteCredentialsServiceImpl.setSharedCredentialsSystemContainerName(
        SHARED_SYSTEM_CONTAINER_NAME);
  }