KEYCLOAK-2542 Fix tests

This commit is contained in:
mposolda 2016-03-01 10:46:18 +01:00
parent 0768bcc452
commit e6e367392a
2 changed files with 10 additions and 3 deletions

View file

@ -39,7 +39,11 @@ import java.util.Set;
*/ */
public class DummyUserFederationProvider implements UserFederationProvider { public class DummyUserFederationProvider implements UserFederationProvider {
private static Map<String, UserModel> users = new HashMap<String, UserModel>(); private final Map<String, UserModel> users;
public DummyUserFederationProvider(Map<String, UserModel> users) {
this.users = users;
}
@Override @Override
public UserModel validateAndProxy(RealmModel realm, UserModel local) { public UserModel validateAndProxy(RealmModel realm, UserModel local) {

View file

@ -25,6 +25,7 @@ import org.keycloak.models.UserFederationProvider;
import org.keycloak.models.UserFederationProviderFactory; import org.keycloak.models.UserFederationProviderFactory;
import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.UserFederationProviderModel;
import org.keycloak.models.UserFederationSyncResult; import org.keycloak.models.UserFederationSyncResult;
import org.keycloak.models.UserModel;
import org.keycloak.provider.ConfiguredProvider; import org.keycloak.provider.ConfiguredProvider;
import org.keycloak.provider.ProviderConfigProperty; import org.keycloak.provider.ProviderConfigProperty;
@ -43,9 +44,11 @@ public class DummyUserFederationProviderFactory implements UserFederationProvide
private AtomicInteger fullSyncCounter = new AtomicInteger(); private AtomicInteger fullSyncCounter = new AtomicInteger();
private AtomicInteger changedSyncCounter = new AtomicInteger(); private AtomicInteger changedSyncCounter = new AtomicInteger();
private Map<String, UserModel> users = new HashMap<String, UserModel>();
@Override @Override
public UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model) { public UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model) {
return new DummyUserFederationProvider(); return new DummyUserFederationProvider(users);
} }
@Override @Override
@ -57,7 +60,7 @@ public class DummyUserFederationProviderFactory implements UserFederationProvide
@Override @Override
public UserFederationProvider create(KeycloakSession session) { public UserFederationProvider create(KeycloakSession session) {
return new DummyUserFederationProvider(); return new DummyUserFederationProvider(users);
} }
@Override @Override