KEYCLOAK-3997 InfinispanKeyStorageProviderTest was failing

This commit is contained in:
mposolda 2016-11-30 08:38:35 +01:00
parent 294dc6fbd0
commit ec49d10007
2 changed files with 7 additions and 2 deletions

View file

@ -55,12 +55,13 @@ public class InfinispanPublicKeyStorageProvider implements PublicKeyStorageProvi
private Set<String> invalidations = new HashSet<>(); private Set<String> invalidations = new HashSet<>();
private boolean transactionEnlisted = false;
public InfinispanPublicKeyStorageProvider(KeycloakSession session, Cache<String, PublicKeysEntry> keys, Map<String, FutureTask<PublicKeysEntry>> tasksInProgress, int minTimeBetweenRequests) { public InfinispanPublicKeyStorageProvider(KeycloakSession session, Cache<String, PublicKeysEntry> keys, Map<String, FutureTask<PublicKeysEntry>> tasksInProgress, int minTimeBetweenRequests) {
this.session = session; this.session = session;
this.keys = keys; this.keys = keys;
this.tasksInProgress = tasksInProgress; this.tasksInProgress = tasksInProgress;
this.minTimeBetweenRequests = minTimeBetweenRequests; this.minTimeBetweenRequests = minTimeBetweenRequests;
session.getTransactionManager().enlistAfterCompletion(getAfterTransaction());
} }
@ -73,6 +74,11 @@ public class InfinispanPublicKeyStorageProvider implements PublicKeyStorageProvi
void addInvalidation(String cacheKey) { void addInvalidation(String cacheKey) {
if (!transactionEnlisted) {
session.getTransactionManager().enlistAfterCompletion(getAfterTransaction());
transactionEnlisted = true;
}
this.invalidations.add(cacheKey); this.invalidations.add(cacheKey);
} }

View file

@ -45,7 +45,6 @@ import org.keycloak.keys.PublicKeyLoader;
/** /**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/ */
@Ignore
public class InfinispanKeyStorageProviderTest { public class InfinispanKeyStorageProviderTest {
private Map<String, AtomicInteger> counters = new ConcurrentHashMap<>(); private Map<String, AtomicInteger> counters = new ConcurrentHashMap<>();