fix: godzilla manager test failed

This commit is contained in:
ReaJason
2024-11-27 01:17:08 +08:00
parent b78984b858
commit 400a7bfab7
4 changed files with 50 additions and 32 deletions
@@ -3,6 +3,8 @@ package com.reajason.javaweb.godzilla;
import com.reajason.javaweb.util.ClassUtils;
import org.junit.jupiter.api.Test;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
/**
@@ -18,4 +20,12 @@ class GodzillaManagerTest {
System.out.println(o.getClass().getName());
assertNotNull(o);
}
@Test
void testRestorePayload(){
String payload = "k2qs7l3%2F4ZZaGyyrfpBQGg0dXGM%2BFVFxzmCWLnyFEgoPSpSjHre4o1HBHTCFnNDX";
String key = "d8ea7326e6ec5916";
Map<String, String> map = GodzillaManager.restorePayload(key, payload);
assertEquals("test", map.get("methodName"));
}
}
@@ -52,8 +52,8 @@ public class TomcatGodzillaIntegrationTest {
int port = container.getMappedPort(8080);
String url = "http://" + host + ":" + port + "/app";
GodzillaShellConfig shellConfig = GodzillaShellConfig.builder()
.pass("pass").key("key")
.headerName("User-Agent").headerValue("test")
.pass("pass123").key("key123")
.headerName("User-Agent").headerValue("hello_integration_test")
.build();
String jspContent = generateGodzillaFilterJsp(shellConfig);
String filename = "shell.jsp";
@@ -99,7 +99,7 @@ public class TomcatGodzillaIntegrationTest {
}
private void testGodzillaIsOk(String entrypoint, GodzillaShellConfig shellConfig) {
try (GodzillaManager godzillaManager = new GodzillaManager.GodzillaManagerBuilder()
try (GodzillaManager godzillaManager = GodzillaManager.builder()
.entrypoint(entrypoint)
.pass(shellConfig.getPass())
.key(shellConfig.getKey())