Skip to content

Commit d68f67d

Browse files
gnodetclaude
andcommitted
Migrate all test classes from createService() to createSingletonService()
Migrate every test class that used createService() to use createSingletonService(), so all tests share a single container instance per JVM. This reduces Docker overhead and prepares for safe within-JVM parallel test execution. Tests that required isolation fixes to work with shared containers: - Google PubSub: catch AlreadyExistsException in topic/subscription setup - Hashicorp Vault: use per-class secret paths to prevent version collisions - Spring-RabbitMQ: use uniqueName() helper for exchange/queue names - LRA: delta-tolerant assertions for shared coordinator state - Consul: remove manual initialization (singleton handles lifecycle) 86 test files migrated across 30+ components, eliminating all remaining createService() usage in test code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0f8a879 commit d68f67d

File tree

86 files changed

+186
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+186
-169
lines changed

components/camel-ai/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class ChatScriptComponentIT extends CamelTestSupport {
3737
private static final Logger LOG = LoggerFactory.getLogger(ChatScriptComponentIT.class);
3838

3939
@RegisterExtension
40-
public static ChatScriptService service = ChatScriptServiceFactory.createService();
40+
public static ChatScriptService service = ChatScriptServiceFactory.createSingletonService();
4141

4242
@Test
4343
public void testChatScript() throws Exception {

components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/DoclingITestSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public abstract class DoclingITestSupport extends CamelTestSupport {
3131
protected static final Logger LOG = LoggerFactory.getLogger(DoclingITestSupport.class);
3232

3333
@RegisterExtension
34-
static DoclingService doclingService = DoclingServiceFactory.createService();
34+
static DoclingService doclingService = DoclingServiceFactory.createSingletonService();
3535

3636
@Override
3737
protected CamelContext createCamelContext() throws Exception {

components/camel-ai/camel-docling/src/test/java/org/apache/camel/component/docling/integration/OcrExtractionIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class OcrExtractionIT extends CamelTestSupport {
5858
private static final String TEST_TEXT_LINE3 = "OCR Test Document";
5959

6060
@RegisterExtension
61-
static DoclingService doclingService = DoclingServiceFactory.createService();
61+
static DoclingService doclingService = DoclingServiceFactory.createSingletonService();
6262

6363
@Override
6464
protected CamelContext createCamelContext() throws Exception {

components/camel-ai/camel-kserve/src/test/java/org/apache/camel/component/kserve/it/KServeITSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class KServeITSupport extends CamelTestSupport {
2727

2828
@RegisterExtension
29-
static TritonService service = TritonServiceFactory.createService();
29+
static TritonService service = TritonServiceFactory.createSingletonService();
3030

3131
@Override
3232
protected CamelContext createCamelContext() throws Exception {

components/camel-ai/camel-langchain4j-agent/src/test/java/org/apache/camel/component/langchain4j/agent/integration/LangChain4jAgentMcpAndCamelToolsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class LangChain4jAgentMcpAndCamelToolsIT extends CamelTestSupport {
7575
static OllamaService OLLAMA = OllamaServiceFactory.createSingletonService();
7676

7777
@RegisterExtension
78-
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService();
78+
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService();
7979

8080
@Override
8181
protected void setupResources() throws Exception {

components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpAdvancedIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class OpenAIMcpAdvancedIT extends OpenAITestSupport {
5151
private static final String MCP_PROTOCOL_VERSIONS = "2024-11-05,2025-03-26,2025-06-18";
5252

5353
@RegisterExtension
54-
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService();
54+
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService();
5555

5656
private String returnDirectEndpointUri;
5757

components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpConversationStoreIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class OpenAIMcpConversationStoreIT extends OpenAITestSupport {
5757
private final Map<String, List<?>> conversationStore = new ConcurrentHashMap<>();
5858

5959
@RegisterExtension
60-
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService();
60+
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService();
6161

6262
@Override
6363
protected RouteBuilder createRouteBuilder() {

components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpManualToolLoopIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class OpenAIMcpManualToolLoopIT extends OpenAITestSupport {
5151
private static final String MCP_PROTOCOL_VERSIONS = "2024-11-05,2025-03-26,2025-06-18";
5252

5353
@RegisterExtension
54-
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService();
54+
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService();
5555

5656
@Override
5757
protected RouteBuilder createRouteBuilder() {

components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/integration/OpenAIMcpToolsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
public class OpenAIMcpToolsIT extends OpenAITestSupport {
4444

4545
@RegisterExtension
46-
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createService();
46+
static McpEverythingService MCP_EVERYTHING = McpEverythingServiceFactory.createSingletonService();
4747

4848
@Override
4949
protected RouteBuilder createRouteBuilder() {

components/camel-ai/camel-tensorflow-serving/src/test/java/org/apache/camel/component/torchserve/it/TensorFlowServingITSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class TensorFlowServingITSupport extends CamelTestSupport {
2727

2828
@RegisterExtension
29-
static TensorFlowServingService service = TensorFlowServingServiceFactory.createService();
29+
static TensorFlowServingService service = TensorFlowServingServiceFactory.createSingletonService();
3030

3131
@Override
3232
protected CamelContext createCamelContext() throws Exception {

0 commit comments

Comments
 (0)