Skip to content

Commit 4bde577

Browse files
tzolovmarkpollack
authored andcommitted
fix checkstyle
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
1 parent 327cf40 commit 4bde577

File tree

2 files changed

+88
-94
lines changed

2 files changed

+88
-94
lines changed

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerProperties.java

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -134,52 +134,8 @@ public class McpServerProperties {
134134

135135
private Capabilities capabilities = new Capabilities();
136136

137-
public static class Capabilities {
138-
139-
private boolean resource = true;
140-
141-
private boolean tool = true;
142-
143-
private boolean prompt = true;
144-
145-
private boolean completion = true;
146-
147-
public boolean isResource() {
148-
return resource;
149-
}
150-
151-
public void setResource(boolean resource) {
152-
this.resource = resource;
153-
}
154-
155-
public boolean isTool() {
156-
return tool;
157-
}
158-
159-
public void setTool(boolean tool) {
160-
this.tool = tool;
161-
}
162-
163-
public boolean isPrompt() {
164-
return prompt;
165-
}
166-
167-
public void setPrompt(boolean prompt) {
168-
this.prompt = prompt;
169-
}
170-
171-
public boolean isCompletion() {
172-
return completion;
173-
}
174-
175-
public void setCompletion(boolean completion) {
176-
this.completion = completion;
177-
}
178-
179-
}
180-
181137
public Capabilities getCapabilities() {
182-
return capabilities;
138+
return this.capabilities;
183139
}
184140

185141
/**
@@ -310,4 +266,48 @@ public Map<String, String> getToolResponseMimeType() {
310266
return this.toolResponseMimeType;
311267
}
312268

269+
public static class Capabilities {
270+
271+
private boolean resource = true;
272+
273+
private boolean tool = true;
274+
275+
private boolean prompt = true;
276+
277+
private boolean completion = true;
278+
279+
public boolean isResource() {
280+
return this.resource;
281+
}
282+
283+
public void setResource(boolean resource) {
284+
this.resource = resource;
285+
}
286+
287+
public boolean isTool() {
288+
return this.tool;
289+
}
290+
291+
public void setTool(boolean tool) {
292+
this.tool = tool;
293+
}
294+
295+
public boolean isPrompt() {
296+
return this.prompt;
297+
}
298+
299+
public void setPrompt(boolean prompt) {
300+
this.prompt = prompt;
301+
}
302+
303+
public boolean isCompletion() {
304+
return this.completion;
305+
}
306+
307+
public void setCompletion(boolean completion) {
308+
this.completion = completion;
309+
}
310+
311+
}
312+
313313
}

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/test/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfigurationIT.java

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -241,42 +241,6 @@ void asyncRootsChangeHandlerConfiguration() {
241241
});
242242
}
243243

244-
@Configuration
245-
static class TestResourceConfiguration {
246-
247-
@Bean
248-
List<SyncResourceSpecification> testResources() {
249-
return List.of();
250-
}
251-
252-
}
253-
254-
@Configuration
255-
static class TestPromptConfiguration {
256-
257-
@Bean
258-
List<SyncPromptSpecification> testPrompts() {
259-
return List.of();
260-
}
261-
262-
}
263-
264-
@Configuration
265-
static class CustomCapabilitiesConfiguration {
266-
267-
@Bean
268-
McpSchema.ServerCapabilities.Builder customCapabilitiesBuilder() {
269-
return new CustomCapabilitiesBuilder();
270-
}
271-
272-
}
273-
274-
static class CustomCapabilitiesBuilder extends McpSchema.ServerCapabilities.Builder {
275-
276-
// Custom implementation for testing
277-
278-
}
279-
280244
@Test
281245
void capabilitiesConfiguration() {
282246
this.contextRunner.withPropertyValues("spring.ai.mcp.server.capabilities.tool=false",
@@ -329,9 +293,44 @@ void asyncCompletionSpecificationConfiguration() {
329293

330294
@Test
331295
void toolCallbackProviderConfiguration() {
332-
this.contextRunner.withUserConfiguration(TestToolCallbackProviderConfiguration.class).run(context -> {
333-
assertThat(context).hasSingleBean(ToolCallbackProvider.class);
334-
});
296+
this.contextRunner.withUserConfiguration(TestToolCallbackProviderConfiguration.class)
297+
.run(context -> assertThat(context).hasSingleBean(ToolCallbackProvider.class));
298+
}
299+
300+
@Configuration
301+
static class TestResourceConfiguration {
302+
303+
@Bean
304+
List<SyncResourceSpecification> testResources() {
305+
return List.of();
306+
}
307+
308+
}
309+
310+
@Configuration
311+
static class TestPromptConfiguration {
312+
313+
@Bean
314+
List<SyncPromptSpecification> testPrompts() {
315+
return List.of();
316+
}
317+
318+
}
319+
320+
@Configuration
321+
static class CustomCapabilitiesConfiguration {
322+
323+
@Bean
324+
McpSchema.ServerCapabilities.Builder customCapabilitiesBuilder() {
325+
return new CustomCapabilitiesBuilder();
326+
}
327+
328+
}
329+
330+
static class CustomCapabilitiesBuilder extends McpSchema.ServerCapabilities.Builder {
331+
332+
// Custom implementation for testing
333+
335334
}
336335

337336
@Configuration
@@ -379,11 +378,8 @@ static class TestCompletionConfiguration {
379378
List<SyncCompletionSpecification> testCompletions() {
380379

381380
BiFunction<McpSyncServerExchange, McpSchema.CompleteRequest, McpSchema.CompleteResult> completionHandler = (
382-
exchange, request) -> {
383-
// Test implementation
384-
return new McpSchema.CompleteResult(
385-
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false));
386-
};
381+
exchange, request) -> new McpSchema.CompleteResult(
382+
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false));
387383

388384
return List.of(new McpServerFeatures.SyncCompletionSpecification(
389385
new McpSchema.PromptReference("ref/prompt", "code_review"), completionHandler));
@@ -397,11 +393,9 @@ static class TestAsyncCompletionConfiguration {
397393
@Bean
398394
List<AsyncCompletionSpecification> testAsyncCompletions() {
399395
BiFunction<McpAsyncServerExchange, McpSchema.CompleteRequest, Mono<McpSchema.CompleteResult>> completionHandler = (
400-
exchange, request) -> {
401-
// Test implementation
402-
return Mono.just(new McpSchema.CompleteResult(
403-
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false)));
404-
};
396+
exchange, request) -> Mono.just(new McpSchema.CompleteResult(
397+
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false)));
398+
405399
return List.of(new McpServerFeatures.AsyncCompletionSpecification(
406400
new McpSchema.PromptReference("ref/prompt", "code_review"), completionHandler));
407401
}

0 commit comments

Comments
 (0)