use of org.jbpm.kie.services.impl.KModuleDeploymentService in project jbpm by kiegroup.
the class AbstractCaseServicesBaseTest method configureServices.
protected void configureServices() {
buildDatasource();
emf = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.domain");
identityProvider = new TestIdentityProvider();
authorizationManager = new AuthorizationManagerImpl(identityProvider, new TransactionalCommandService(emf));
// build definition service
bpmn2Service = new BPMN2DataServiceImpl();
DeploymentRolesManager deploymentRolesManager = new DeploymentRolesManager();
queryService = new QueryServiceImpl();
((QueryServiceImpl) queryService).setIdentityProvider(identityProvider);
((QueryServiceImpl) queryService).setCommandService(new TransactionalCommandService(emf));
((QueryServiceImpl) queryService).init();
// build deployment service
deploymentService = new KModuleDeploymentService();
((KModuleDeploymentService) deploymentService).setBpmn2Service(bpmn2Service);
((KModuleDeploymentService) deploymentService).setEmf(emf);
((KModuleDeploymentService) deploymentService).setIdentityProvider(identityProvider);
((KModuleDeploymentService) deploymentService).setManagerFactory(new RuntimeManagerFactoryImpl());
((KModuleDeploymentService) deploymentService).setFormManagerService(new FormManagerServiceImpl());
TaskService taskService = HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).getTaskService();
// build runtime data service
runtimeDataService = new RuntimeDataServiceImpl();
((RuntimeDataServiceImpl) runtimeDataService).setCommandService(new TransactionalCommandService(emf));
((RuntimeDataServiceImpl) runtimeDataService).setIdentityProvider(identityProvider);
((RuntimeDataServiceImpl) runtimeDataService).setTaskService(taskService);
((RuntimeDataServiceImpl) runtimeDataService).setDeploymentRolesManager(deploymentRolesManager);
((RuntimeDataServiceImpl) runtimeDataService).setTaskAuditService(TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService());
((KModuleDeploymentService) deploymentService).setRuntimeDataService(runtimeDataService);
// build process service
processService = new ProcessServiceImpl();
((ProcessServiceImpl) processService).setDataService(runtimeDataService);
((ProcessServiceImpl) processService).setDeploymentService(deploymentService);
// build user task service
userTaskService = new UserTaskServiceImpl();
((UserTaskServiceImpl) userTaskService).setDataService(runtimeDataService);
((UserTaskServiceImpl) userTaskService).setDeploymentService(deploymentService);
// build case id generator
caseIdGenerator = new TableCaseIdGenerator(new TransactionalCommandService(emf));
// build case runtime data service
caseRuntimeDataService = new CaseRuntimeDataServiceImpl();
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setCaseIdGenerator(caseIdGenerator);
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setRuntimeDataService(runtimeDataService);
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setCommandService(new TransactionalCommandService(emf));
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setIdentityProvider(identityProvider);
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setDeploymentRolesManager(deploymentRolesManager);
// build case service
caseService = new CaseServiceImpl();
((CaseServiceImpl) caseService).setCaseIdGenerator(caseIdGenerator);
((CaseServiceImpl) caseService).setCaseRuntimeDataService(caseRuntimeDataService);
((CaseServiceImpl) caseService).setProcessService(processService);
((CaseServiceImpl) caseService).setDeploymentService(deploymentService);
((CaseServiceImpl) caseService).setRuntimeDataService(runtimeDataService);
((CaseServiceImpl) caseService).setCommandService(new TransactionalCommandService(emf));
((CaseServiceImpl) caseService).setAuthorizationManager(authorizationManager);
((CaseServiceImpl) caseService).setIdentityProvider(identityProvider);
CaseConfigurationDeploymentListener configurationListener = new CaseConfigurationDeploymentListener(identityProvider);
// set runtime data service as listener on deployment service
((KModuleDeploymentService) deploymentService).addListener((RuntimeDataServiceImpl) runtimeDataService);
((KModuleDeploymentService) deploymentService).addListener((BPMN2DataServiceImpl) bpmn2Service);
((KModuleDeploymentService) deploymentService).addListener((QueryServiceImpl) queryService);
((KModuleDeploymentService) deploymentService).addListener((CaseRuntimeDataServiceImpl) caseRuntimeDataService);
((KModuleDeploymentService) deploymentService).addListener(configurationListener);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentService in project jbpm by kiegroup.
the class DeactivateDeploymentServiceWithSyncTest method testDeactivateDeploymentBySync.
@Test
public void testDeactivateDeploymentBySync() throws Exception {
Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(unit);
deploymentService.deactivate(unit.getIdentifier());
((KModuleDeploymentService) deploymentService).shutdown();
sync.clear();
AtomicBoolean deploymentActive = new AtomicBoolean(true);
CoundDownDeploymentListener countDownListener = new CoundDownDeploymentListener(1) {
@Override
public void onDeploy(DeploymentEvent event) {
// This used to use a specific listener for setting the active state
deploymentActive.set(event.getDeployedUnit().isActive());
super.onDeploy(event);
}
};
countDownListener.setDeploy(true);
((ListenerSupport) deploymentService).addListener(countDownListener);
invoker.start();
countDownListener.waitTillCompleted();
assertFalse("Deployment should be deactivated", deploymentActive.get());
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentService in project jbpm by kiegroup.
the class PostDeploymentServiceTest method testDuplicatedDeployment.
@Test
public void testDuplicatedDeployment() {
assertNotNull(deploymentService);
((KModuleDeploymentService) deploymentService).addListener(new DeploymentEventListener() {
@Override
public void onUnDeploy(DeploymentEvent event) {
}
@Override
public void onDeploy(DeploymentEvent event) {
throw new IllegalArgumentException("On purpose");
}
@Override
public void onActivate(DeploymentEvent event) {
}
@Override
public void onDeactivate(DeploymentEvent event) {
}
});
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION, "KBase-test", "ksession-test");
try {
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
fail("Deployment should fail due to post process failuer - see ThrowExceptionOnDeploymentEvent");
} catch (RuntimeException e) {
}
DeployedUnit deployedGeneral = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNull(deployedGeneral);
assertFalse(RuntimeManagerRegistry.get().isRegistered(deploymentUnit.getIdentifier()));
}
use of org.jbpm.kie.services.impl.KModuleDeploymentService in project jbpm by kiegroup.
the class AbstractKieServicesBaseTest method configureServices.
protected void configureServices() {
buildDatasource();
emf = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.domain");
identityProvider = new TestIdentityProvider();
formManagerService = new FormManagerServiceImpl();
// build definition service
bpmn2Service = new BPMN2DataServiceImpl();
queryService = new QueryServiceImpl();
((QueryServiceImpl) queryService).setIdentityProvider(identityProvider);
((QueryServiceImpl) queryService).setCommandService(new TransactionalCommandService(emf));
((QueryServiceImpl) queryService).init();
// build deployment service
deploymentService = new KModuleDeploymentService();
((KModuleDeploymentService) deploymentService).setBpmn2Service(bpmn2Service);
((KModuleDeploymentService) deploymentService).setEmf(emf);
((KModuleDeploymentService) deploymentService).setIdentityProvider(identityProvider);
((KModuleDeploymentService) deploymentService).setManagerFactory(new RuntimeManagerFactoryImpl());
((KModuleDeploymentService) deploymentService).setFormManagerService(formManagerService);
TaskService taskService = HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).getTaskService();
// build runtime data service
runtimeDataService = new RuntimeDataServiceImpl();
((RuntimeDataServiceImpl) runtimeDataService).setCommandService(new TransactionalCommandService(emf));
((RuntimeDataServiceImpl) runtimeDataService).setIdentityProvider(identityProvider);
((RuntimeDataServiceImpl) runtimeDataService).setTaskService(taskService);
((RuntimeDataServiceImpl) runtimeDataService).setTaskAuditService(TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService());
((KModuleDeploymentService) deploymentService).setRuntimeDataService(runtimeDataService);
// set runtime data service as listener on deployment service
((KModuleDeploymentService) deploymentService).addListener(((RuntimeDataServiceImpl) runtimeDataService));
((KModuleDeploymentService) deploymentService).addListener(((BPMN2DataServiceImpl) bpmn2Service));
((KModuleDeploymentService) deploymentService).addListener(((QueryServiceImpl) queryService));
// build process service
processService = new ProcessServiceImpl();
((ProcessServiceImpl) processService).setDataService(runtimeDataService);
((ProcessServiceImpl) processService).setDeploymentService(deploymentService);
// build user task service
userTaskService = new UserTaskServiceImpl();
((UserTaskServiceImpl) userTaskService).setDataService(runtimeDataService);
((UserTaskServiceImpl) userTaskService).setDeploymentService(deploymentService);
}
Aggregations