Package org.kie.api.runtime.manager

Examples of org.kie.api.runtime.manager.RuntimeEngine


                .addUserName("user")
                .addPassword("pass")
                .addUrl(new URL("http://localhost:8080/business-central"))
                .buildFactory();
       
        RuntimeEngine runtimeEngine = factory.newRuntimeEngine();
        try {
            runtimeEngine.getTaskService().claim(23l, "user");
        } catch( RemoteCommunicationException rce ) {
            // expected
        }
       
        try {
            runtimeEngine.getAuditLogService().clear();
            fail( "This should have failed because there's no server running... ");
        } catch( RemoteCommunicationException rce ) {
            // expected
        }
       
        // This will throw a MissingRequiredInfoException because the deployment id is required here
        try {
            runtimeEngine.getKieSession().startProcess("org.test.process");
            fail( "This should have failed because no deployment id has been provided. ");
        } catch( MissingRequiredInfoException mrie ) {
            // expected
        }
      
        factory =
                RemoteJmsRuntimeEngineFactory.newBuilder()
                .addUserName("user")
                .addPassword("pass")
                .addRemoteInitialContext(remoteInitialContext)
                .addHostName("localhost")
                .addJmsConnectorPort(5446)
                .addKeystorePassword("R")
                .addKeystoreLocation("ssl/client_keystore.jks")
                .useKeystoreAsTruststore()
                .useSsl(true)
                .buildFactory();
       
        runtimeEngine = factory.newRuntimeEngine();
        try {
            runtimeEngine.getTaskService().claim(23l, "user");
            fail( "This should have failed because there's no server running... ");
        } catch( RemoteCommunicationException rce ) {
            logger.info("The " + NoSuchAlgorithmException.class.getSimpleName() + " above is expected, nothing is wrong.");
            // expected
        }
       
        try {
            runtimeEngine.getAuditLogService().clear();
            fail( "This should have failed because there's no server running... ");
        } catch( RemoteCommunicationException rce ) {
            logger.info("The " + NoSuchAlgorithmException.class.getSimpleName() + " above is expected, nothing is wrong.");
            // expected
        }
       
        // This will throw a MissingRequiredInfoException because the deployment id is required here
        try {
            runtimeEngine.getKieSession().startProcess("org.test.process");
        } catch( MissingRequiredInfoException mrie ) {
            // expected
        }
    }
View Full Code Here


        // after creating per process instance manager init creates temp session that shall be directly destroyed
        sessions = em.createQuery("from SessionInfo").getResultList();
        assertNotNull(sessions);
        assertEquals(0, sessions.size());

        RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
        KieSession ksession = engine.getKieSession();
        TaskService taskService = engine.getTaskService();

        ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");

        System.out.println("Process started");
View Full Code Here

        context = new ClassPathXmlApplicationContext("jbpm/local-em/local-em-spring.xml");

        AbstractPlatformTransactionManager aptm = (AbstractPlatformTransactionManager) context.getBean( "jbpmTxManager" );
        RuntimeManager manager = (RuntimeManager) context.getBean("runtimeManager");

        RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
        KieSession ksession = engine.getKieSession();
        TaskService taskService = engine.getTaskService();


        AuditLogService logService = (AuditLogService) context.getBean("logService");

        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
View Full Code Here

    public void testSpringWithJpa() throws Exception{
        context = new ClassPathXmlApplicationContext("jbpm/jpa/jpa-spring.xml");

        RuntimeManager manager = (RuntimeManager) context.getBean("runtimeManager");

        RuntimeEngine engine = manager.getRuntimeEngine(null);
        KieSession ksession = engine.getKieSession();
        TaskService taskService = engine.getTaskService();

        validatePessimisticLockingUse(ksession);
       
        ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");
View Full Code Here

                registeredNames.add(name);
            }
        }
        // TODO: this whole block can be removed after SWITCHYARD-1584
        if (!registeredNames.contains(HUMAN_TASK) && runtimeManager != null) {
            RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine(null);
            ExternalTaskEventListener listener = new ExternalTaskEventListener();
            LocalHTWorkItemHandler htwih = new LocalHTWorkItemHandler();
            htwih.setRuntimeManager(runtimeManager);
            // NOTE: Cannot remove next two blocks for SWITCHYARD-1755 yet...
            if (runtimeEngine.getTaskService() instanceof EventService) {
                ((EventService)runtimeEngine.getTaskService()).registerTaskEventListener(listener);
            }
            if (processRuntime instanceof Disposable) {
                ((Disposable)processRuntime).addDisposeListener(new DisposeListener() {
                    @Override
                    public void onDispose(RuntimeEngine re) {
View Full Code Here

            KieServices.Factory.get().getResources().newClassPathResource(
            "Evaluation.bpmn",getClass().getClassLoader()), ResourceType.BPMN2)
            .userGroupCallback(new JBossUserGroupCallbackImpl(props))
            .get();
        RuntimeManager runtimeManager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
        RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtimeEngine.getKieSession();
        TaskService taskService = runtimeEngine.getTaskService();

    // start a new process instance
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "krisv");
    params.put("reason", "Yearly performance evaluation");
View Full Code Here

            KieServices.Factory.get().getResources().newClassPathResource(
            "Evaluation.bpmn",getClass().getClassLoader()), ResourceType.BPMN2)
            .userGroupCallback(new JBossUserGroupCallbackImpl(props))
            .get();
        RuntimeManager runtimeManager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
        RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtimeEngine.getKieSession();
        TaskService taskService = runtimeEngine.getTaskService();

    // start a new process instance
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "krisv");
    params.put("reason", "Yearly performance evaluation");
View Full Code Here

            .addAsset(
            KieServices.Factory.get().getResources().newClassPathResource(
            "Evaluation.bpmn",getClass().getClassLoader()), ResourceType.BPMN2)
            .get();
        RuntimeManager runtimeManager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment);
        RuntimeEngine runtimeEngine = runtimeManager.getRuntimeEngine(EmptyContext.get());
        KieSession ksession = runtimeEngine.getKieSession();
        TaskService taskService = runtimeEngine.getTaskService();

    // start a new process instance
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "krisv");
    params.put("reason", "Yearly performance evaluation");
View Full Code Here

    @Test
    public void testProcessExecution() {
       
        createRuntimeManager("ScriptTask.bpmn2");
        RuntimeEngine engine = getRuntimeEngine();
        assertNotNull(engine);
       
        KieSession ksession = engine.getKieSession();
       
        ProcessInstance processInstance = ksession.startProcess("ScriptTask");
       
        assertProcessInstanceCompleted(processInstance.getId(), ksession);
    }
View Full Code Here

        assertEquals(2, processes.size());
       
        RuntimeManager manager = processService.getRuntimeManager();
        assertNotNull(manager);
       
        RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
        assertNotNull(engine);
       
        KieSession ksession = engine.getKieSession();
        assertNotNull(ksession);
       
        ksession.startProcess("customtask");       
    }
View Full Code Here

TOP

Related Classes of org.kie.api.runtime.manager.RuntimeEngine

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.