Examples of Luggage


Examples of org.plugtree.training.model.Luggage

        //flight code
        String flightCode = "AR 1435";

        //Luggage registration
        Luggage luggage = luggageManager.registerNewLuggage();
        LuggageReceptionEvent luggageReceptionEvent = new LuggageReceptionEvent(luggage,flightCode);
        ksession.insert(luggage);
        ksession.insert(luggageReceptionEvent);

        clock.advanceTime(3, TimeUnit.MINUTES);
        ksession.fireAllRules();

        //no alert should be fired 3 minutes after the luggage was received
        assertEquals(0, alertSystem.getAlertCount());
        //the luggage's location should be FRONT-DESK
        assertEquals(Luggage.Location.FRONT_DESK, luggage.getLocation());

        clock.advanceTime(3, TimeUnit.MINUTES);
        ksession.fireAllRules();

        //3 minutes later, the LUGGAGE_NOT_CHECKED_IN_ON_TIME alert should be fired
        assertEquals(1, alertSystem.getAlertCount());
        assertEquals(1, alertSystem.getAlertCount(AlertType.LUGGAGE_NOT_CHECKED_IN_ON_TIME));
        //the luggage's location should be FRONT-DESK
        assertEquals(Luggage.Location.FRONT_DESK, luggage.getLocation());



        ///////////////////////////////////////////

        alertSystem.clearAllAlerts();

        //A new Luggage is dispatched
        luggage = luggageManager.registerNewLuggage();
        luggageReceptionEvent = new LuggageReceptionEvent(luggage,flightCode);
        ksession.insert(luggage);
        ksession.insert(luggageReceptionEvent);

        //the luggage's location should be FRONT-DESK
        assertEquals(Luggage.Location.FRONT_DESK, luggage.getLocation());

        //2 minutes later, the luggage is checked-in
        clock.advanceTime(2, TimeUnit.MINUTES);
        CheckInEvent checkInEvent = new CheckInEvent(luggage.getCode());
        checkInEventsEP.insert(checkInEvent);
        ksession.fireAllRules();

        //No alerts
        assertEquals(0, alertSystem.getAlertCount());
        //the luggage's location should be CAROUSEL
        assertEquals(Luggage.Location.CAROUSEL, luggage.getLocation());

        //10 minutes later no alert should be fired because the luggage was
        //checked-in
        clock.advanceTime(10, TimeUnit.MINUTES);
        ksession.fireAllRules();
View Full Code Here

Examples of org.plugtree.training.model.Luggage

        //flight code
        String flightCode = "AR 1435";

        //Luggage registration
        Luggage luggage = luggageManager.registerNewLuggage();
        LuggageReceptionEvent luggageReceptionEvent = new LuggageReceptionEvent(luggage,flightCode);
        ksession.insert(luggageReceptionEvent);

        //A non existant luggage is trying to be checked-in
        CheckInEvent checkInEvent = new CheckInEvent("NonExistentLuggageCode");
View Full Code Here

Examples of org.plugtree.training.model.Luggage

public class LuggageManager {

    private Map<String,Luggage> registeredLuggages = new HashMap<String, Luggage>();

    public Luggage registerNewLuggage(){
        Luggage l = new Luggage();
        this.registeredLuggages.put(l.getCode(), l);
        return l;
    }
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.