Examples of JaxbCommandsRequest


Examples of org.kie.remote.client.jaxb.JaxbCommandsRequest

        // Create JaxbCommandsRequest instance and add commands
        Command<?> cmd = new StartProcessCommand();
        ((StartProcessCommand) cmd).setProcessId(PROCESS_ID_1);
        int oompaProcessingResultIndex = 0;
        JaxbCommandsRequest req = new JaxbCommandsRequest(DEPLOYMENT_ID, cmd);
        cmd = new GetTaskAssignedAsPotentialOwnerCommand();
        ((GetTaskAssignedAsPotentialOwnerCommand) cmd).setUserId(USER);
        req.getCommands().add(cmd);
        int loompaMonitoringResultIndex = 1;

        // Get JNDI context from server
        InitialContext context = getRemoteJbossInitialContext(serverUrl, USER, PASSWORD);
           
View Full Code Here

Examples of org.kie.remote.client.jaxb.JaxbCommandsRequest

    private JaxbCommandsRequest prepareCommandRequest( Command command ) {
        if( config.getDeploymentId() == null && !(command instanceof TaskCommand || command instanceof AuditCommand) ) {
            throw new MissingRequiredInfoException("A deployment id is required when sending commands involving the KieSession.");
        }
        JaxbCommandsRequest req;
        if( command instanceof AuditCommand ) {
            req = new JaxbCommandsRequest(command);
        } else {
            req = new JaxbCommandsRequest(config.getDeploymentId(), command);
        }

        Long processInstanceId = findProcessInstanceId(command);
        if( processInstanceId == null ) {
            processInstanceId = config.getProcessInstanceId();
        }
        req.setProcessInstanceId(processInstanceId);
        req.setUser(config.getUserName());
        req.setVersion(VERSION);

        return req;
    }
View Full Code Here

