Пример #1
0
  @Test
  public void riskZoneDeparture() throws Exception {
    riskZoneDestination();

    // Risk zone departure (they know you now, so risk is higher)
    cargo = CARGOS.createCargo(routeSpec, delivery, "Hopeful");
    trackingId = cargo.trackingId().get();
    cargo.itinerary().set(itinerary); // Risky itinerary

    handlingEvent =
        HANDLING_EVENTS.createHandlingEvent(DAY2, DAY2, trackingId, LOAD, MOGADISHU, V205);
    cargo
        .delivery()
        .set(
            delivery(
                handlingEvent,
                ONBOARD_CARRIER,
                notArrived,
                ROUTED,
                directed,
                itinerary.eta(),
                leg2,
                nextHandlingEvent(UNLOAD, ROTTERDAM, DAY4, V205)));

    assertDelivery(
        LOAD,
        MOGADISHU,
        DAY2,
        V205,
        ONBOARD_CARRIER,
        notArrived,
        ROUTED,
        directed,
        itinerary.eta(),
        leg2,
        UNLOAD,
        ROTTERDAM,
        DAY4,
        V205);
    try {
      new InspectLoadedCargo(cargo, handlingEvent).inspect();
    } catch (CargoHijackedException e) {
      assertMessage(e, "Cargo 'Hopeful' was hijacked.");
      assertDelivery(
          LOAD,
          MOGADISHU,
          DAY2,
          V205,
          TransportStatus.UNKNOWN,
          notArrived,
          ROUTED,
          directed,
          itinerary.eta(),
          leg2,
          UNLOAD,
          ROTTERDAM,
          DAY4,
          V205);
    }
  }
Пример #2
0
  @BeforeClass
  public static void setup() throws Exception {
    TestApplication.setup();

    // Create new cargo
    routeSpec = routeSpecFactory.build(HONGKONG, STOCKHOLM, new Date(), deadline = DAY24);
    delivery = delivery(TODAY, IN_PORT, ROUTED, leg1);
    cargo = CARGOS.createCargo(routeSpec, delivery, "Loaded_CARGO");
    trackingId = cargo.trackingId().get();
    delivery = cargo.delivery().get();
  }
Пример #3
0
  @Test
  public void riskZoneDestination() throws Exception {
    success_Load();

    // Risk zone destination
    routeSpec = routeSpecFactory.build(HANGZHOU, ROTTERDAM, new Date(), deadline = DAY24);
    delivery = delivery(TODAY, ONBOARD_CARRIER, ROUTED, leg1);
    cargo = CARGOS.createCargo(routeSpec, delivery, "Naive");
    trackingId = cargo.trackingId().get();
    itinerary =
        itinerary(
            leg(V205, HANGZHOU, MOGADISHU, DAY1, DAY2),
            leg(V205, MOGADISHU, ROTTERDAM, DAY2, DAY4));
    cargo.itinerary().set(itinerary);

    handlingEvent =
        HANDLING_EVENTS.createHandlingEvent(DAY1, DAY1, trackingId, LOAD, HANGZHOU, V205);
    cargo
        .delivery()
        .set(
            delivery(
                handlingEvent,
                ONBOARD_CARRIER,
                notArrived,
                ROUTED,
                directed,
                itinerary.eta(),
                leg1,
                nextHandlingEvent(UNLOAD, MOGADISHU, DAY2, V205)));

    assertDelivery(
        LOAD,
        HANGZHOU,
        DAY1,
        V205,
        ONBOARD_CARRIER,
        notArrived,
        ROUTED,
        directed,
        itinerary.eta(),
        leg1,
        UNLOAD,
        MOGADISHU,
        DAY2,
        V205);
    try {
      new InspectLoadedCargo(cargo, handlingEvent).inspect();
    } catch (CargoHijackedException e) {
      assertMessage(e, "Cargo 'Naive' was hijacked.");
      assertDelivery(
          LOAD,
          HANGZHOU,
          DAY1,
          V205,
          TransportStatus.UNKNOWN,
          notArrived,
          ROUTED,
          directed,
          itinerary.eta(),
          leg1,
          UNLOAD,
          MOGADISHU,
          DAY2,
          V205);
    }
  }