Exemplo n.º 1
0
 /**
  * Test method for {@link org.microworld.robots.DriverAgent#postTrip(org.microworld.models.Trip)}
  * .
  */
 @Test
 public void testPostTrip() {
   Log.verbose("driverTest", "trip : " + trip.toVerboseString());
   Trip result = driver.postTrip(trip);
   assertNotNull(result);
   assertTrue(result instanceof Trip);
   trip = result;
   driver.activateTrip(trip);
 }
Exemplo n.º 2
0
  /** @throws java.lang.Exception */
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {

    Robot path =
        new Robot(BehavioralPatterns.getBehavioralPattern(BehavioralPatterns.STRAIGHT_LINE));
    path.setRole(Role.DRIVER);
    driver.setPath(path);

    Location origin = new Location();
    Location destination = new Location();

    origin.setLeaves(new Date(System.currentTimeMillis()));
    destination.setLeaves(new Date(System.currentTimeMillis()));

    origin.setPoint(Location.ORIG);
    destination.setPoint(Location.DEST);

    origin.setGeorss_point(path.getList().get(0).toGeoRSSPoint());
    destination.setGeorss_point(path.getList().get(path.getList().size() - 1).toGeoRSSPoint());

    Mode modality = new Mode();
    modality.setLic("ASDFGH");
    modality.setKind("auto");
    modality.setCapacity(5);
    modality.setVacancy(4);
    modality.setMake("BMW");
    modality.setModel("M3");

    person.setUsername("drivertest");
    person.setPassword("password");
    person.setGender(Person.FEMALE);
    person.setEmail("*****@*****.**");
    person.setPhone("122333444466");
    driver.setUser(person);

    trip = new Trip();
    trip.setAuthor(person);
    trip.setDestination(destination);
    trip.setOrigin(origin);
    trip.setExpires(new Date(System.currentTimeMillis()));
    trip.setMode(modality);
    trip.setPreferences(new Preferences());
    trip.setActive(false);

    driver.setTrip(trip);
    Log.verbose("driverTest", driver.getUser().toString());
    driver.register(driver.getUser());
  }