Merge pull request #2334 from mposolda/dblock2

Fix testsuite with Mongo
This commit is contained in:
Marek Posolda 2016-03-07 13:15:31 +01:00
commit f597f163f7
3 changed files with 31 additions and 1 deletions

View file

@ -547,10 +547,11 @@ public abstract class AbstractKeycloakIdentityProviderTest extends AbstractIdent
@Test @Test
public void testWithLinkedFederationProvider() throws Exception { public void testWithLinkedFederationProvider() throws Exception {
setUpdateProfileFirstLogin(IdentityProviderRepresentation.UPFLM_OFF);
// Add federationProvider to realm. It's configured with sync registrations // Add federationProvider to realm. It's configured with sync registrations
RealmModel realm = getRealm(); RealmModel realm = getRealm();
UserFederationProviderModel dummyModel = realm.addUserFederationProvider(DummyUserFederationProviderFactory.PROVIDER_NAME, new HashMap<String, String>(), 1, "test-dummy", -1, -1, 0); UserFederationProviderModel dummyModel = realm.addUserFederationProvider(DummyUserFederationProviderFactory.PROVIDER_NAME, new HashMap<String, String>(), 1, "test-dummy", -1, -1, 0);
setUpdateProfileFirstLogin(IdentityProviderRepresentation.UPFLM_OFF);
brokerServerRule.stopSession(session, true); brokerServerRule.stopSession(session, true);
session = brokerServerRule.startSession(); session = brokerServerRule.startSession();

View file

@ -103,6 +103,34 @@ public abstract class AbstractOfflineCacheCommand extends AbstractCommand {
} }
} }
// Just to check performance of multiple get calls. And comparing what's the change between the case when item is available locally or not.
public static class GetMultipleCommand extends AbstractOfflineCacheCommand {
@Override
public String getName() {
return "getMulti";
}
@Override
protected void doRunCacheCommand(KeycloakSession session, Cache<String, SessionEntity> cache) {
String id = getArg(0);
int count = getIntArg(1);
long start = System.currentTimeMillis();
for (int i=0 ; i<count ; i++) {
UserSessionEntity userSession = (UserSessionEntity) cache.get(id);
//printSession(id, userSession);
}
long took = System.currentTimeMillis() - start;
log.infof("Took %d milliseconds", took);
}
@Override
public String printUsage() {
return getName() + " <user-session-id> <count-of-gets>";
}
}
public static class RemoveCommand extends AbstractOfflineCacheCommand { public static class RemoveCommand extends AbstractOfflineCacheCommand {

View file

@ -45,6 +45,7 @@ public class TestsuiteCLI {
HelpCommand.class, HelpCommand.class,
AbstractOfflineCacheCommand.PutCommand.class, AbstractOfflineCacheCommand.PutCommand.class,
AbstractOfflineCacheCommand.GetCommand.class, AbstractOfflineCacheCommand.GetCommand.class,
AbstractOfflineCacheCommand.GetMultipleCommand.class,
AbstractOfflineCacheCommand.GetLocalCommand.class, AbstractOfflineCacheCommand.GetLocalCommand.class,
AbstractOfflineCacheCommand.RemoveCommand.class, AbstractOfflineCacheCommand.RemoveCommand.class,
AbstractOfflineCacheCommand.SizeCommand.class, AbstractOfflineCacheCommand.SizeCommand.class,