Search in sources :

Example 1 with CoundDownDeploymentListener

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

the class DeploymentServiceWithSyncTest method testDeploymentOfProcessesBySyncWithDisabledAttribute.

@Test
public void testDeploymentOfProcessesBySyncWithDisabledAttribute() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(1, true, false, false, false);
    Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(0, deployed.size());
    KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    unit.addAttribute("sync", "false");
    store.enableDeploymentUnit(unit);
    units.add(unit);
    countDownListener.waitTillCompleted(4000);
    deployed = deploymentService.getDeployedUnits();
    assertNotNull(deployed);
    assertEquals(0, deployed.size());
}
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 2 with CoundDownDeploymentListener

use of org.jbpm.kie.services.test.objects.CoundDownDeploymentListener 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());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) KModuleDeploymentService(org.jbpm.kie.services.impl.KModuleDeploymentService) CoundDownDeploymentListener(org.jbpm.kie.services.test.objects.CoundDownDeploymentListener) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) ListenerSupport(org.jbpm.services.api.ListenerSupport) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentEvent(org.jbpm.services.api.DeploymentEvent) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 3 with CoundDownDeploymentListener

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

the class DeploymentServiceWithSyncTest method testDeploymentOfProcessesBySync.

@Test
public void testDeploymentOfProcessesBySync() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(1, true, false, false, false);
    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 : 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 4 with CoundDownDeploymentListener

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

the class DeploymentServiceWithSyncTest method testUndeploymentOfProcessesBySync.

@Test
public void testUndeploymentOfProcessesBySync() throws Exception {
    CoundDownDeploymentListener countDownListener = configureListener(1, false, true, false, false);
    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 : 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 5 with CoundDownDeploymentListener

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

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