Skip to content

Commit fcd3a9b

Browse files
committed
feat: add support for profiler and viewfile tools in ArthasMcpJavaSdkIT
1 parent 53d9ab9 commit fcd3a9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

arthas-mcp-integration-test/src/test/java/com/taobao/arthas/mcp/it/ArthasMcpJavaSdkIT.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class ArthasMcpJavaSdkIT {
6868
"ognl",
6969
"options",
7070
"perfcounter",
71+
"profiler",
7172
"redefine",
7273
"retransform",
7374
"sc",
@@ -81,6 +82,7 @@ class ArthasMcpJavaSdkIT {
8182
"tt",
8283
"vmoption",
8384
"vmtool",
85+
"viewfile",
8486
"watch"
8587
);
8688

@@ -312,6 +314,23 @@ private static Map<String, Object> createArgumentsForTool(String toolName, Envir
312314
return args;
313315
}
314316

317+
if ("profiler".equals(toolName)) {
318+
args.put("action", "actions");
319+
return args;
320+
}
321+
322+
if ("viewfile".equals(toolName)) {
323+
Path outputDir = env.tempHome.resolve("arthas-output");
324+
Files.createDirectories(outputDir);
325+
Path viewFile = outputDir.resolve("viewfile-test.txt");
326+
Files.write(viewFile, "hello viewfile\n".getBytes(StandardCharsets.UTF_8));
327+
328+
args.put("path", "viewfile-test.txt");
329+
args.put("offset", 0L);
330+
args.put("maxBytes", 1024);
331+
return args;
332+
}
333+
315334
if ("dashboard".equals(toolName)) {
316335
args.put("intervalMs", 200);
317336
args.put("numberOfExecutions", 1);

0 commit comments

Comments
 (0)