Package org.jbpm.kie.services.impl

Examples of org.jbpm.kie.services.impl.KModuleDeploymentUnit


     * @return The {@link KModuleDeploymentUnit} instance
     */
    // pkg scope for tests
    static KModuleDeploymentUnit createDeploymentUnit(String deploymentId, JaxbDeploymentDescriptor descriptor) {
        String [] gavKK = deploymentId.split(":");
        KModuleDeploymentUnit deployUnit = new KModuleDeploymentUnit(gavKK[0], gavKK[1], gavKK[2]);
        if( gavKK.length > 3 ) {
            deployUnit.setKbaseName(gavKK[3]);
        }
        if( gavKK.length > 4 ) {
            deployUnit.setKsessionName(gavKK[4]);
        }
        if (descriptor != null) {
            DeploymentDescriptor realDepDesc = convertToDeploymentDescriptor(descriptor);
            deployUnit.setDeploymentDescriptor(realDepDesc);
        }
        return deployUnit;
    }
View Full Code Here


        if( checkDeploymentService ) {
            DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentId);

            // Deployed
            if( deployedUnit != null ) {
                KModuleDeploymentUnit depUnit = (KModuleDeploymentUnit) deployedUnit.getDeploymentUnit();
                jaxbDepUnit = convertKModuleDepUnitToJaxbDepUnit(depUnit);
                jaxbDepUnit.setStatus(JaxbDeploymentStatus.DEPLOYED);
                return jaxbDepUnit;
            }
        }
