Skip to content

Commit 4061f61

Browse files
gnodetclaude
andcommitted
Migrate test classes from createService() to createSingletonService()
Switch 39 test files from using createService() (non-singleton) to createSingletonService() (singleton) to allow sharing a single container instance per JVM. This reduces Docker overhead and enables safe within-JVM parallel test execution. Migrated base/support classes (covering all subclasses): - HazelcastAggregationRepositoryCamelTestSupport - MinioIntegrationTestSupport, SolrTestSupport - HashicorpVaultBase, PubsubTestSupport, XmppBaseIT - LdifTestSupport, DoclingITestSupport - IggyTestBase, TensorFlowServingITSupport, KServeITSupport Skipped (not safe for singleton): - ZooKeeper: cross-module container name collision - Consul: ConsulHealthIT creates own container in same module - NATS: NatsAuth*ITSupport creates auth-variant containers - Mosquitto/MQTT5: reconnect stop/start test - RabbitMQ: conflicting exchange/queue declarations - LRA: shared coordinator causes test transaction interference Also added createSingletonService() to the spring-rabbitmq RabbitMQServiceFactory wrapper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 02f64f5 commit 4061f61

File tree

39 files changed

+42
-38
lines changed

39 files changed

+42
-38
lines changed

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 {

components/camel-azure/camel-azure-storage-blob/src/test/java/org/apache/camel/component/azure/storage/blob/integration/Base.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class Base extends CamelTestSupport {
4545
static {
4646
initCredentials();
4747

48-
service = AzureStorageBlobServiceFactory.createService();
48+
service = AzureStorageBlobServiceFactory.createSingletonService();
4949
}
5050

5151
/*

0 commit comments

Comments
 (0)