@Test
 public void testCreatedUserNotVerified() {
   String tmpUserIdString = createUserForDelete();
   boolean verified = template.queryForObject(verifyUserSqlFormat, Boolean.class, tmpUserIdString);
   assertFalse(verified);
   ScimUser user = db.retrieve(tmpUserIdString);
   assertFalse(user.isVerified());
   removeUser(tmpUserIdString);
 }
 @Test
 public void testUpdatedVersionedUserVerified() {
   String tmpUserIdString = createUserForDelete();
   ScimUser user = db.retrieve(tmpUserIdString);
   assertFalse(user.isVerified());
   user = db.verifyUser(tmpUserIdString, user.getVersion());
   assertTrue(user.isVerified());
   removeUser(tmpUserIdString);
 }
 @Test
 public void testUserVerifiedThroughUpdate() {
   String tmpUserIdString = createUserForDelete();
   ScimUser user = db.retrieve(tmpUserIdString);
   assertFalse(user.isVerified());
   user.setVerified(true);
   user = db.update(tmpUserIdString, user);
   assertTrue(user.isVerified());
   removeUser(tmpUserIdString);
 }
Пример #4
0
 @Test
 public void testCreatedUserNotVerified() {
   String tmpUserIdString = createUserForDelete();
   boolean verified =
       jdbcTemplate.queryForObject(VERIFY_USER_SQL_FORMAT, Boolean.class, tmpUserIdString);
   assertFalse(verified);
   ScimUser user = db.retrieve(tmpUserIdString);
   assertFalse(user.isVerified());
   removeUser(tmpUserIdString);
 }
 @Test(expected = OptimisticLockingFailureException.class)
 public void testUpdatedIncorrectVersionUserVerified() {
   String tmpUserIdString = createUserForDelete();
   try {
     ScimUser user = db.retrieve(tmpUserIdString);
     assertFalse(user.isVerified());
     user = db.verifyUser(tmpUserIdString, user.getVersion() + 50);
     assertTrue(user.isVerified());
   } finally {
     removeUser(tmpUserIdString);
   }
 }
 @Test(expected = ScimResourceNotFoundException.class)
 public void testUserVerifiedInvalidUserId() {
   String tmpUserIdString = createUserForDelete();
   try {
     ScimUser user = db.retrieve(tmpUserIdString);
     assertFalse(user.isVerified());
     user = db.verifyUser("-1-1-1", -1);
     assertTrue(user.isVerified());
   } finally {
     removeUser(tmpUserIdString);
   }
 }
Пример #7
0
 @Test
 public void createUserWithNoZoneDefaultsToUAAZone() {
   String id = UUID.randomUUID().toString();
   jdbcTemplate.execute(
       String.format(
           OLD_ADD_USER_SQL_FORMAT,
           id,
           "test-username",
           "password",
           "*****@*****.**",
           "givenName",
           "familyName",
           "1234567890"));
   ScimUser user = db.retrieve(id);
   assertEquals("uaa", user.getZoneId());
   assertNull(user.getSalt());
 }
Пример #8
0
  @Test
  public void canModifyPassword() throws Exception {
    ScimUser user = new ScimUser(null, generator.generate() + "@foo.com", "Jo", "User");
    user.addEmail(user.getUserName());
    ScimUser created = db.createUser(user, "j7hyqpassX");
    assertNull(user.getPasswordLastModified());
    assertNotNull(created.getPasswordLastModified());
    assertEquals(
        (created.getMeta().getCreated().getTime() / 1000l) * 1000l,
        created.getPasswordLastModified().getTime());
    Thread.sleep(10);
    db.changePassword(created.getId(), "j7hyqpassX", "j7hyqpassXXX");

    user = db.retrieve(created.getId());
    assertNotNull(user.getPasswordLastModified());
    assertEquals(
        (user.getMeta().getLastModified().getTime() / 1000l) * 1000l,
        user.getPasswordLastModified().getTime());
  }
 @Test(expected = ScimResourceNotFoundException.class)
 public void cannotRetrieveNonexistentUser() {
   ScimUser joe = db.retrieve("9999");
   assertJoe(joe);
 }
 @Test
 public void canRetrieveExistingUser() {
   ScimUser joe = db.retrieve(JOE_ID);
   assertJoe(joe);
 }