Package at.fhj.itm.model

Examples of at.fhj.itm.model.User


   * 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");
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);
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");
View Full Code Here

    {
  // Configure mock object
  UserDAO mock = createMock(UserDAO.class);
  Connection mockConnection = createMock(Connection.class);
  Location location = new Location(1234, "Unit City");
  User p = new User("Unit", "Test", "UnitTest", "1234", "Unit@Test.com",
    "123456", location, new Date(), UUID.randomUUID().toString()
      .replace("-", ""));
  mock.update(p,mockConnection);
  replay(mock);
View Full Code Here

    Location a = new Location(8605, "Kapfenberg");
    Location b = new Location(8010, "Graz");
    Location c = new Location(1020, "Wien");
    Location d = new Location(5030, "Salzburg");

    User u = new User(-1, "Bert", "Beutel", "bertBeut", "12345",
        "bert.beutel@local.at", "004312345678", a, new Date(),
        "qweiurioewhu");

    User v = new User(-1, "Klara", "Klaustaler", "KK", "12345",
        "k.k@local.at", "004312345678", b, new Date(), "nsvjdna");

    Waypoint ab = new Waypoint(a, b, u, "", true);
    Waypoint ba = new Waypoint(b, a, u, "", true);
    Waypoint bc = new Waypoint(b, c, v, "", true);
View Full Code Here

    assertEquals(expected.getSessionID(), actual.getSessionID());
   
  }
  @Test
  public void testUpdate(){
    User uOld = dao.getByID(1,connection);
    User uNew = dao.getByID(1,connection);
   
    uNew.setFirstName("Unit");
    uNew.setLastLoginDate(new Date());
    uNew.setLastName("Test");
    uNew.setSessionID(UUID.randomUUID().toString().replace("-", ""));
    uNew.setPassword("1234");
    uNew.setUsername("UnitTest");
    uNew.setEmail("Unit@Test.com");
    dao.update(uNew,connection);
   
    User uUpdate = dao.getByID(1,connection);
    assertUserEquals(uUpdate, uNew);
    dao.update(uOld,connection);
    User uRestored = dao.getByID(1,connection);
    assertUserEquals(uOld, uRestored);
   
  }
View Full Code Here

  @Test
  public void testGetAll()
  {
    List<User> users = dao.selectAll(connection);
    assertTrue(users.size() >= 1);
    User u = users.get(0);
    assertNotNull(u.getUsername());
    assertNotNull(u.getPassword());
    assertNotNull(u.getPassword());
    assertNotNull(u.getPhone());
    assertTrue(u.getId() >= 0);
  }
View Full Code Here

  @Test
  public void testInsertDelete()
  {
    int count = dao.selectAll(connection).size();
    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("-", ""));
    dao.update(user,connection);
    int newCount = dao.selectAll(connection).size();
    assertTrue(newCount > count);
   
    dao.delete(user,connection);
    assertEquals(-1, user.getId());
    assertEquals(-1, user.getLocation().getId());
    int countAfterDelete = dao.selectAll(connection).size();
    assertEquals(count, countAfterDelete);
  }
View Full Code Here

  /**
   * The Bean asks the Assembler for a ServiceUser and will get a Mock
   */
  @Before
  public void setup() {
    this.mockUser = new User("", "", "", this.pwd, this.email, "", null,
        null, "");
    mockServiceUser = EasyMock.createMock(ServiceUser.class);
    mockJsfUtil = EasyMock.createMock(JsfUtil.class);

    ServiceAssembler serviceAssembler = new ServiceAssembler() {
View Full Code Here

public class UserTest {

  @Test
  public void testEquals()
  {
    User user = new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" );
   
    Assert.assertTrue(user.equals(user));
    Assert.assertTrue(user.equals(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
   
    Assert.assertFalse(user.equals(new User( 1, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Bob", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Lotte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "nina", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "viva", "gusto", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@gmail.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/66666", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8010, "Graz"), new Date(9999), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(1111), "sessionID" )));
    Assert.assertFalse(user.equals(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "otherSessionID" )));
   
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", null, "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), "sessionID" ).equals(user));
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", null, new Date(9999), "sessionID" ).equals(user));
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), null, "sessionID" ).equals(user));
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), new Date(9999), null ).equals(user));
   
    user = new User( 0, "Huge", "Notte", "viva", null, "huge.notte@hotmile.com", "0123/12345", null,null, null );
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", "geilo", "huge.notte@hotmile.com", "0123/12345", null, null, null ).equals(user));
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", null, "huge.notte@hotmile.com", "0123/12345", null, null, "sessionID" ).equals(user));
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", null, "huge.notte@hotmile.com", "0123/12345", new Location(8605, "Kapfenberg"), null, null ).equals(user));
    Assert.assertFalse(new User( 0, "Huge", "Notte", "viva", null, "huge.notte@hotmile.com", "0123/12345", null, new Date(9999), null ).equals(user));
   
    Assert.assertFalse(user.equals("notAUser"));
    Assert.assertFalse(user.equals(null));
  }
View Full Code Here

TOP

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

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.