View Full Code Here

    public JaxbDeploymentJobResult submitDeployJob(String deploymentId, String strategy, String mergeMode, JaxbDeploymentDescriptor deployDescriptor ) {
        JaxbDeploymentJobResult jobResult;
        DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentId);
        if( deployedUnit != null ) {
            // If the deployment unit already exists, request can not be completed..
            KModuleDeploymentUnit kDepUnit = (KModuleDeploymentUnit) deployedUnit.getDeploymentUnit();
            JaxbDeploymentUnit jaxbDepUnit = convertKModuleDepUnitToJaxbDepUnit(kDepUnit);
            jobResult = new JaxbDeploymentJobResult(
                    null,
                    "The deployment already exists and must be first undeployed!",
                   jaxbDepUnit,
                   JobType.DEPLOY.toString());
            jobResult.setSuccess(false);
        } else {

            KModuleDeploymentUnit deploymentUnit = createDeploymentUnit(deploymentId, deployDescriptor);

            if( strategy != null ) {
                strategy = strategy.toUpperCase();
                RuntimeStrategy runtimeStrategy;
                try {
                    runtimeStrategy = RuntimeStrategy.valueOf(strategy);
                } catch( IllegalArgumentException iae ) {
                    throw KieRemoteRestOperationException.badRequest("Runtime strategy '" + strategy + "' does not exist.");
                }
                deploymentUnit.setStrategy(runtimeStrategy);
            }
            if (mergeMode != null) {
                mergeMode = mergeMode.toUpperCase();
                MergeMode mode;
                try {
                    mode = MergeMode.valueOf(mergeMode);
                catch( IllegalArgumentException iae ) {
                    throw KieRemoteRestOperationException.badRequest("Merge mode '" + mergeMode + "' does not exist.");
                }
                deploymentUnit.setMergeMode(mode);
            }

            jobResult = scheduleDeploymentJobRequest(deploymentId, JobType.DEPLOY, deploymentUnit);
        }
        return jobResult;
View Full Code Here

  
    public JaxbDeploymentJobResult submitUndeployJob(String deploymentId) {
        DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentId);
        JaxbDeploymentJobResult jobResult;
        if( deployedUnit != null ) {
            KModuleDeploymentUnit deploymentUnit = (KModuleDeploymentUnit) deployedUnit.getDeploymentUnit();
            jobResult = scheduleDeploymentJobRequest(deploymentId, JobType.UNDEPLOY, deploymentUnit);
        } else {
            JaxbDeploymentUnit depUnit = determineStatus(deploymentId, false);
          
            String explanation;
View Full Code Here

   
    @Override
    public ExecutionResults execute(CommandContext ctx) throws Exception {
        DeploymentService deploymentService = getDeploymentService(ctx);
       
        KModuleDeploymentUnit deploymentUnit = (KModuleDeploymentUnit) ctx.getData(DEPLOYMENT_UNIT);
        JobType jobType = (JobType) ctx.getData(JOB_TYPE);
        String deploymentId = deploymentUnit.getIdentifier();

        JobResultManager jobResultMgr = getJobManager(ctx);
        String jobId = (String) ctx.getData(JOB_ID);
        JaxbDeploymentJobResult jobResult = jobResultMgr.getJob(jobId);
        boolean success = false;
View Full Code Here

        // dep jobs
        JaxbDeploymentJobResult jaxbJob = new JaxbDeploymentJobResult();
        testRoundTrip(jaxbJob);

        // complex dep jobs
        KModuleDeploymentUnit kDepUnit = new KModuleDeploymentUnit("org", "jar", "1.0", "kbase", "ksession" );
        kDepUnit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
       
        JaxbDeploymentUnit depUnit = new JaxbDeploymentUnit(kDepUnit.getGroupId(), kDepUnit.getArtifactId(), kDepUnit.getArtifactId());
        depUnit.setKbaseName(kDepUnit.getKbaseName());
        depUnit.setKsessionName(kDepUnit.getKsessionName());
        depUnit.setStrategy(kDepUnit.getStrategy());
        depUnit.setStatus(JaxbDeploymentStatus.NONEXISTENT);
        depUnitList.getDeploymentUnitList().add(depUnit);

        jaxbJob = new JaxbDeploymentJobResult(null, "test", depUnit, "deploy");
        jaxbJob.setIdentifier(23L);
View Full Code Here

    @Test
    public void parseDeploymentIdTest() {
        // Test : groups
        {
        String [] test = { "a", "b", "c" };
        KModuleDeploymentUnit depUnit = createDeploymentUnit(join(test, ":"), null);
        checkDepUnit(depUnit, test);
        }
      
        {
        String [] test = { "g", "a", "v", "kbase", "ksess" };
        KModuleDeploymentUnit depUnit = createDeploymentUnit(join(test, ":"), null);
        checkDepUnit(depUnit, test);
        }
       
        {
        String [] test = { "g", "a", "v", "kbase" };
        KModuleDeploymentUnit depUnit = createDeploymentUnit(join(test, ":"), null);
        checkDepUnit(depUnit, test);
        }

        {
        String [] test = { "group.sub_group", "artifact_id", "1.0.0.Final" };
        KModuleDeploymentUnit depUnit = createDeploymentUnit(join(test, ":"), null);
        checkDepUnit(depUnit, test);
        }
    }
View Full Code Here

   
    @Test
    public void testDeployAndStartSimpleProcess() {
        assertNotNull(processService);
       
        KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
        processService.deployUnit(unit);
        logger.info("TEST:Unit {} has been deployed", unit);
        Collection<ProcessDesc> processes = processService.getProcesses();
        assertNotNull(processes);
        assertEquals(2, processes.size());
       
        RuntimeManager manager = processService.getRuntimeManager(unit.getIdentifier());
        assertNotNull(manager);
       
        RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
        assertNotNull(engine);
       
View Full Code Here

   
    @Test
    public void testDeployAndStartSimpleProcessProcessInstanceStrategy() {
        assertNotNull(processService);
       
        KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
        unit.setStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE);
        processService.deployUnit(unit);
        logger.info("TEST:Unit {} has been deployed", unit);
        Collection<ProcessDesc> processes = processService.getProcesses();
        assertNotNull(processes);
        assertEquals(2, processes.size());
       
        RuntimeManager manager = processService.getRuntimeManager(unit.getIdentifier());
        assertNotNull(manager);
       
        RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
        assertNotNull(engine);
       
View Full Code Here

   
    @Test
    public void testDeployAndStartUserTaskProcess() {
        assertNotNull(processService);
       
        KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
        processService.deployUnit(unit);
        logger.info("TEST:Unit {} has been deployed", unit);
        Collection<ProcessDesc> processes = processService.getProcesses();
        assertNotNull(processes);
        assertEquals(2, processes.size());
       
        RuntimeManager manager = processService.getRuntimeManager(unit.getIdentifier());
        assertNotNull(manager);
       
        RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
        assertNotNull(engine);
       
View Full Code Here

TOP

Related Classes of org.jbpm.kie.services.impl.KModuleDeploymentUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.