Skip to content

Commit f5e43c5

Browse files
committed
Update TestJWT.java
1 parent 5ba9e3e commit f5e43c5

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/test/java/org/privacyidea/TestJWT.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public class TestJWT extends PILogImplementation implements org.mockserver.mock.
2020
{
2121
private ClientAndServer mockServer;
2222
private String jwt;
23-
private final int jwtExpirationTimeMs = 4000;
24-
private final int mockServerResponseDelayMs = 2000;
25-
private int testIterations = 4;
23+
private final int jwtExpirationTimeMs = 3000;
24+
private final int mockServerResponseDelayMs = 1000;
25+
private final int testIterations = 5;
2626

2727
private final String serviceAccount = "admin";
2828
private final String servicePassword = "admin";
@@ -53,7 +53,8 @@ public void testMultipleRetrieval()
5353
{
5454
for (int i = 0; i < this.testIterations; i++)
5555
{
56-
assertEquals(this.jwt, privacyIDEA.getJWT());
56+
String newJWT = privacyIDEA.getJWT();
57+
assertEquals(this.jwt, newJWT);
5758
try
5859
{
5960
Thread.sleep(this.jwtExpirationTimeMs);
@@ -66,7 +67,7 @@ public void testMultipleRetrieval()
6667
// Wait for the last connection to finish before closing
6768
try
6869
{
69-
Thread.sleep(this.mockServerResponseDelayMs);
70+
Thread.sleep(this.mockServerResponseDelayMs*2);
7071
}
7172
catch (InterruptedException e)
7273
{
@@ -109,7 +110,8 @@ private String postAuthSuccessResponse(String jwt)
109110
public HttpResponse handle(HttpRequest httpRequest) throws Exception
110111
{
111112
// The next retrieval is always scheduled for 1 minute before expiration
112-
this.jwt = generateJWT(65000 + this.jwtExpirationTimeMs);
113+
this.jwt = generateJWT(60000 + this.jwtExpirationTimeMs);
114+
//System.out.println("Generated JWT: " + this.jwt);
113115
return HttpResponse.response().withBody(postAuthSuccessResponse(this.jwt));
114116
}
115117
}

0 commit comments

Comments
 (0)