Search in sources :

Example 6 with DeploymentStore

use of org.jbpm.kie.services.impl.store.DeploymentStore in project jbpm by kiegroup.

the class DeploymentServiceEJBWithSyncIntegrationTest method testUndeploymentOfProcessesBySync.

@Test
public void testUndeploymentOfProcessesBySync() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(2);
    DeploymentStore store = new DeploymentStore();
    store.setCommandService(commandService);
    Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(0, deployed.size());
    KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(unit);
    units.add(unit);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
    countDownListener.waitTillCompleted(1000);
    store.disableDeploymentUnit(unit);
    countDownListener.waitTillCompleted(10000);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(0, deployed.size());
}
Also used : DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore) CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) Test(org.junit.Test)

Example 7 with DeploymentStore

use of org.jbpm.kie.services.impl.store.DeploymentStore in project jbpm by kiegroup.

the class DeploymentServiceEJBWithSyncIntegrationTest method testDeploymentOfProcessesBySync.

@Test
public void testDeploymentOfProcessesBySync() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(1);
    DeploymentStore store = new DeploymentStore();
    store.setCommandService(commandService);
    Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(0, deployed.size());
    KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    store.enableDeploymentUnit(unit);
    units.add(unit);
    countDownListener.waitTillCompleted(10000);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
}
Also used : DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore) CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) Test(org.junit.Test)

Example 8 with DeploymentStore

use of org.jbpm.kie.services.impl.store.DeploymentStore in project jbpm by kiegroup.

the class DeploymentServiceCDIImplWithSyncTest method configureDeploymentSync.

@Override
protected void configureDeploymentSync() {
    store = new DeploymentStore();
    store.setCommandService(commandService);
}
Also used : DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore)

Example 9 with DeploymentStore

use of org.jbpm.kie.services.impl.store.DeploymentStore in project jbpm by kiegroup.

the class DeploymentSynchronizerEJBImpl method configure.

@PostConstruct
public void configure() {
    DeploymentStore store = new DeploymentStore();
    store.setCommandService(commandService);
    setDeploymentStore(store);
    if (DEPLOY_SYNC_ENABLED) {
        ScheduleExpression schedule = new ScheduleExpression();
        schedule.hour("*");
        schedule.minute("*");
        schedule.second("*/" + DEPLOY_SYNC_INTERVAL);
        timer = timerService.createCalendarTimer(schedule, new TimerConfig(null, false));
    }
}
Also used : ScheduleExpression(javax.ejb.ScheduleExpression) DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore) TimerConfig(javax.ejb.TimerConfig) PostConstruct(javax.annotation.PostConstruct)

Example 10 with DeploymentStore

use of org.jbpm.kie.services.impl.store.DeploymentStore in project jbpm by kiegroup.

the class DeploymentServiceEJBWithSyncIntegrationTest method testDeactivateAndActivateOfProcessesBySync.

@Test
public void testDeactivateAndActivateOfProcessesBySync() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(2);
    DeploymentStore store = new DeploymentStore();
    store.setCommandService(commandService);
    Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(0, deployed.size());
    KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(unit);
    units.add(unit);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
    assertTrue(deployed.iterator().next().isActive());
    store.deactivateDeploymentUnit(unit);
    countDownListener.waitTillCompleted(10000);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
    assertFalse(deployed.iterator().next().isActive());
    store.activateDeploymentUnit(unit);
    countDownListener.reset(1);
    countDownListener.waitTillCompleted(10000);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
    assertTrue(deployed.iterator().next().isActive());
}
Also used : DeploymentStore(org.jbpm.kie.services.impl.store.DeploymentStore) CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) Test(org.junit.Test)

Aggregations

DeploymentStore (org.jbpm.kie.services.impl.store.DeploymentStore)10 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)4 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)4 Test (org.junit.Test)4 CoundDownDeploymentListener (org.jbpm.kie.services.test.objects.CoundDownDeploymentListener)3 TransactionalCommandService (org.jbpm.shared.services.impl.TransactionalCommandService)3 PostConstruct (javax.annotation.PostConstruct)2 DeploymentSyncInvoker (org.jbpm.kie.services.impl.store.DeploymentSyncInvoker)2 DeploymentSynchronizer (org.jbpm.kie.services.impl.store.DeploymentSynchronizer)2 ScheduleExpression (javax.ejb.ScheduleExpression)1 TimerConfig (javax.ejb.TimerConfig)1 DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)1 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)1 Before (org.junit.Before)1 QueryContext (org.kie.api.runtime.query.QueryContext)1 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)1