Examples of org.kie.remote.client.jaxb.JaxbCommandsRequest

     *
     * @param command The {@link Command} object to be executed.
     * @return The result of the {@link Command} object execution.
     */
    private Object executeJmsCommand( Command command ) {
        JaxbCommandsRequest req = prepareCommandRequest(command);
        String deploymentId = config.getDeploymentId();

        ConnectionFactory factory = config.getConnectionFactory();
        Queue sendQueue;

View Full Code Here

Examples of org.kie.remote.client.jaxb.JaxbCommandsRequest

     *
     * @param command The {@link Command} object to be executed.
     * @return The result of the {@link Command} object execution.
     */
    private <T> T executeRestCommand( Command command ) {
        JaxbCommandsRequest jaxbRequest = prepareCommandRequest(command);
        KieRemoteHttpRequest httpRequest = config.createHttpRequest().relativeRequest("/execute");
       
        // necessary for deserialization
        httpRequest.header(JaxbSerializationProvider.EXECUTE_DEPLOYMENT_ID_HEADER, config.getDeploymentId());

View Full Code Here

Examples of org.kie.remote.services.jaxb.JaxbCommandsRequest

        default:
            throw new KieRemoteServicesInternalError("Unknown serialization type: " + serializationType);
        }

        // 1. deserialize request
        JaxbCommandsRequest cmdsRequest = deserializeRequest(message, msgCorrId, serializationProvider, serializationType);

        // 2. security/identity
        backupIdentityProviderProducer.createBackupIdentityProvider(cmdsRequest.getUser());
        cmdsRequest.setUserPass(getUserPass(message));

        // 3. process request
        jaxbResponse = jmsProcessJaxbCommandsRequest(cmdsRequest);
       
        // 4. serialize response
View Full Code Here

Examples of org.kie.remote.services.jaxb.JaxbCommandsRequest

    // De/Serialization helper methods -------------------------------------------------------------------------------------------

    private static JaxbCommandsRequest deserializeRequest(Message message, String msgId, SerializationProvider serializationProvider, int serializationType) {

        JaxbCommandsRequest cmdMsg = null;
        try {
            String msgStrContent = null;

            switch (serializationType) {
            case JMS_SERIALIZATION_TYPE:
View Full Code Here

Examples of org.kie.remote.services.jaxb.JaxbCommandsRequest

    @Test
    public void testJmsIndependentTaskProcessing() {
        setupTaskMocks(this, FOR_INDEPENDENT_TASKS);

        JaxbCommandsRequest
        cmdsRequest = new JaxbCommandsRequest(new ClaimTaskCommand(TASK_ID, USER));
        this.jmsProcessJaxbCommandsRequest(cmdsRequest);
        cmdsRequest = new JaxbCommandsRequest(new CompleteTaskCommand(TASK_ID, USER, null));
        this.jmsProcessJaxbCommandsRequest(cmdsRequest);
      
        // verify
        verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class));
    }
View Full Code Here

Examples of org.kie.remote.services.jaxb.JaxbCommandsRequest

    @Test
    public void testJmsProcessTaskProcessing() {
        setupTaskMocks(this, FOR_PROCESS_TASKS);

        JaxbCommandsRequest
        cmdsRequest = new JaxbCommandsRequest(new ClaimTaskCommand(TASK_ID, USER));
        this.jmsProcessJaxbCommandsRequest(cmdsRequest);
        cmdsRequest = new JaxbCommandsRequest(new CompleteTaskCommand(TASK_ID, USER, null));
        this.jmsProcessJaxbCommandsRequest(cmdsRequest);
       
        // verify
        verify(userTaskServiceMock, times(2)).execute(any(String.class), any(TaskCommand.class));
    }
View Full Code Here

Examples of org.kie.remote.services.jaxb.JaxbCommandsRequest

    @Test
    public void testJmsAuditCommandWithoutDeploymentId() {
        setupTaskMocks(this, FOR_PROCESS_TASKS);

        // run cmd (no deploymentId set on JaxbConmandsRequest object
        JaxbCommandsRequest
        cmdsRequest = new JaxbCommandsRequest(new FindProcessInstancesCommand());
        JaxbCommandsResponse
        response = this.jmsProcessJaxbCommandsRequest(cmdsRequest);
      
        // check result
        assertEquals( "Number of response objects", 1, response.getResponses().size() );
        JaxbCommandResponse<?>
        responseObj = response.getResponses().get(0);
        assertFalse( "Command did not complete successfully", responseObj instanceof JaxbExceptionResponse );
       
        // run cmd (no deploymentId set on JaxbConmandsRequest object
        cmdsRequest = new JaxbCommandsRequest(new ClearHistoryLogsCommand());
        cmdsRequest.setVersion(ServicesVersion.VERSION);
        response = this.jmsProcessJaxbCommandsRequest(cmdsRequest);
       
        // check result
        assertEquals( "Number of response objects", 0, response.getResponses().size() );
       
View Full Code Here

Examples of org.kie.remote.services.jaxb.JaxbCommandsRequest

     * Runs the test. See {@link MockSetupTestHelper#setupProcessMocks(StartProcessEveryStrategyTest, RuntimeStrategy)}
     * for the real test logic.
     */
    private void runStartProcessAndDoStuffTest() {
        // test start process
        JaxbCommandsRequest
        cmdsRequest = new JaxbCommandsRequest(DEPLOYMENT_ID, new StartProcessCommand(TEST_PROCESS_DEF_NAME));
        JaxbCommandsResponse
        resp = this.jmsProcessJaxbCommandsRequest(cmdsRequest);

        // check response
        assertNotNull( "Null response", resp);
        List<JaxbCommandResponse<?>> resplist = resp.getResponses();
        assertNotNull( "Null response list", resplist);
        assertEquals( "Incorrect resp list size", 1, resplist.size() );
        JaxbCommandResponse<?> realResp = resplist.get(0);
        assertFalse( "An exception was thrown!", realResp instanceof JaxbExceptionResponse );
        assertTrue( "Expected process instance response", realResp instanceof JaxbProcessInstanceResponse );
        JaxbProcessInstanceResponse procInstResp = (JaxbProcessInstanceResponse) realResp;
        assertNotNull( "Null process instance", procInstResp);
        assertEquals( "Invalid process instance id", TEST_PROCESS_INST_ID, procInstResp.getId() );
       
        // Do rest call with process instance id this time. This will fail if:
        // - the ProcessInstanceIdContext is not used (and an EmptyContext is used instead)
        // - The ProcessInstanceIdContext constructor gets a null value for the process instance id
        cmdsRequest = new JaxbCommandsRequest(DEPLOYMENT_ID, new SignalEventCommand(TEST_PROCESS_INST_ID, "test", null));
        cmdsRequest.setVersion(ServicesVersion.VERSION);
        cmdsRequest.setProcessInstanceId(TEST_PROCESS_INST_ID);
        resp = this.jmsProcessJaxbCommandsRequest(cmdsRequest);
     
        // check response
        assertNotNull( "Null response", resp);
        resplist = resp.getResponses();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.