Search in sources :

Example 81 with DeploymentUnit

use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.

the class DeploymentServiceTest method testDeploymentWithDeclaredTypeInDRL.

@Test
public void testDeploymentWithDeclaredTypeInDRL() {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit3 = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, "1.1.0-SNAPSHOT");
    deploymentService.deploy(deploymentUnit3);
    units.add(deploymentUnit3);
    DeployedUnit deployed3 = deploymentService.getDeployedUnit(deploymentUnit3.getIdentifier());
    assertNotNull(deployed3);
    assertNotNull(deployed3.getDeploymentUnit());
    assertNotNull(deployed3.getRuntimeManager());
    assertEquals(1, ((DeployedUnitImpl) deployed3).getDeployedClasses().size());
    try {
        assertNotNull(Class.forName("org.pkg1.Message", true, ((InternalRuntimeManager) deployed3.getRuntimeManager()).getEnvironment().getClassLoader()));
    } catch (ClassNotFoundException e) {
        fail("Class org.pkg1.Message should be found in deployment");
    }
}
Also used : DeployedUnit(org.jbpm.services.api.model.DeployedUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeployedUnitImpl(org.jbpm.kie.services.impl.DeployedUnitImpl) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 82 with DeploymentUnit

use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.

the class DeploymentServiceTest method testDuplicatedDeployment.

@Test(expected = RuntimeException.class)
public void testDuplicatedDeployment() {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    assertFalse(deploymentService.isDeployed(deploymentUnit.getIdentifier()));
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    assertTrue(deploymentService.isDeployed(deploymentUnit.getIdentifier()));
    DeployedUnit deployedGeneral = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
    assertNotNull(deployedGeneral);
    assertNotNull(deployedGeneral.getDeploymentUnit());
    assertNotNull(deployedGeneral.getRuntimeManager());
    // duplicated deployment of the same deployment unit should fail
    deploymentService.deploy(deploymentUnit);
}
Also used : DeployedUnit(org.jbpm.services.api.model.DeployedUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 83 with DeploymentUnit

use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.

the class DeploymentServiceTest method testDeploymentOfMultipleVersions.

@Test
public void testDeploymentOfMultipleVersions() {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    DeploymentUnit deploymentUnit3 = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, "1.1.0-SNAPSHOT");
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    deploymentService.deploy(deploymentUnit3);
    units.add(deploymentUnit3);
    DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
    assertNotNull(deployed);
    assertNotNull(deployed.getDeploymentUnit());
    assertNotNull(deployed.getRuntimeManager());
    assertEquals(0, ((DeployedUnitImpl) deployed).getDeployedClasses().size());
    DeployedUnit deployed3 = deploymentService.getDeployedUnit(deploymentUnit3.getIdentifier());
    assertNotNull(deployed3);
    assertNotNull(deployed3.getDeploymentUnit());
    assertNotNull(deployed3.getRuntimeManager());
    assertEquals(1, ((DeployedUnitImpl) deployed3).getDeployedClasses().size());
    assertNotNull(runtimeDataService);
    Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
    assertNotNull(processes);
    assertEquals(10, processes.size());
    DeployedUnit deployedLatest = deploymentService.getDeployedUnit(GROUP_ID + ":" + ARTIFACT_ID + ":LATEST");
    assertNotNull(deployedLatest);
    assertNotNull(deployedLatest.getDeploymentUnit());
    assertNotNull(deployedLatest.getRuntimeManager());
    assertEquals(deploymentUnit3.getIdentifier(), deployedLatest.getDeploymentUnit().getIdentifier());
}
Also used : DeployedUnit(org.jbpm.services.api.model.DeployedUnit) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) QueryContext(org.kie.api.runtime.query.QueryContext) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeployedUnitImpl(org.jbpm.kie.services.impl.DeployedUnitImpl) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 84 with DeploymentUnit

use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.

the class DeploymentServiceTest method cleanup.

@After
public void cleanup() {
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            deploymentService.undeploy(unit);
        }
        units.clear();
    }
    close();
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) After(org.junit.After)

Example 85 with DeploymentUnit

use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.

the class DeploymentServiceWithSyncTest method cleanup.

@After
public void cleanup() {
    if (invoker != null) {
        invoker.stop();
    }
    int deleted = 0;
    deleted += commandService.execute(new UpdateStringCommand("delete from  DeploymentStoreEntry dse"));
    logger.info("Deleted " + deleted);
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            deploymentService.undeploy(unit);
        }
        units.clear();
    }
    close();
}
Also used : UpdateStringCommand(org.jbpm.shared.services.impl.commands.UpdateStringCommand) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) After(org.junit.After)

Aggregations

DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)104 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)88 Test (org.junit.Test)53 After (org.junit.After)35 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)34 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)28 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)25 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)19 HashMap (java.util.HashMap)16 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)15 ArrayList (java.util.ArrayList)14 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)13 QueryContext (org.kie.api.runtime.query.QueryContext)13 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)12 KieServices (org.kie.api.KieServices)10 ReleaseId (org.kie.api.builder.ReleaseId)10 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)9 AbstractEJBServicesTest (org.jbpm.test.container.AbstractEJBServicesTest)8 Collection (java.util.Collection)6 DeployedUnitImpl (org.jbpm.kie.services.impl.DeployedUnitImpl)6