Package at.fhj.itm.model

Examples of at.fhj.itm.model.Location


     */
    public Waypoint getUserWaypoint() {
      if (!isLoggedIn())
        return null;
      if (userWaypoint == null) {
        userWaypoint = new Waypoint(new Location(trip.getWaypoint()
            .getFromLocation()), new Location(trip.getWaypoint()
            .getToLocation()), getLoggedInUser(), "", false);
      }
      return userWaypoint;
    }
View Full Code Here


    String phone = set.getString("phone");
    int location = set.getInt("location");
    java.util.Date lastLogin = set.getTimestamp("last_login");
    String session = set.getString("session");

    Location tmp_location = this.locationDAO.getByID(location, connection);

    return new User(id, firstName, lastName, userName, password, eMail,
        phone, tmp_location, lastLogin, session);

  }
View Full Code Here

   */
  @Test
  public void testUpdate(){
    List<Location>  all= dao.selectAll(connection);
    assertTrue(all.size() > 0);
    Location oldLocation = all.get(0);
    long newZip = 3456;
    String newCity = "Update Town";
    long oldZip = oldLocation.getZip();
    String oldCity = oldLocation.getCity();
   
    oldLocation.setZip(newZip);
    oldLocation.setCity(newCity);
   
    dao.update(oldLocation,connection);
   
    Location uptLocation = dao.getByID(oldLocation.getId(),connection);
   
    assertEquals(newZip, uptLocation.getZip());
    assertEquals(newCity, uptLocation.getCity());
   
   
    uptLocation.setZip(oldZip);
    uptLocation.setCity(oldCity);
   
   
    dao.update(uptLocation,connection);
   
   
View Full Code Here

   */
  @Before
  public void setUp() throws Exception {
    departure = new Date();
    mockTripCreator = new User("Trip","Creator","","","","",null,null, "");
    fromLocation = new Location(1,1000,"City1");
    toLocation = new Location(2,2000,"City2");
    mockTripWaypoint = new Waypoint(1,fromLocation,toLocation,mockTripCreator,"",true);
    mockTrip4Seats = new Trip(1,mockTripCreator,departure,4,mockTripWaypoint,"");
    mockTripBooker = new User("Trip", "Booker", "", "", "", "", null, null, "");
    mockBookerWaypointInactive = new Waypoint(fromLocation,toLocation,mockTripBooker,"",false);
    mockJsfUtil = EasyMock.createMock(JsfUtil.class);
View Full Code Here

   * Tests if a new entity can be inserted into the database and if it's ID gets
   * updated properly. After a sucessfull insert the location is deleted.
   */
  @Test
  public void testInsertDelete(){
    Location location = new Location(1234, "Unit Town");
    assertEquals(-1, location.getId());
    dao.update(location, connection);
    assertTrue(location.getId() >= 0);
    dao.delete(location,connection);
    assertEquals(-1, location.getId());
   
   
  }
View Full Code Here

   * Creates a fully fledged Waypoint which can be used by test cases
   * @return
   */
  private Waypoint createTestWaypoint(){
    User u = userDAO.getByID(1,connection);
    Location from = new Location(8190, "Birkfeld");
    Location to = new Location(8010, "Graz");
    Waypoint wp = new Waypoint(from, to, u, "Unit Test", true);
    return wp;
  }
View Full Code Here

  /**
   * Helper method for creating a fully fledged trip object
   * @return a fully fledged trip object which can be used by testcases.
   */
  private Trip createTestTrip(){
    Location location = new Location(1234, "Unit City");
    User user = new User("Unit", "Test", "UnitTest", "1234", "Unit@Test.com", "123456",
        location, new Date(), UUID.randomUUID().toString().replace("-", ""));
    Location from = new Location(8190, "Birkfeld");
    Location to = new Location(8010, "Graz");
    Waypoint wp = new Waypoint(from, to, user, "", true);
    Trip t = new Trip(user, new Date(), 4, wp, "Copyright (C) Google");
   
    return t;
  }
View Full Code Here

   */
  @Test
  public void testWaypointUser()throws SQLException
  {
 
    Location location = new Location(1234, "Unit City");
    User user = new User("Unit", "Test", "UnitTest", "1234", "Unit@Test.com", "123456",
        location, new Date(), UUID.randomUUID().toString().replace("-", ""));
    userDAO.update(user, connection);
    List<Waypoint> wps = new ArrayList<Waypoint>();
    for(int i = 0; i< 10; i++){
      Location from = new Location(1000 + i, "Town " + i);
      Location to = new Location(1000 + i+1, "Town " + i+1);
     
      Waypoint wp = new Waypoint(from, to, user, "WP " + i, true);
      wps.add(wp);
      dao.update(wp,connection);
    }
View Full Code Here

  @Test
  public void testUpdate(){
    Waypoint wp = createTestWaypoint();
    dao.update(wp, connection);
    assertTrue(wp.getId() != -1);
    wp.setFrom_location(new Location(8888, "New Location"));
    dao.update(wp, connection);
    Waypoint newWp = dao.getByID(wp.getId(), connection);
    assertEquals(wp, newWp);
   
  }
View Full Code Here

  /**
   * Helper method for creating a fully fledged trip object
   * @return a fully fledged trip object which can be used by testcases.
   */
  private Trip createTestTrip(){
    Location location = new Location(1234, "Unit City");
    User user = new User("Unit", "Test", "UnitTest", "1234", "Unit@Test.com", "123456",
        location, new Date(), UUID.randomUUID().toString().replace("-", ""));
    Location from = new Location(8190, "Birkfeld");
    Location to = new Location(8010, "Graz");
    Waypoint wp = new Waypoint(from, to, user, "", true);
    Trip t = new Trip(user, new Date(), 4, wp, "Copyright (C) Google");
   
    return t;
  }
View Full Code Here

TOP

Related Classes of at.fhj.itm.model.Location

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.