Package org.kie.remote.services.jaxb

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


            }
        }

        // 0. Get msg correlation id (for response)
        String msgCorrId = null;
        JaxbCommandsResponse jaxbResponse = null;
        try {
            msgCorrId = message.getJMSCorrelationID();
        } catch (JMSException jmse) {
            String errMsg = "Unable to retrieve JMS correlation id from message! " + ID_NECESSARY;
            throw new KieRemoteServicesRuntimeException(errMsg, jmse);
View Full Code Here


    }

    // Runtime / KieSession / TaskService helper methods --------------------------------------------------------------------------
    protected JaxbCommandsResponse jmsProcessJaxbCommandsRequest(JaxbCommandsRequest request) {
        // If exceptions are happening here, then there is something REALLY wrong and they should be thrown.
        JaxbCommandsResponse jaxbResponse = new JaxbCommandsResponse(request);
        List<Command> commands = request.getCommands();
     
        if (commands != null) {
            UserGroupAdapter userGroupAdapter = null;
            try {
                for (int i = 0; i < commands.size(); ++i) {

                    Command<?> cmd = commands.get(i);
                    if (!AcceptedServerCommands.isAcceptedCommandClass(cmd.getClass())) {
                        String cmdName = cmd.getClass().getName();
                        String errMsg = cmdName + " is not a supported command and will not be executed.";
                        logger.warn( errMsg );
                        UnsupportedOperationException uoe = new UnsupportedOperationException(errMsg);
                        jaxbResponse.addException(uoe, i, cmd, FORBIDDEN);
                        continue;
                    }
                   
                    if( cmd instanceof TaskCommand && userGroupAdapter == null ) {
                        userGroupAdapter = getUserFromMessageAndLookupAndInjectGroups(request.getUserPass());
View Full Code Here

    // execute --------------------------------------------------------------------------------------------------------------------
   
    @SuppressWarnings("rawtypes")
    protected JaxbCommandsResponse restProcessJaxbCommandsRequest(JaxbCommandsRequest request) {
        // If exceptions are happening here, then there is something REALLY wrong and they should be thrown.
        JaxbCommandsResponse jaxbResponse = new JaxbCommandsResponse(request);
        List<Command> commands = request.getCommands();

        if (commands != null) {
            int cmdListSize = commands.size();
          
View Full Code Here

        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() );
       
        // verify
        verify(auditLogService, times(1)).findProcessInstances();
        verify(auditLogService, times(1)).clear();
    }
View Full Code Here

     */
    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();
        assertNotNull( "Null response list", resplist);
        assertEquals( "Incorrect resp list size", 1, resplist.size() );
        realResp = resplist.get(0);
        assertFalse( "An exception was thrown!", realResp instanceof JaxbExceptionResponse );
       
View Full Code Here

        this.processRequestBean.setAuditLogService(auditLogService);

        // run cmd (no deploymentId set on JaxbConmandsRequest object
        JaxbCommandsRequest
        cmdsRequest = new JaxbCommandsRequest(new FindProcessInstancesCommand());
        JaxbCommandsResponse
        response = this.execute(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());
        response = this.execute(cmdsRequest);
       
        // check result
        assertEquals( "Number of response objects", 0, response.getResponses().size() );
       
        // verify
        verify(auditLogService, times(1)).findProcessInstances();
        verify(auditLogService, times(1)).clear();
    }
View Full Code Here

TOP

Related Classes of org.kie.remote.services.jaxb.JaxbCommandsResponse

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.