diff --git a/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java b/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java index 69561c5380..cbfb869b4b 100644 --- a/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java +++ b/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java @@ -1109,55 +1109,55 @@ public class MultiTDemoTest extends TestCase public void testCustomModels() { -// logger.info("test custom models"); -// -// final int defaultModelCnt = dictionaryService.getAllModels().size(); -// -// for (final String tenantDomain : tenants) -// { -// final String tenantAdminName = tenantService.getDomainUser(AuthenticationUtil.getAdminUserName(), tenantDomain); -// -// AuthenticationUtil.runAs(new RunAsWork() -// { -// public Object doWork() throws Exception -// { -// // no custom models should be deployed yet (note: will fail if re-run) -// assertEquals(0, repoAdminService.getModels().size()); -// assertEquals(defaultModelCnt, dictionaryService.getAllModels().size()); -// assertNull(dictionaryService.getClass(QName.createQName("{my.new.model}sop"))); -// -// // deploy custom model -// InputStream modelStream = getClass().getClassLoader().getResourceAsStream("tenant/exampleModel.xml"); -// repoAdminService.deployModel(modelStream, "exampleModel.xml"); -// -// assertEquals(1, repoAdminService.getModels().size()); -// assertEquals(defaultModelCnt+1, dictionaryService.getAllModels().size()); -// -// ClassDefinition myType = dictionaryService.getClass(QName.createQName("{my.new.model}sop")); -// assertNotNull(myType); -// assertEquals(QName.createQName("{my.new.model}mynewmodel"),myType.getModel().getName()); -// -// // deactivate model -// repoAdminService.deactivateModel("exampleModel.xml"); -// -// assertEquals(1, repoAdminService.getModels().size()); // still deployed, although not active -// assertEquals(defaultModelCnt, dictionaryService.getAllModels().size()); -// assertNull(dictionaryService.getClass(QName.createQName("{my.new.model}sop"))); -// -// // re-activate model -// repoAdminService.activateModel("exampleModel.xml"); -// -// assertEquals(1, repoAdminService.getModels().size()); -// assertEquals(defaultModelCnt+1, dictionaryService.getAllModels().size()); -// -// myType = dictionaryService.getClass(QName.createQName("{my.new.model}sop")); -// assertNotNull(myType); -// assertEquals(QName.createQName("{my.new.model}mynewmodel"),myType.getModel().getName()); -// -// return null; -// } -// }, tenantAdminName); -// } + logger.info("test custom models"); + + final int defaultModelCnt = dictionaryService.getAllModels().size(); + + for (final String tenantDomain : tenants) + { + final String tenantAdminName = tenantService.getDomainUser(AuthenticationUtil.getAdminUserName(), tenantDomain); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() throws Exception + { + // no custom models should be deployed yet (note: will fail if re-run) + assertEquals(0, repoAdminService.getModels().size()); + assertEquals(defaultModelCnt, dictionaryService.getAllModels().size()); + assertNull(dictionaryService.getClass(QName.createQName("{my.new.model}sop"))); + + // deploy custom model + InputStream modelStream = getClass().getClassLoader().getResourceAsStream("tenant/exampleModel.xml"); + repoAdminService.deployModel(modelStream, "exampleModel.xml"); + + assertEquals(1, repoAdminService.getModels().size()); + assertEquals(defaultModelCnt+1, dictionaryService.getAllModels().size()); + + ClassDefinition myType = dictionaryService.getClass(QName.createQName("{my.new.model}sop")); + assertNotNull(myType); + assertEquals(QName.createQName("{my.new.model}mynewmodel"),myType.getModel().getName()); + + // deactivate model + repoAdminService.deactivateModel("exampleModel.xml"); + + assertEquals(1, repoAdminService.getModels().size()); // still deployed, although not active + assertEquals(defaultModelCnt, dictionaryService.getAllModels().size()); + assertNull(dictionaryService.getClass(QName.createQName("{my.new.model}sop"))); + + // re-activate model + repoAdminService.activateModel("exampleModel.xml"); + + assertEquals(1, repoAdminService.getModels().size()); + assertEquals(defaultModelCnt+1, dictionaryService.getAllModels().size()); + + myType = dictionaryService.getClass(QName.createQName("{my.new.model}sop")); + assertNotNull(myType); + assertEquals(QName.createQName("{my.new.model}mynewmodel"),myType.getModel().getName()); + + return null; + } + }, tenantAdminName); + } } public void testAddCustomWebClient() diff --git a/source/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowEngine.java b/source/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowEngine.java index 39cb630add..aa355dc1ac 100644 --- a/source/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowEngine.java +++ b/source/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowEngine.java @@ -573,7 +573,7 @@ public class ActivitiWorkflowEngine extends BPMEngine implements WorkflowEngine // This should return all task definitions, including the start-task ReadOnlyProcessDefinition processDefinition =((RepositoryServiceImpl)repoService).getDeployedProcessDefinition(processDefinitionId); - String processName = processDefinition.getName(); + String processName = ((ProcessDefinition)processDefinition).getKey(); factory.checkDomain(processName); // Process start task definition