first show that both behaviours are enabled and triggered for a sub- (child) instance
* @throws Exception */ public void testChildParentBehaviours1() throws Exception { TestOnCreateNodePolicy baseTypeBehavior = new TestOnCreateNodePolicy(); TestOnCreateNodePolicy fileTypeBehavior = new TestOnCreateNodePolicy(); // bind custom behavior for parent type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, BASE_TYPE, new JavaBehaviour(baseTypeBehavior, "onCreateNode")); // bind custom behavior for child type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, FILE_TYPE, new JavaBehaviour(fileTypeBehavior, "onCreateNode")); UserTransaction transaction = trxService.getUserTransaction(); try { transaction.begin(); final String name = "Test (" + System.currentTimeMillis() + ").docx"; final Mapthen disable the super- behaviour only and show that sub behaviour is still enabled and triggered
* @throws Exception */ public void testChildParentBehaviours2() throws Exception { TestOnCreateNodePolicy baseTypeBehavior = new TestOnCreateNodePolicy(); TestOnCreateNodePolicy fileTypeBehavior = new TestOnCreateNodePolicy(); // bind custom behavior for parent type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, BASE_TYPE, new JavaBehaviour(baseTypeBehavior, "onCreateNode")); // bind custom behavior for child type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, FILE_TYPE, new JavaBehaviour(fileTypeBehavior, "onCreateNode")); UserTransaction transaction = trxService.getUserTransaction(); try { transaction.begin(); // disable behavior for parent type behaviourFilter.disableBehaviour(BASE_TYPE); // check that behavior is disabled correctly try { checkBehaviour(BASE_TYPE, companyHome, true, false, false, true); final String name = "Test (" + System.currentTimeMillis() + ").docx"; final Mapthen also disable the sub- behaviour and show that neither behaviour is triggered
* @throws Exception */ public void testChildParentBehaviours3() throws Exception { TestOnCreateNodePolicy baseTypeBehavior = new TestOnCreateNodePolicy(); TestOnCreateNodePolicy fileTypeBehavior = new TestOnCreateNodePolicy(); // bind custom behavior for parent type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, BASE_TYPE, new JavaBehaviour(baseTypeBehavior, "onCreateNode")); // bind custom behavior for child type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, FILE_TYPE, new JavaBehaviour(fileTypeBehavior, "onCreateNode")); UserTransaction transaction = trxService.getUserTransaction(); try { transaction.begin(); // disable behavior for parent type behaviourFilter.disableBehaviour(BASE_TYPE); // check that behavior is disabled correctly checkBehaviour(BASE_TYPE, companyHome, true, false, false, true); // disable behavior for child type behaviourFilter.disableBehaviour(FILE_TYPE); // check that behavior is disabled correctly checkBehaviour(FILE_TYPE, companyHome, true, false, false, true); try { final String name = "Test (" + System.currentTimeMillis() + ").docx"; final Mapthen vice-versa, ie. disabling sub- behaviour does not disable inherited super- behaviours
* @throws Exception */ public void testChildParentBehaviours4() throws Exception { TestOnCreateNodePolicy baseTypeBehavior = new TestOnCreateNodePolicy(); TestOnCreateNodePolicy fileTypeBehavior = new TestOnCreateNodePolicy(); // bind custom behavior for parent type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, BASE_TYPE, new JavaBehaviour(baseTypeBehavior, "onCreateNode")); // bind custom behavior for child type policyComponent.bindClassBehaviour(OnCreateNodePolicy.QNAME, FILE_TYPE, new JavaBehaviour(fileTypeBehavior, "onCreateNode")); UserTransaction transaction = trxService.getUserTransaction(); try { transaction.begin(); // disable behavior for child type behaviourFilter.disableBehaviour(FILE_TYPE); // check that behavior is disabled correctly checkBehaviour(FILE_TYPE, companyHome, true, false, false, true); try { final String name = "Test (" + System.currentTimeMillis() + ").docx"; final Map