1 17 package org.alfresco.repo.action.executer; 18 19 import org.alfresco.model.ContentModel; 20 import org.alfresco.repo.action.ActionImpl; 21 import org.alfresco.repo.security.authentication.AuthenticationComponent; 22 import org.alfresco.service.cmr.repository.NodeRef; 23 import org.alfresco.service.cmr.repository.NodeService; 24 import org.alfresco.service.cmr.repository.StoreRef; 25 import org.alfresco.service.namespace.QName; 26 import org.alfresco.util.BaseSpringTest; 27 import org.alfresco.util.GUID; 28 29 34 public class AddFeaturesActionExecuterTest extends BaseSpringTest 35 { 36 39 private NodeService nodeService; 40 41 44 private StoreRef testStoreRef; 45 46 49 private NodeRef rootNodeRef; 50 51 54 private NodeRef nodeRef; 55 56 59 private AddFeaturesActionExecuter executer; 60 61 64 private final static String ID = GUID.generate(); 65 66 69 @Override 70 protected void onSetUpInTransaction() throws Exception 71 { 72 this.nodeService = (NodeService)this.applicationContext.getBean("nodeService"); 73 74 AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); 75 authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); 76 77 this.testStoreRef = this.nodeService.createStore( 79 StoreRef.PROTOCOL_WORKSPACE, "Test_" 80 + System.currentTimeMillis()); 81 this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef); 82 83 this.nodeRef = this.nodeService.createNode( 85 this.rootNodeRef, 86 ContentModel.ASSOC_CHILDREN, 87 QName.createQName("{test}testnode"), 88 ContentModel.TYPE_CONTENT).getChildRef(); 89 90 this.executer = (AddFeaturesActionExecuter)this.applicationContext.getBean(AddFeaturesActionExecuter.NAME); 92 } 93 94 97 public void testExecution() 98 { 99 assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_CLASSIFIABLE)); 101 102 ActionImpl action = new ActionImpl(ID, AddFeaturesActionExecuter.NAME, null); 104 action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_CLASSIFIABLE); 105 this.executer.execute(action, this.nodeRef); 106 107 assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_CLASSIFIABLE)); 109 } 110 } 111 | Popular Tags |