Fix timeouts in DemoServlets tests

This commit is contained in:
mhajas 2016-03-31 12:45:00 +02:00
parent def40448ac
commit ff66d471e2

View file

@ -25,7 +25,6 @@ import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.keycloak.OAuth2Constants; import org.keycloak.OAuth2Constants;
import org.keycloak.common.Version; import org.keycloak.common.Version;
import org.keycloak.common.util.Time;
import org.keycloak.constants.AdapterConstants; import org.keycloak.constants.AdapterConstants;
import org.keycloak.protocol.oidc.OIDCLoginProtocolService; import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
import org.keycloak.representations.VersionRepresentation; import org.keycloak.representations.VersionRepresentation;
@ -49,6 +48,7 @@ import java.util.concurrent.TimeUnit;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals; import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf; import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
import static org.keycloak.testsuite.util.WaitUtils.pause;
/** /**
* *
@ -226,7 +226,8 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
demoRealmRep.setSsoSessionIdleTimeout(1); demoRealmRep.setSsoSessionIdleTimeout(1);
testRealmResource().update(demoRealmRep); testRealmResource().update(demoRealmRep);
// Thread.sleep(2000); pause(2000);
productPortal.navigateTo(); productPortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
@ -253,16 +254,16 @@ public abstract class AbstractDemoServletsAdapterTest extends AbstractServletsAd
demoRealmRep.setSsoSessionIdleTimeout(1); demoRealmRep.setSsoSessionIdleTimeout(1);
testRealmResource().update(demoRealmRep); testRealmResource().update(demoRealmRep);
Time.setOffset(2); pause(2000);
productPortal.navigateTo(); productPortal.navigateTo();
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); assertCurrentUrlStartsWithLoginUrlOf(testRealmPage);
// need to cleanup so other tests don't fail, so invalidate http sessions on remote clients. // need to cleanup so other tests don't fail, so invalidate http sessions on remote clients.
demoRealmRep.setSsoSessionIdleTimeout(originalIdle); demoRealmRep.setSsoSessionIdleTimeout(originalIdle);
testRealmResource().update(demoRealmRep);
// note: sessions invalidated after each test, see: AbstractKeycloakTest.afterAbstractKeycloakTest() // note: sessions invalidated after each test, see: AbstractKeycloakTest.afterAbstractKeycloakTest()
Time.setOffset(0);
} }
@Test @Test