Package org.cipres.treebase.domain.admin

Examples of org.cipres.treebase.domain.admin.UserHome


    UserRole testRole = new UserRole();
    testRole.setAuthority("TEST");
    user.setRole(testRole);

    UserHome fixture = getUserHome();
    fixture.store(testRole);
    fixture.store(user);

    // force commit immeidately, important:
    setComplete();
    endTransaction();
    logger.info("user created: " + user.getUsername() + "id = " + user.getId());

    // 2. verify
    String sqlStr = "select count(*) from public.user where user_id=" + user.getId();
    int count = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(count == 1);

    // 3. delete
    // fixture.delete(testRole);
    fixture.delete(user);
    setComplete();

    // 4. verify delte:
    int countVerify = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(countVerify == 0);
View Full Code Here


    user.setPassword("testPassword");

    String email = "test@cipres.treebase.org";
    user.setEmailAddressString(email);

    UserHome fixture = getUserHome();
    String sqlStr = "select count(*) from public.user where username='" + user.getUsername() + "'";

    // 3. delete
    fixture.delete(user);

    // 4. verify delte:
    int countVerify = jdbcTemplate.queryForInt(sqlStr);
    assertTrue(countVerify == 0);

View Full Code Here

    if (usernames.size() > 0) {
      assertTrue("Empty User table.", usernames.size() > 0);

      // 2. find by user name:
      UserHome fixture = getUserHome();
      String userName = usernames.get(0);
      User result = fixture.findByUserName(userName);

      // 3. verify
      assertTrue(result != null);
      assertTrue(result.getUsername().equals(userName));
      if (logger.isInfoEnabled()) {
View Full Code Here

    // 1. find a valid role first:
    String testRole = UserRole.ROLE_USER; // UserRole.ROLE_ASSO_EDITOR;

    // 2. find by user name:
    UserHome fixture = getUserHome();
    List<User> result = fixture.findbyUserRole(testRole);

    if (logger.isInfoEnabled()) {
      logger.info("test role = " + testRole + " size =" + result.size());
    }
    // 3. verify
View Full Code Here

      logger.info("username = " + u.getUsername() + " persopn =" + p.getFirstName() + " "
        + p.getLastName());
    }

    // 2. test:
    UserHome fixture = getUserHome();
    User result = fixture.findByPerson(p);

    if (logger.isInfoEnabled()) {
      logger.info("u id = " + u.getId() + " result id =" + result.getId());
    }
    // 3. verify
View Full Code Here

    if (emails.size() > 0) {
      assertTrue("Empty User table.", emails.size() > 0);

      // 2. find by user name:
      UserHome fixture = getUserHome();
      String email = emails.get(0);
      List<User> users = fixture.findByEmail(email.toUpperCase(), true);

      // 3. verify
      assertTrue(users != null && !users.isEmpty());
      User result = users.get(0);
      assertTrue(result.getEmailAddressString().equalsIgnoreCase(email));
View Full Code Here

    // 1. find a unvalid email first:
    String email = "test" + Math.random() + "@test.com";

    // 2. find by email:
    UserHome fixture = getUserHome();
    List<User> users = fixture.findByEmail(email.toUpperCase(), true);

    // 3. verify
    assertTrue("Should not find a user", users == null || users.isEmpty());

    if (logger.isInfoEnabled()) {
View Full Code Here

    if (emails.size() > 0) {
      assertTrue("Empty User table.", emails.size() > 0);

      // 2. find by user name:
      UserHome fixture = getUserHome();
      String email = emails.get(0);
      int emailSize = email.length();
      String emailTest = email;
      if (emailSize > 2) {
        emailTest = email.substring(0, emailSize - 2);
      }
      List<User> users = fixture.findByEmail(emailTest.toUpperCase(), false);

      if (logger.isInfoEnabled()) {
        logger.info("emailTest =" + emailTest + " num of matches:" + users.size());
      }
      // 3. verify
View Full Code Here

    String testName = "FindByUserName_Negative";
    if (logger.isInfoEnabled()) {
      logger.info("\n\t\tRunning Test: " + testName);
    }

    UserHome fixture = getUserHome();

    // Test a non-existing username:
    String newName = testName + " test " + Math.random();
    User result = fixture.findByUserName(newName);
    assertEquals(null, result);

    if (logger.isInfoEnabled()) {
      logger.info(testName + " - end "); //$NON-NLS-1$
    }
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.admin.UserHome

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.