fixed ManyUsersTest

This commit is contained in:
Tomas Kyjovsky 2016-12-15 15:34:27 +01:00
parent 2ba21485f9
commit 1c65fd86ef

View file

@ -98,7 +98,7 @@ public class ManyUsersTest extends AbstractUserTest {
if (CREATE_OBJECTS) { if (CREATE_OBJECTS) {
// Assuming default groups and required action already created // Assuming default groups and required action already created
if (realmResource().getDefaultGroups().size() == 0) { if (realmResource().getDefaultGroups().isEmpty()) {
log.infof("Creating default groups 'group1' and 'group2'."); log.infof("Creating default groups 'group1' and 'group2'.");
setDefaultGroup("group1"); setDefaultGroup("group1");
setDefaultGroup("group2"); setDefaultGroup("group2");
@ -121,20 +121,17 @@ public class ManyUsersTest extends AbstractUserTest {
realmResource().addDefaultGroup(groupId); realmResource().addDefaultGroup(groupId);
} }
@After @After
public void after() { public void after() {
realmTimer.clearStats(true, true, false); realmTimer.clearStats(true, true, false);
usersTimer.clearStats(); usersTimer.clearStats();
} }
@Override @Override
public UserRepresentation createUser(UsersResource users, UserRepresentation user) { public UserRepresentation createUser(UsersResource users, UserRepresentation user) {
// Add some additional attributes to user // Add some additional attributes to user
if (CREATE_OBJECTS) { if (CREATE_OBJECTS) {
Map<String, Object> attrs = new HashMap<>(); Map<String, List<String>> attrs = new HashMap<>();
attrs.put("attr1", Collections.singletonList("val1")); attrs.put("attr1", Collections.singletonList("val1"));
attrs.put("attr2", Collections.singletonList("val2")); attrs.put("attr2", Collections.singletonList("val2"));
user.setAttributes(attrs); user.setAttributes(attrs);
@ -247,4 +244,10 @@ public class ManyUsersTest extends AbstractUserTest {
realmTimer.reset(); realmTimer.reset();
} }
private void createRealm(String REALM) {
RealmRepresentation rep = new RealmRepresentation();
rep.setRealm(REALM);
adminClient.realms().create(rep);
}
} }