Skip to content

Commit 9002d6c

Browse files
author
lastpeony
committed
refactor integration test
1 parent 2f5971d commit 9002d6c

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/test/java/io/antmedia/integration/RestServiceV2Test.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javax.servlet.ServletContext;
2929
import javax.ws.rs.core.Context;
3030

31+
import com.google.gson.JsonObject;
3132
import io.antmedia.AppSettings;
3233
import io.antmedia.EncoderSettings;
3334

@@ -2018,11 +2019,11 @@ public void testJwtBlacklist(){
20182019
return;
20192020
}
20202021

2021-
final AppSettings appSettingsModel = ConsoleAppRestServiceTest.callGetAppSettings("LiveApp");
2022+
final AppSettings appSettingsModel = ConsoleAppRestServiceTest.callGetAppSettings("cleanapp");
20222023
appSettingsModel.setJwtStreamSecretKey("testtesttesttesttesttesttesttest");
20232024
appSettingsModel.setJwtBlacklistEnabled(true);
20242025

2025-
result = ConsoleAppRestServiceTest.callSetAppSettings("LiveApp", appSettingsModel);
2026+
result = ConsoleAppRestServiceTest.callSetAppSettings("cleanapp", appSettingsModel);
20262027
assertTrue(result.isSuccess());
20272028

20282029
final String clearJwtBlacklistUrl = ROOT_SERVICE_URL + "/v2/broadcasts/jwt-black-list-clear";
@@ -2045,17 +2046,27 @@ public void testJwtBlacklist(){
20452046
final String validJwt2 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdHJlYW1JZCI6InRlc3RzdHJlYW0iLCJ0eXBlIjoicHVibGlzaCIsImV4cCI6OTg4NzUwNzUwMX0.f4YTJUOmO7yuGpD7W4i_fffv2IVi1JB3mZVxNv8LSdI";
20462047
final String validJwt3 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdHJlYW1JZCI6InRlc3RzdHJlYW0iLCJ0eXBlIjoicHVibGlzaCIsImV4cCI6OTg4NzUwNzUwMn0.bSbIumeAeM-k5zLndtII49z_458L8Lqg3eVweahvpb4";
20472048

2048-
String jwtRequestBody1 = new JSONObject().put("jwt", validJwt1).toString();
2049+
2050+
JsonObject jwtRequest1 = new JsonObject();
2051+
jwtRequest1.addProperty("jwt",validJwt1);
2052+
2053+
JsonObject jwtRequest2 = new JsonObject();
2054+
jwtRequest2.addProperty("jwt",validJwt2);
2055+
2056+
JsonObject jwtRequest3 = new JsonObject();
2057+
jwtRequest3.addProperty("jwt",validJwt3);
2058+
2059+
String jwtRequestBody1 = gson.toJson(jwtRequest1);
20492060
HttpPost addJwtRequest1 = new HttpPost(jwtBlacklistUrl);
20502061
addJwtRequest1.setHeader("Content-Type", "application/json");
20512062
addJwtRequest1.setEntity(new StringEntity(jwtRequestBody1));
20522063

2053-
String jwtRequestBody2 = new JSONObject().put("jwt", validJwt2).toString();
2064+
String jwtRequestBody2 = gson.toJson(jwtRequest2);
20542065
HttpPost addJwtRequest2 = new HttpPost(jwtBlacklistUrl);
20552066
addJwtRequest2.setHeader("Content-Type", "application/json");
20562067
addJwtRequest2.setEntity(new StringEntity(jwtRequestBody2));
20572068

2058-
String jwtRequestBody3 = new JSONObject().put("jwt", validJwt3).toString();
2069+
String jwtRequestBody3 = gson.toJson(jwtRequest3);
20592070
HttpPost addJwtRequest3 = new HttpPost(jwtBlacklistUrl);
20602071
addJwtRequest3.setHeader("Content-Type", "application/json");
20612072
addJwtRequest3.setEntity(new StringEntity(jwtRequestBody3));
@@ -2151,7 +2162,10 @@ public void testJwtBlacklist(){
21512162

21522163

21532164
} catch (Exception e){
2154-
logger.error(e.toString());
2165+
e.printStackTrace();
2166+
2167+
fail(e.getMessage());
2168+
21552169
}
21562170

21572171
}

0 commit comments

Comments
 (0)