/** On setup in transaction override */ @Override protected void onSetUpInTransaction() throws Exception { super.onSetUpInTransaction(); // Get a reference to the node service this.nodeService = (NodeService) this.applicationContext.getBean("nodeService"); this.contentService = (ContentService) this.applicationContext.getBean("contentService"); this.authenticationService = (MutableAuthenticationService) this.applicationContext.getBean("authenticationService"); this.actionService = (ActionService) this.applicationContext.getBean("actionService"); this.transactionService = (TransactionService) this.applicationContext.getBean("transactionComponent"); // Authenticate as the system user authenticationComponent = (AuthenticationComponent) this.applicationContext.getBean("authenticationComponent"); authenticationComponent.setSystemUserAsCurrentUser(); // Create the store and get the root node this.storeRef = this.nodeService.createStore( StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); this.rootNodeRef = this.nodeService.getRootNode(this.storeRef); }
@Override protected void onTearDownInTransaction() throws Exception { authenticationService.clearCurrentSecurityContext(); super.onTearDownInTransaction(); }