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.service.cmr.repository.NodeRef; 22 import org.alfresco.service.namespace.QName; 23 import org.alfresco.util.BaseAlfrescoSpringTest; 24 import org.alfresco.util.GUID; 25 26 31 public class SpecialiseTypeActionExecuterTest extends BaseAlfrescoSpringTest 32 { 33 36 private NodeRef nodeRef; 37 38 41 private SpecialiseTypeActionExecuter executer; 42 43 46 private final static String ID = GUID.generate(); 47 48 51 @Override 52 protected void onSetUpInTransaction() throws Exception 53 { 54 super.onSetUpInTransaction(); 55 56 this.nodeRef = this.nodeService.createNode( 58 this.rootNodeRef, 59 ContentModel.ASSOC_CHILDREN, 60 QName.createQName("{test}testnode"), 61 ContentModel.TYPE_CONTENT).getChildRef(); 62 63 this.executer = (SpecialiseTypeActionExecuter)this.applicationContext.getBean(SpecialiseTypeActionExecuter.NAME); 65 } 66 67 70 public void testExecution() 71 { 72 assertEquals(ContentModel.TYPE_CONTENT, this.nodeService.getType(this.nodeRef)); 74 75 ActionImpl action = new ActionImpl(ID, SpecialiseTypeActionExecuter.NAME, null); 77 action.setParameterValue(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME, ContentModel.TYPE_FOLDER); 78 this.executer.execute(action, this.nodeRef); 79 80 assertEquals(ContentModel.TYPE_CONTENT, this.nodeService.getType(this.nodeRef)); 82 83 action.setParameterValue(SpecialiseTypeActionExecuter.PARAM_TYPE_NAME, ContentModel.TYPE_DICTIONARY_MODEL); 85 this.executer.execute(action, this.nodeRef); 86 87 assertEquals(ContentModel.TYPE_DICTIONARY_MODEL, this.nodeService.getType(this.nodeRef)); 89 } 90 } 91 | Popular Tags |