You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/03/13 17:03:05 UTC

[camel] branch master updated: Fix VM component tests

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 92879be  Fix VM component tests
92879be is described below

commit 92879be2a5bdc23007e8fc5898936d74453b08c7
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Mar 13 18:02:38 2020 +0100

    Fix VM component tests
---
 .../camel/component/vm/AbstractVmTestSupport.java  | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java b/core/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java
index bcf3412..04a3208 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/vm/AbstractVmTestSupport.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.vm;
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.Service;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.support.service.ServiceHelper;
@@ -37,7 +38,7 @@ public abstract class AbstractVmTestSupport extends ContextTestSupport {
         context2 = new DefaultCamelContext();
         template2 = context2.createProducerTemplate();
 
-        ServiceHelper.startService(template2, context2);
+        startServices(template2, context2);
 
         // add routes after CamelContext has been started
         RouteBuilder routeBuilder = createRouteBuilderForSecondContext();
@@ -49,7 +50,7 @@ public abstract class AbstractVmTestSupport extends ContextTestSupport {
     @Override
     @After
     public void tearDown() throws Exception {
-        ServiceHelper.stopService(context2, template2);
+        stopServices(context2, template2);
         VmComponent.ENDPOINTS.clear();
         VmComponent.QUEUES.clear();
         super.tearDown();
@@ -58,4 +59,25 @@ public abstract class AbstractVmTestSupport extends ContextTestSupport {
     protected RouteBuilder createRouteBuilderForSecondContext() throws Exception {
         return null;
     }
+
+    protected void startServices(Object... services) {
+        for (Object o : services) {
+            if (o instanceof Service) {
+                ((Service) o).start();
+            } else if (o instanceof CamelContext) {
+                ((CamelContext) o).start();
+            }
+        }
+    }
+
+    protected void stopServices(Object... services) {
+        for (Object o : services) {
+            if (o instanceof Service) {
+                ((Service) o).stop();
+            } else if (o instanceof CamelContext) {
+                ((CamelContext) o).stop();
+            }
+        }
+    }
+
 }