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

davsclaus 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 71ece84  Fixed tests
71ece84 is described below

commit 71ece845fb051efdf557194e5fdc0106e53f300c
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Mar 28 18:02:57 2020 +0100

    Fixed tests
---
 .../camel/component/spring/batch/SpringBatchComponent.java   |  3 ++-
 .../camel/component/spring/batch/SpringBatchEndpoint.java    |  8 ++++++--
 .../component/spring/batch/SpringBatchEndpointTest.java      | 12 +++++-------
 .../component/spring/batch/SpringBatchIntegrationTest.java   |  2 +-
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git 
a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
 
b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
index f56b380..3238607 100644
--- 
a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
+++ 
b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java
@@ -47,7 +47,8 @@ public class SpringBatchComponent extends DefaultComponent {
     }
 
     @Override
-    protected void doStart() throws Exception {
+    protected void doInit() throws Exception {
+        super.doInit();
         defaultResolvedJobLauncher = 
getCamelContext().getRegistry().lookupByNameAndType(DEFAULT_JOB_LAUNCHER_REF_NAME,
 JobLauncher.class);
         allResolvedJobLaunchers = 
getCamelContext().getRegistry().findByTypeWithName(JobLauncher.class);
     }
diff --git 
a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
 
b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
index 99ad97a..e15553e 100644
--- 
a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
+++ 
b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java
@@ -82,8 +82,12 @@ public class SpringBatchEndpoint extends DefaultEndpoint {
     @Override
     public Consumer createConsumer(Processor processor) throws Exception {
         throw new UnsupportedOperationException("Not supported");
-    }@Override
-    protected void doStart() throws Exception {
+    }
+
+    @Override
+    protected void doInit() throws Exception {
+        super.doInit();
+
         if (jobLauncher == null) {
             jobLauncher = resolveJobLauncher();
         } 
diff --git 
a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
 
b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
index b111d44..1581194 100644
--- 
a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
+++ 
b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.EndpointInject;
+import org.apache.camel.FailedToCreateRouteException;
 import org.apache.camel.FailedToStartRouteException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -42,11 +43,8 @@ import org.springframework.batch.core.JobParameters;
 import org.springframework.batch.core.configuration.JobRegistry;
 import org.springframework.batch.core.launch.JobLauncher;
 
-import static org.mockito.BDDMockito.any;
-import static org.mockito.BDDMockito.eq;
-import static org.mockito.BDDMockito.mock;
-import static org.mockito.BDDMockito.verify;
-import static org.mockito.BDDMockito.when;
+
+import static org.mockito.BDDMockito.*;
 
 @RunWith(MockitoJUnitRunner.class)
 public class SpringBatchEndpointTest extends CamelTestSupport {
@@ -303,7 +301,7 @@ public class SpringBatchEndpointTest extends 
CamelTestSupport {
         assertSame(alternativeJobLauncher, batchEndpointJobLauncher);
     }
 
-    @Test(expected = FailedToStartRouteException.class)
+    @Test(expected = FailedToCreateRouteException.class)
     public void shouldFailWhenThereIsNoJobLauncher() throws Exception {
         // Given
         SimpleRegistry registry = new SimpleRegistry();
@@ -320,7 +318,7 @@ public class SpringBatchEndpointTest extends 
CamelTestSupport {
         camelContext.start();
     }
 
-    @Test(expected = FailedToStartRouteException.class)
+    @Test(expected = FailedToCreateRouteException.class)
     public void shouldFailWhenThereIsMoreThanOneJobLauncher() throws Exception 
{
         // Given
         SimpleRegistry registry = new SimpleRegistry();
diff --git 
a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
 
b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
index 68131b6..79daf1c 100644
--- 
a/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
+++ 
b/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchIntegrationTest.java
@@ -68,7 +68,7 @@ public class SpringBatchIntegrationTest extends 
CamelSpringTestSupport {
     public void testMessageHeader() throws Exception {
         headerEndpoint.expectedHeaderReceived("header", 1);
         
-        template.sendBodyAndHeader(null, "header", "1");
+        template.sendBodyAndHeader("direct:header", null, "header", "1");
         
         headerEndpoint.assertIsSatisfied();
     }

Reply via email to