コード例 #1
0
 @Test
 public void addUsersWithSameUsername() throws Exception {
   String origin = "testOrigin";
   String email = "*****@*****.**";
   String firstName = "FirstName";
   String lastName = "LastName";
   String password = "";
   String externalId = null;
   String userId = new RandomValueStringGenerator().generate();
   String username = new RandomValueStringGenerator().generate();
   UaaUser user =
       getUaaUser(
           new String[0],
           origin,
           email,
           firstName,
           lastName,
           password,
           externalId,
           userId,
           username);
   ScimUserBootstrap bootstrap = new ScimUserBootstrap(db, gdb, mdb, Arrays.asList(user));
   bootstrap.afterPropertiesSet();
   user = user.modifySource("newOrigin", "");
   bootstrap.addUser(user);
   assertEquals(2, db.retrieveAll().size());
 }
コード例 #2
0
 @Test
 public void canAddUsers() throws Exception {
   UaaUser joe = new UaaUser("joe", "password", "*****@*****.**", "Joe", "User");
   UaaUser mabel = new UaaUser("mabel", "password", "*****@*****.**", "Mabel", "User");
   ScimUserBootstrap bootstrap = new ScimUserBootstrap(db, gdb, mdb, Arrays.asList(joe, mabel));
   bootstrap.afterPropertiesSet();
   Collection<ScimUser> users = db.retrieveAll();
   assertEquals(2, users.size());
 }
コード例 #3
0
 @Test
 public void failedAttemptToUpdateUsersNotFatal() throws Exception {
   UaaUser joe = new UaaUser("joe", "password", "*****@*****.**", "Joe", "User");
   ScimUserBootstrap bootstrap = new ScimUserBootstrap(db, gdb, mdb, Arrays.asList(joe));
   bootstrap.afterPropertiesSet();
   joe = new UaaUser("joe", "new", "*****@*****.**", "Joe", "Bloggs");
   bootstrap = new ScimUserBootstrap(db, gdb, mdb, Arrays.asList(joe));
   bootstrap.setOverride(false);
   bootstrap.afterPropertiesSet();
   Collection<ScimUser> users = db.retrieveAll();
   assertEquals(1, users.size());
   assertEquals("User", users.iterator().next().getFamilyName());
 }
コード例 #4
0
  @Test
  public void canAddMembers() throws Exception {
    bootstrap.setGroupMembers(
        Arrays.asList(
            "org1.dev|dev1,dev2,dev3",
            "org1.dev|hr1,mgr1|write",
            "org1.qa|qa1,qa2,qa3",
            "org1.mgr|mgr1",
            "org1.hr|hr1",
            "org1.engg|org1.dev,org1.qa,org1.mgr"));
    bootstrap.afterPropertiesSet();

    assertEquals(5, gDB.retrieveAll().size());
    assertEquals(7, uDB.retrieveAll().size());
    assertEquals(2, bootstrap.getGroup("org1.qa").getMembers().size());
    assertEquals(1, bootstrap.getGroup("org1.hr").getMembers().size());
    assertEquals(3, bootstrap.getGroup("org1.engg").getMembers().size());
    assertEquals(
        2,
        mDB.getMembers(bootstrap.getGroup("org1.dev").getId(), ScimGroupMember.Role.WRITER).size());
  }
コード例 #5
0
  @Before
  public void initScimGroupBootstrapTests() {
    JdbcTemplate template = jdbcTemplate;
    JdbcPagingListFactory pagingListFactory = new JdbcPagingListFactory(template, limitSqlAdapter);
    gDB = new JdbcScimGroupProvisioning(template, pagingListFactory);
    uDB = new JdbcScimUserProvisioning(template, pagingListFactory);
    mDB = new JdbcScimGroupMembershipManager(template, pagingListFactory);
    mDB.setScimGroupProvisioning(gDB);
    mDB.setScimUserProvisioning(uDB);

    uDB.createUser(TestUtils.scimUserInstance("dev1"), "test");
    uDB.createUser(TestUtils.scimUserInstance("dev2"), "test");
    uDB.createUser(TestUtils.scimUserInstance("dev3"), "test");
    uDB.createUser(TestUtils.scimUserInstance("qa1"), "test");
    uDB.createUser(TestUtils.scimUserInstance("qa2"), "test");
    uDB.createUser(TestUtils.scimUserInstance("mgr1"), "test");
    uDB.createUser(TestUtils.scimUserInstance("hr1"), "test");

    assertEquals(7, uDB.retrieveAll().size());
    assertEquals(0, gDB.retrieveAll().size());

    bootstrap = new ScimGroupBootstrap(gDB, uDB, mDB);
  }
コード例 #6
0
 @Test
 public void canRetrieveUsers() {
   assertTrue(2 <= db.retrieveAll().size());
 }