Ensure the order of clean token tests.
Change-Id: Id506f1ea6d89f4914009d8004dd4048775c7ad90
diff --git a/full/Changes b/full/Changes
index 40aef19..32197e0 100644
--- a/full/Changes
+++ b/full/Changes
@@ -12,6 +12,7 @@
- Resolved duplicate libraries
- Fixed testing expiry access token
- Fix lombok compile warning
+- Ensure the order of clean token tests.
# version 0.70.1
diff --git a/full/pom.xml b/full/pom.xml
index 7719546..4629f97 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -13,8 +13,8 @@
<jetty.version>9.4.51.v20230217</jetty.version>
<flyway.version>9.21.1</flyway.version>
<log4j.version>2.20.0</log4j.version>
- <krill.version>[0.61.3,)</krill.version>
- <koral.version>[0.41,)</koral.version>
+ <krill.version>0.61.3</krill.version>
+ <koral.version>0.41.0</koral.version>
</properties>
<profiles>
<profile>
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
index a4fed9b..5ea99fe 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
@@ -1,18 +1,7 @@
package de.ids_mannheim.korap.web.controller;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.net.HttpHeaders;
-import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
-import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.oauth2.dao.AccessTokenDao;
-import de.ids_mannheim.korap.oauth2.dao.RefreshTokenDao;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import org.apache.http.entity.ContentType;
-import org.junit.jupiter.api.Order;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Entity;
@@ -20,8 +9,21 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.apache.http.entity.ContentType;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.net.HttpHeaders;
+
+import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.oauth2.dao.AccessTokenDao;
+import de.ids_mannheim.korap.oauth2.dao.RefreshTokenDao;
+import de.ids_mannheim.korap.utils.JsonUtils;
@Order(Integer.MAX_VALUE) // make sure this runs as last test as it removes tokens
public class OAuth2AdminControllerTest extends OAuth2TestBase {
@@ -66,6 +68,7 @@
}
@Test
+ @Order(1)
public void testCleanExpiredTokensUsingAdminToken() throws KustvaktException {
createExpiredAccessToken();
@@ -83,7 +86,9 @@
}
@Test
- public void testCleanRevokedTokens() throws KustvaktException {
+ @Order(2)
+ public void testCleanRevokedTokens () throws KustvaktException {
+
int accessTokensBefore = accessDao.retrieveInvalidAccessTokens().size();
String code = requestAuthorizationCode(publicClientId, userAuthHeader);
Response response = requestTokenWithAuthorizationCodeAndForm(publicClientId, clientSecret, code);