Package com.wordpress.salaboy.example.model

Examples of com.wordpress.salaboy.example.model.Vehicle


        int fired = this.processManager.fireAllRules();
        // Now that I have rules being evaluated, at least one should fire
        Assert.assertEquals(1, fired);

        // Lets check the value of the vehicle variable it should be an Ambulance => Heart Attack
        Vehicle selectedVehicle = ((Vehicle) processManager.getProcessVariable("vehicle"));
        Assert.assertTrue(selectedVehicle instanceof Ambulance);

        // Is the Process still Active?
        Assert.assertFalse(this.processManager.isProcessInstanceCompleted());
        Assert.assertEquals(ProcessInstance.STATE_ACTIVE, processManager.getProcessState());
        // Is there a running node instance?
        Assert.assertEquals(1, processManager.getNodeInstancesSize());
        // Is the process stopped in the "Dispatch Vehicle" activity?
        Assert.assertEquals("Dispatch Vehicle", processManager.getCurrentNodeName());
        // Lets check the value of the emergency.getRevision(), it should be 1
        Assert.assertEquals(2, ((Emergency) processManager.getProcessVariable("emergency")).getRevision());

        System.out.println("Completing the second Activity");
        //Complete the second human activity
        humanActivitiesSimHandler.completeWorkItem();

        //Start Tracking is not automatic. The external system has to finish first.
        //Until then, the process will be waiting in StartTrackingSystem
        Assert.assertEquals("Vehicle " + selectedVehicle.getId() + " Located at 5th and A Avenue", trackingSystem.queryVehicleStatus(selectedVehicle.getId()));

        // Is the process completed? It shouldn't be because the External System didn't finish yet.
        Assert.assertFalse(this.processManager.isProcessInstanceCompleted());
        Assert.assertEquals(ProcessInstance.STATE_ACTIVE, this.processManager.getProcessState());

        //Now complete the external system. We will wait a few seconds to
        //emulate the time needed by the VehicleTrackingSystem to complete the
        //job
        Thread.sleep(2000);
        this.trackingSystem.stopTacking(this.trackingSystem.queryVehicleTrackingId(selectedVehicle.getId()));

        // Is the process completed now?
        Assert.assertTrue(this.processManager.isProcessInstanceCompleted());
    }
View Full Code Here


        // Now that I have rules being evaluated, at least one should fire
        Assert.assertEquals(1, fired);
       
       
        // Lets check the value of the vehicle variable it should be an Ambulance => Heart Attack
        Vehicle selectedVehicle = ((Vehicle) process.getVariable("vehicle"));
        Assert.assertTrue(selectedVehicle instanceof Ambulance);
       
        // Is the Process still Active?
        Assert.assertEquals(ProcessInstance.STATE_ACTIVE, process.getState());
        // Is there a running node instance?
        Assert.assertEquals(1, process.getNodeInstances().size());
        // Is the process stopped in the "Dispatch Vehicle" activity?
        Assert.assertEquals("Dispatch Vehicle", process.getNodeInstances().iterator().next().getNodeName());
        // Lets check the value of the emergency.getRevision(), it should be 1
        Assert.assertEquals(2, ((Emergency) process.getVariable("emergency")).getRevision());
       
        System.out.println("Completing the second Activity");
        //Complete the second human activity
        humanActivitiesSimHandler.completeWorkItem();
       
        //Start Tracking is not automatic. The external system has to finish first.
        //Until then, the process will be waiting in StartTrackingSystem
        Assert.assertEquals("Vehicle "+selectedVehicle.getId()+" Located at 5th and A Avenue"
                                    , trackingSystem.queryVehicleStatus(selectedVehicle.getId()));
       
        // Is the process completed? It shouldn't be because the External System didn't finish yet.
        Assert.assertEquals(ProcessInstance.STATE_ACTIVE, process.getState());
       
        //Now complete the external system. We will wait a few seconds to
        //emulate the time needed by the VehicleTrackingSystem to complete the
        //job
        Thread.sleep(2000);
        this.trackingSystem.stopTacking(this.trackingSystem.queryVehicleTrackingId(selectedVehicle.getId()));
       
        // Is the process completed now?
        Assert.assertEquals(ProcessInstance.STATE_COMPLETED, process.getState());
    }
View Full Code Here

        // Now that I have rules being evaluated, at least one should fire
        Assert.assertEquals(1, fired);
       
       
        // Lets check the value of the vehicle variable it should be an Ambulance => Heart Attack
        Vehicle selectedVehicle = ((Vehicle) process.getVariable("vehicle"));
        Assert.assertTrue(selectedVehicle instanceof Ambulance);
       
       
        // Is the Process still Active?
        Assert.assertEquals(ProcessInstance.STATE_ACTIVE, process.getState());
        // Is there a running node instance?
        Assert.assertEquals(1, process.getNodeInstances().size());
        // Is the process stopped in the "Dispatch Vehicle" activity?
        Assert.assertEquals("Dispatch Vehicle", process.getNodeInstances().iterator().next().getNodeName());
        // Lets check the value of the emergency.getRevision(), it should be 1
        Assert.assertEquals(2, ((Emergency) process.getVariable("emergency")).getRevision());
       
       
       
        System.out.println("Completing the second Activity");
        //Complete the second human activity
        humanActivitiesSimHandler.completeWorkItem();
       
        //Start Tracking and Reporting are automatic -> Check the report in the console
        //We can also check against the tracking system itself
        Assert.assertEquals("Vehicle "+selectedVehicle.getId()+" Located at 5th and A Avenue"
                                    , trackingSystem.queryVehicleStatus(selectedVehicle.getId()));
       
       
        // Is the process completed?
        Assert.assertEquals(ProcessInstance.STATE_COMPLETED, process.getState());
View Full Code Here

        // Now that I have rules being evaluated, at least one should fire
        Assert.assertEquals(1, fired);
       
       
        // Lets check the value of the vehicle variable it should be an Ambulance => Heart Attack
        Vehicle selectedVehicle = ((Vehicle) process.getVariable("vehicle"));
        Assert.assertTrue(selectedVehicle instanceof Ambulance);
       
       
        // Is the Process still Active?
        Assert.assertEquals(ProcessInstance.STATE_ACTIVE, process.getState());
        // Is there a running node instance?
        Assert.assertEquals(1, process.getNodeInstances().size());
        // Is the process stopped in the "Dispatch Vehicle" activity?
        Assert.assertEquals("Dispatch Vehicle", process.getNodeInstances().iterator().next().getNodeName());
        // Lets check the value of the emergency.getRevision(), it should be 1
        Assert.assertEquals(2, ((Emergency) process.getVariable("emergency")).getRevision());
       
       
       
        System.out.println("Completing the second Activity");
        //Complete the second human activity
        humanActivitiesSimHandler.completeWorkItem();
       
        //Start Tracking and Reporting are automatic -> Check the report in the console
        //We can also check against the tracking system itself
        Assert.assertEquals("Vehicle "+selectedVehicle.getId()+" Located at 5th and A Avenue"
                                    , trackingSystem.queryTackingStatus(selectedVehicle.getId()));
       
       
        // Is the process completed?
        Assert.assertEquals(ProcessInstance.STATE_COMPLETED, process.getState());
View Full Code Here

TOP

Related Classes of com.wordpress.salaboy.example.model.Vehicle

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.