Package org.kie.services.client.api

Examples of org.kie.services.client.api.RemoteJmsRuntimeEngineFactory


    public void startProcessAndTaskViaJmsRemoteJavaAPI(URL serverUrl, String deploymentId, String user, String password) {
        // the serverURL should contain a URL similar to "http://localhost:8080/jbpm-console"
       
        // Setup remote JMS runtime engine factory
        RemoteJmsRuntimeEngineFactory remoteJmsFactory
            = RemoteRuntimeEngineFactory.newJmsBuilder()
            .addDeploymentId(deploymentId)
            .addJbossServerHostName(serverUrl.getHost())
            .addUserName(user)
            .addPassword(password)
            .buildFactory();

        // Interface with JMS api
        RuntimeEngine engine = remoteJmsFactory.newRuntimeEngine();
        KieSession ksession = engine.getKieSession();
       
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("paramName", new MyType("name", 23));
        ProcessInstance processInstance = ksession.startProcess("com.burns.reactor.maintenance.cycle", params);
View Full Code Here


    }

    @Test
    public void jmsRuntimeFactoryBuilderTest() throws InsufficientInfoToBuildException {
        // url + all options
        RemoteJmsRuntimeEngineFactory jmsRuntimeFactory =
                RemoteJmsRuntimeEngineFactory.newBuilder()
                .addDeploymentId("deployment")
                .addProcessInstanceId(46l)
                .addUserName("C")
                .addPassword("cake")
                .addRemoteInitialContext(remoteInitialContext)
                .addTimeout(3)
                .addExtraJaxbClasses(MyType.class)
                .useSsl(false)
                .buildFactory();
       assertNotNull( jmsRuntimeFactory );
       
        // context, minimum
        jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                .addRemoteInitialContext(remoteInitialContext)
                .addUserName("E*")
                .addPassword("koffie")
                .buildFactory();
       
        try {
            jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                    .addRemoteInitialContext(remoteInitialContext)
                    .addPassword("koffie")
                    .buildFactory();
            fail( "A user name should always be required!");
        } catch(InsufficientInfoToBuildException e) {
            // expected
        }
               
        try {
            jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                    .addRemoteInitialContext(remoteInitialContext)
                    .addUserName("E*")
                    .buildFactory();
            fail( "A password should always be required!");
        } catch(InsufficientInfoToBuildException e) {
            // expected
        }
       
        try {
            jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                    .addUserName("E*")
                    .addPassword("koffie")
                    .buildFactory();
            fail( "An inital context or server url should always be required!");
        } catch(InsufficientInfoToBuildException e) {
            // expected
        }
               
        // queue collection, minimum
        jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                .addUserName("M")
                .addPassword("koekje")
                .addKieSessionQueue(mock(Queue.class))
                .addTaskServiceQueue(mock(Queue.class))
                .addResponseQueue(mock(Queue.class))
                .addConnectionFactory(mock(ConnectionFactory.class))
                .buildFactory();
       
        try {
            jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                    .addUserName("1")
                    .addPassword("ijs")
                    .addTaskServiceQueue(mock(Queue.class))
                    .addResponseQueue(mock(Queue.class))
                    .addConnectionFactory(mock(ConnectionFactory.class))
                    .buildFactory();
           
            jmsRuntimeFactory.newRuntimeEngine().getKieSession();
            fail( "A ksession queue is required for a ksession!");
        } catch( MissingRequiredInfoException e) {
            // expected
        }
       
        try {
            jmsRuntimeFactory = RemoteJmsRuntimeEngineFactory.newBuilder()
                    .addUserName("1")
                    .addPassword("ijs")
                    .addKieSessionQueue(mock(Queue.class))
                    .addResponseQueue(mock(Queue.class))
                    .addConnectionFactory(mock(ConnectionFactory.class))
                    .buildFactory();
           
            jmsRuntimeFactory.newRuntimeEngine().getTaskService();
            fail( "A task service queue is always required!");
        } catch( MissingRequiredInfoException e) {
            // expected
        }
       
View Full Code Here

TOP

Related Classes of org.kie.services.client.api.RemoteJmsRuntimeEngineFactory

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.