Skip to content

Commit dffb080

Browse files
committed
add mcps to tests
1 parent bbf6350 commit dffb080

File tree

2 files changed

+779
-2
lines changed

2 files changed

+779
-2
lines changed

apitester4/src/main/java/uk/ac/ebi/ols/apitester/App.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ public static void main( String[] args ) throws MalformedURLException, IOExcepti
4242
optDeep.setRequired(false);
4343
options.addOption(optDeep);
4444

45+
Option optMcp = new Option(null, "mcp", false, "Test MCP (Model Context Protocol) functionality");
46+
optMcp.setRequired(false);
47+
options.addOption(optMcp);
48+
49+
Option optMcpOnly = new Option(null, "mcpOnly", false, "Only test MCP functionality (skip REST API tests)");
50+
optMcpOnly.setRequired(false);
51+
options.addOption(optMcpOnly);
52+
4553
CommandLineParser parser = new DefaultParser();
4654
HelpFormatter formatter = new HelpFormatter();
4755
CommandLine cmd = null;
@@ -61,10 +69,12 @@ public static void main( String[] args ) throws MalformedURLException, IOExcepti
6169
String compareDir = cmd.getOptionValue("compareDir");
6270
boolean deep = cmd.hasOption("deep");
6371
String ontology = cmd.getOptionValue("ontology");
72+
boolean mcp = cmd.hasOption("mcp");
73+
boolean mcpOnly = cmd.hasOption("mcpOnly");
6474

6575
boolean success = true;
6676

67-
if (url != null) {
77+
if (url != null && !mcpOnly) {
6878
if (!new Ols4ApiTester(url, outDir, deep, ontology).test()) {
6979
System.out.println("Ols4ApiTester.test() reported failure");
7080
success = false;
@@ -73,7 +83,18 @@ public static void main( String[] args ) throws MalformedURLException, IOExcepti
7383
}
7484
}
7585

76-
if(compareUrl != null) {
86+
// Test MCP functionality if --mcp or --mcpOnly is specified
87+
if (url != null && (mcp || mcpOnly)) {
88+
System.out.println("Starting MCP tests...");
89+
if (!new McpTester(url, outDir).test()) {
90+
System.out.println("McpTester.test() reported failure");
91+
success = false;
92+
} else {
93+
System.out.println("McpTester.test() reported success");
94+
}
95+
}
96+
97+
if(compareUrl != null && !mcpOnly) {
7798
if(!new Ols4ApiTester(compareUrl, compareDir, deep, ontology).test()) {
7899
System.out.println("Ols4ApiTester.test() reported failure for compareUrl");
79100
success = false;
@@ -82,6 +103,17 @@ public static void main( String[] args ) throws MalformedURLException, IOExcepti
82103
}
83104
}
84105

106+
// Test MCP for compareUrl if requested
107+
if(compareUrl != null && (mcp || mcpOnly)) {
108+
System.out.println("Starting MCP tests for compareUrl...");
109+
if (!new McpTester(compareUrl, compareDir).test()) {
110+
System.out.println("McpTester.test() reported failure for compareUrl");
111+
success = false;
112+
} else {
113+
System.out.println("McpTester.test() reported success for compareUrl");
114+
}
115+
}
116+
85117
if(compareDir != null) {
86118
if(!new RecursiveJsonDiff(outDir, compareDir).diff()) {
87119
System.out.println("RecursiveJsonDiff.diff() reported failure");

0 commit comments

Comments
 (0)