Search in sources :

Example 6 with CoundDownDeploymentListener

use of org.jbpm.kie.services.test.objects.CoundDownDeploymentListener 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 7 with CoundDownDeploymentListener

use of org.jbpm.kie.services.test.objects.CoundDownDeploymentListener in project jbpm by kiegroup.

the class DeploymentServiceWithSyncTest method testDeactivateAndActivateOfProcessesBySync.

@Test
public void testDeactivateAndActivateOfProcessesBySync() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(2, false, false, true, true);
    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 : CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 8 with CoundDownDeploymentListener

use of org.jbpm.kie.services.test.objects.CoundDownDeploymentListener in project jbpm by kiegroup.

the class DeploymentServiceWithSyncTest method configureListener.

protected CoundDownDeploymentListener configureListener(int threads, boolean deploy, boolean undeploy, boolean activate, boolean deactivate) {
    CoundDownDeploymentListener countDownListener = new CoundDownDeploymentListener(threads);
    ((ListenerSupport) deploymentService).addListener(countDownListener);
    return countDownListener;
}
Also used : CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) ListenerSupport(org.jbpm.services.api.ListenerSupport)

Example 9 with CoundDownDeploymentListener

use of org.jbpm.kie.services.test.objects.CoundDownDeploymentListener in project jbpm by kiegroup.

the class DeploymentServiceEJBWithSyncIntegrationTest method configureListener.

protected CoundDownDeploymentListener configureListener(int threads) {
    CoundDownDeploymentListener countDownListener = new CoundDownDeploymentListener(threads);
    ((ListenerSupport) deploymentService).addListener(countDownListener);
    return countDownListener;
}
Also used : CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) ListenerSupport(org.jbpm.services.api.ListenerSupport)

Example 10 with CoundDownDeploymentListener

use of org.jbpm.kie.services.test.objects.CoundDownDeploymentListener 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

CoundDownDeploymentListener (org.jbpm.kie.services.test.objects.CoundDownDeploymentListener)10 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)8 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)8 Test (org.junit.Test)8 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)5 DeploymentStore (org.jbpm.kie.services.impl.store.DeploymentStore)3 ListenerSupport (org.jbpm.services.api.ListenerSupport)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 KModuleDeploymentService (org.jbpm.kie.services.impl.KModuleDeploymentService)1 DeploymentEvent (org.jbpm.services.api.DeploymentEvent)1