Search in sources :

Example 1 with ListenerSupport

use of org.jbpm.services.api.ListenerSupport 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 2 with ListenerSupport

use of org.jbpm.services.api.ListenerSupport 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 3 with ListenerSupport

use of org.jbpm.services.api.ListenerSupport 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)

Aggregations

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