Repository: camel Updated Branches: refs/heads/master e0d313fe0 -> bc50b54c4
Polished. This fixes #1001 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bc50b54c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bc50b54c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bc50b54c Branch: refs/heads/master Commit: bc50b54c4b0cc3c871542ad5b2d8485c918e6a91 Parents: e0d313f Author: Claus Ibsen <davscl...@apache.org> Authored: Sat May 28 09:16:26 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat May 28 09:16:26 2016 +0200 ---------------------------------------------------------------------- .../spring/batch/SpringBatchComponent.java | 2 -- .../spring/batch/SpringBatchConstants.java | 29 ++++++++++++++++++++ .../spring/batch/SpringBatchEndpoint.java | 2 +- .../spring/batch/SpringBatchProducer.java | 4 +-- .../spring/batch/SpringBatchEndpointTest.java | 4 +-- 5 files changed, 34 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bc50b54c/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchComponent.java ---------------------------------------------------------------------- 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 ca1bb29..9f7d10c 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 @@ -24,8 +24,6 @@ import org.springframework.batch.core.launch.JobLauncher; public class SpringBatchComponent extends UriEndpointComponent { - public static final String JOB_NAME = "CamelSpringBatch.jobName"; - private static final String DEFAULT_JOB_LAUNCHER_REF_NAME = "jobLauncher"; private JobLauncher jobLauncher; http://git-wip-us.apache.org/repos/asf/camel/blob/bc50b54c/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchConstants.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchConstants.java b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchConstants.java new file mode 100644 index 0000000..9d56385 --- /dev/null +++ b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchConstants.java @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.spring.batch; + +/** + * Constants. + */ +public final class SpringBatchConstants { + + public static final String JOB_NAME = "CamelSpringBatchJobName"; + + private SpringBatchConstants() { + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/bc50b54c/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchEndpoint.java ---------------------------------------------------------------------- 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 8974f67..0bd7dbb 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 @@ -42,7 +42,7 @@ public class SpringBatchEndpoint extends DefaultEndpoint { @Metadata(required = "true") private String jobName; - @UriParam(defaultValue = "false") + @UriParam private Boolean jobFromHeader; /** http://git-wip-us.apache.org/repos/asf/camel/blob/bc50b54c/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java index 3a6fc7b..6869b52 100644 --- a/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java +++ b/components/camel-spring-batch/src/main/java/org/apache/camel/component/spring/batch/SpringBatchProducer.java @@ -48,7 +48,7 @@ public class SpringBatchProducer extends DefaultProducer { public void process(Exchange exchange) throws Exception { JobParameters jobParameters = prepareJobParameters(exchange.getIn().getHeaders()); - String messageJobName = jobParameters.getString(SpringBatchComponent.JOB_NAME); + String messageJobName = jobParameters.getString(SpringBatchConstants.JOB_NAME); Job job2run = this.job; @@ -58,7 +58,7 @@ public class SpringBatchProducer extends DefaultProducer { if (job2run == null) { exchange.setException(new CamelExchangeException("jobName was not specified in the endpoint construction " - + " and header " + SpringBatchComponent.JOB_NAME + " could not be found", exchange)); + + " and header " + SpringBatchConstants.JOB_NAME + " could not be found", exchange)); return; } http://git-wip-us.apache.org/repos/asf/camel/blob/bc50b54c/components/camel-spring-batch/src/test/java/org/apache/camel/component/spring/batch/SpringBatchEndpointTest.java ---------------------------------------------------------------------- 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 4fa6007..c6259b3 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 @@ -113,7 +113,7 @@ public class SpringBatchEndpointTest extends CamelTestSupport { errorEndpoint.expectedMessageCount(1); //dynamic job should fail as header is present but the job does not exists - header(SpringBatchComponent.JOB_NAME).append("thisJobDoesNotExsistAtAll" + Date.from(Instant.now())); + header(SpringBatchConstants.JOB_NAME).append("thisJobDoesNotExsistAtAll" + Date.from(Instant.now())); sendBody("direct:dyanmic", "Start the job, please."); mockEndpoint.assertIsSatisfied(); @@ -127,7 +127,7 @@ public class SpringBatchEndpointTest extends CamelTestSupport { errorEndpoint.expectedMessageCount(0); final Map<String, Object> headers = new HashMap<>(); - headers.put(SpringBatchComponent.JOB_NAME, "dynamicMockjob"); + headers.put(SpringBatchConstants.JOB_NAME, "dynamicMockjob"); sendBody("direct:dynamic", "Start the job, please.", headers);