fix checkstyle

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Christian Tzolov
2025-05-16 15:14:52 +02:00
committed by Mark Pollack
parent 327cf40e97
commit 4bde57790d
2 changed files with 88 additions and 94 deletions

View File

@@ -134,52 +134,8 @@ public class McpServerProperties {
private Capabilities capabilities = new Capabilities(); private Capabilities capabilities = new Capabilities();
public static class Capabilities {
private boolean resource = true;
private boolean tool = true;
private boolean prompt = true;
private boolean completion = true;
public boolean isResource() {
return resource;
}
public void setResource(boolean resource) {
this.resource = resource;
}
public boolean isTool() {
return tool;
}
public void setTool(boolean tool) {
this.tool = tool;
}
public boolean isPrompt() {
return prompt;
}
public void setPrompt(boolean prompt) {
this.prompt = prompt;
}
public boolean isCompletion() {
return completion;
}
public void setCompletion(boolean completion) {
this.completion = completion;
}
}
public Capabilities getCapabilities() { public Capabilities getCapabilities() {
return capabilities; return this.capabilities;
} }
/** /**
@@ -310,4 +266,48 @@ public class McpServerProperties {
return this.toolResponseMimeType; return this.toolResponseMimeType;
} }
public static class Capabilities {
private boolean resource = true;
private boolean tool = true;
private boolean prompt = true;
private boolean completion = true;
public boolean isResource() {
return this.resource;
}
public void setResource(boolean resource) {
this.resource = resource;
}
public boolean isTool() {
return this.tool;
}
public void setTool(boolean tool) {
this.tool = tool;
}
public boolean isPrompt() {
return this.prompt;
}
public void setPrompt(boolean prompt) {
this.prompt = prompt;
}
public boolean isCompletion() {
return this.completion;
}
public void setCompletion(boolean completion) {
this.completion = completion;
}
}
} }

View File

@@ -241,42 +241,6 @@ public class McpServerAutoConfigurationIT {
}); });
} }
@Configuration
static class TestResourceConfiguration {
@Bean
List<SyncResourceSpecification> testResources() {
return List.of();
}
}
@Configuration
static class TestPromptConfiguration {
@Bean
List<SyncPromptSpecification> testPrompts() {
return List.of();
}
}
@Configuration
static class CustomCapabilitiesConfiguration {
@Bean
McpSchema.ServerCapabilities.Builder customCapabilitiesBuilder() {
return new CustomCapabilitiesBuilder();
}
}
static class CustomCapabilitiesBuilder extends McpSchema.ServerCapabilities.Builder {
// Custom implementation for testing
}
@Test @Test
void capabilitiesConfiguration() { void capabilitiesConfiguration() {
this.contextRunner.withPropertyValues("spring.ai.mcp.server.capabilities.tool=false", this.contextRunner.withPropertyValues("spring.ai.mcp.server.capabilities.tool=false",
@@ -329,9 +293,44 @@ public class McpServerAutoConfigurationIT {
@Test @Test
void toolCallbackProviderConfiguration() { void toolCallbackProviderConfiguration() {
this.contextRunner.withUserConfiguration(TestToolCallbackProviderConfiguration.class).run(context -> { this.contextRunner.withUserConfiguration(TestToolCallbackProviderConfiguration.class)
assertThat(context).hasSingleBean(ToolCallbackProvider.class); .run(context -> assertThat(context).hasSingleBean(ToolCallbackProvider.class));
}); }
@Configuration
static class TestResourceConfiguration {
@Bean
List<SyncResourceSpecification> testResources() {
return List.of();
}
}
@Configuration
static class TestPromptConfiguration {
@Bean
List<SyncPromptSpecification> testPrompts() {
return List.of();
}
}
@Configuration
static class CustomCapabilitiesConfiguration {
@Bean
McpSchema.ServerCapabilities.Builder customCapabilitiesBuilder() {
return new CustomCapabilitiesBuilder();
}
}
static class CustomCapabilitiesBuilder extends McpSchema.ServerCapabilities.Builder {
// Custom implementation for testing
} }
@Configuration @Configuration
@@ -379,11 +378,8 @@ public class McpServerAutoConfigurationIT {
List<SyncCompletionSpecification> testCompletions() { List<SyncCompletionSpecification> testCompletions() {
BiFunction<McpSyncServerExchange, McpSchema.CompleteRequest, McpSchema.CompleteResult> completionHandler = ( BiFunction<McpSyncServerExchange, McpSchema.CompleteRequest, McpSchema.CompleteResult> completionHandler = (
exchange, request) -> { exchange, request) -> new McpSchema.CompleteResult(
// Test implementation new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false));
return new McpSchema.CompleteResult(
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false));
};
return List.of(new McpServerFeatures.SyncCompletionSpecification( return List.of(new McpServerFeatures.SyncCompletionSpecification(
new McpSchema.PromptReference("ref/prompt", "code_review"), completionHandler)); new McpSchema.PromptReference("ref/prompt", "code_review"), completionHandler));
@@ -397,11 +393,9 @@ public class McpServerAutoConfigurationIT {
@Bean @Bean
List<AsyncCompletionSpecification> testAsyncCompletions() { List<AsyncCompletionSpecification> testAsyncCompletions() {
BiFunction<McpAsyncServerExchange, McpSchema.CompleteRequest, Mono<McpSchema.CompleteResult>> completionHandler = ( BiFunction<McpAsyncServerExchange, McpSchema.CompleteRequest, Mono<McpSchema.CompleteResult>> completionHandler = (
exchange, request) -> { exchange, request) -> Mono.just(new McpSchema.CompleteResult(
// Test implementation new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false)));
return Mono.just(new McpSchema.CompleteResult(
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false)));
};
return List.of(new McpServerFeatures.AsyncCompletionSpecification( return List.of(new McpServerFeatures.AsyncCompletionSpecification(
new McpSchema.PromptReference("ref/prompt", "code_review"), completionHandler)); new McpSchema.PromptReference("ref/prompt", "code_review"), completionHandler));
} }