camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [3/3] camel git commit: CAMEL-10167: Camel-Github: Use constants instead of String for headers and registry names
Date Thu, 21 Jul 2016 09:32:11 GMT
CAMEL-10167: Camel-Github: Use constants instead of String for headers and registry names


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9307d0ce
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9307d0ce
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9307d0ce

Branch: refs/heads/master
Commit: 9307d0ce5f3b7b4bc287e64b4f51a3fb3b2c8a44
Parents: a1d95a8
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Thu Jul 21 11:29:48 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Thu Jul 21 11:31:05 2016 +0200

----------------------------------------------------------------------
 .../camel/component/github/GitHubConstants.java | 38 ++++++++++++++++++++
 .../github/consumer/AbstractGitHubConsumer.java |  3 +-
 .../github/consumer/CommitConsumer.java         |  3 +-
 .../consumer/PullRequestCommentConsumer.java    |  7 ++--
 .../github/consumer/PullRequestConsumer.java    |  7 ++--
 .../github/producer/AbstractGitHubProducer.java |  3 +-
 .../producer/ClosePullRequestProducer.java      |  5 +--
 .../github/producer/CreateIssueProducer.java    |  5 +--
 .../github/producer/GetCommitFileProducer.java  |  3 +-
 .../producer/PullRequestCommentProducer.java    |  7 ++--
 .../producer/PullRequestFilesProducer.java      |  5 +--
 .../producer/PullRequestStateProducer.java      |  5 +--
 .../github/GitHubComponentTestBase.java         |  8 ++---
 .../producer/ClosePullRequestProducerTest.java  |  3 +-
 .../producer/CreateIssueProducerTest.java       |  7 ++--
 .../PullRequestCommentProducerTest.java         |  3 +-
 .../producer/PullRequestFilesProducerTest.java  |  3 +-
 .../producer/PullRequestStateProducerTest.java  |  3 +-
 18 files changed, 86 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
new file mode 100644
index 0000000..5d5dbf2
--- /dev/null
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
@@ -0,0 +1,38 @@
+/**
+ * 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.github;
+
+public interface GitHubConstants {
+
+    String GITHUB_REPOSITORY_SERVICE = "githubRepositoryService";
+
+    String GITHUB_COMMIT_SERVICE = "githubCommitService";
+    
+    String GITHUB_DATA_SERVICE = "githubDataService";
+
+    String GITHUB_PULL_REQUEST_SERVICE = "githubPullRequestService";
+    
+    String GITHUB_ISSUE_SERVICE = "githbIssueService";
+    
+    String GITHUB_PULLREQUEST = "GitHubPullRequest";
+    
+    String GITHUB_INRESPONSETO = "GitHubInResponseTo";
+    
+    String GITHUB_PULLREQUEST_HEAD_COMMIT_SHA = "GitHubPullRequestHeadCommitSHA";
+    
+    String GITHUB_ISSUE_TITLE = "GitHubIssueTitle";
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
index ba0d96c..2902260 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.consumer;
 
 import org.apache.camel.Processor;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.impl.ScheduledPollConsumer;
 import org.apache.camel.spi.Registry;
@@ -40,7 +41,7 @@ public abstract class AbstractGitHubConsumer extends ScheduledPollConsumer
{
         this.endpoint = endpoint;
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubRepositoryService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_REPOSITORY_SERVICE);
         if (service != null) {
             LOG.debug("Using RepositoryService found in registry " + service.getClass().getCanonicalName());
             repositoryService = (RepositoryService) service;

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
index 5d4bdc0..0b04566 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java
@@ -22,6 +22,7 @@ import java.util.Stack;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.RepositoryCommit;
@@ -40,7 +41,7 @@ public class CommitConsumer extends AbstractGitHubConsumer {
         super(endpoint, processor);
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubCommitService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_COMMIT_SERVICE);
         if (service != null) {
             LOG.debug("Using CommitService found in registry " + service.getClass().getCanonicalName());
             commitService = (CommitService) service;

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumer.java
index f6dc9ec..9703d54 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumer.java
@@ -24,6 +24,7 @@ import java.util.Stack;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.Comment;
@@ -47,7 +48,7 @@ public class PullRequestCommentConsumer extends AbstractGitHubConsumer {
         super(endpoint, processor);
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubPullRequestService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
         if (service != null) {
             LOG.debug("Using PullRequestService found in registry " + service.getClass().getCanonicalName());
             pullRequestService = (PullRequestService) service;
@@ -56,7 +57,7 @@ public class PullRequestCommentConsumer extends AbstractGitHubConsumer {
         }
         initService(pullRequestService);
 
-        service = registry.lookupByName("githbIssueService");
+        service = registry.lookupByName(GitHubConstants.GITHUB_ISSUE_SERVICE);
         if (service != null) {
             issueService = (IssueService) service;
         } else {
@@ -113,7 +114,7 @@ public class PullRequestCommentConsumer extends AbstractGitHubConsumer
{
             e.getIn().setBody(newComment);
             
             // Required by the producers.  Set it here for convenience.
-            e.getIn().setHeader("GitHubPullRequest", commentIdToPullRequest.get(newComment.getId()));
+            e.getIn().setHeader(GitHubConstants.GITHUB_PULLREQUEST, commentIdToPullRequest.get(newComment.getId()));
             
             getProcessor().process(e);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestConsumer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestConsumer.java
index 32d1577..164acb5 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestConsumer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/PullRequestConsumer.java
@@ -21,6 +21,7 @@ import java.util.Stack;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.PullRequest;
@@ -39,7 +40,7 @@ public class PullRequestConsumer extends AbstractGitHubConsumer {
         super(endpoint, processor);
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubPullRequestService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
         if (service != null) {
             LOG.debug("Using PullRequestService found in registry " + service.getClass().getCanonicalName());
             pullRequestService = (PullRequestService) service;
@@ -80,9 +81,9 @@ public class PullRequestConsumer extends AbstractGitHubConsumer {
             e.getIn().setBody(newPullRequest);
 
             // Required by the producers.  Set it here for convenience.
-            e.getIn().setHeader("GitHubPullRequest", newPullRequest.getNumber());
+            e.getIn().setHeader(GitHubConstants.GITHUB_PULLREQUEST, newPullRequest.getNumber());
             if (newPullRequest.getHead() != null) {
-                e.getIn().setHeader("GitHubPullRequestHeadCommitSHA", newPullRequest.getHead().getSha());
+                e.getIn().setHeader(GitHubConstants.GITHUB_PULLREQUEST_HEAD_COMMIT_SHA, newPullRequest.getHead().getSha());
             }
 
             getProcessor().process(e);

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
index 36894c3..7f15866 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.spi.Registry;
@@ -37,7 +38,7 @@ public abstract class AbstractGitHubProducer extends DefaultProducer {
         this.endpoint = endpoint;
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubRepositoryService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_REPOSITORY_SERVICE);
         if (service != null) {
             repositoryService = (RepositoryService) service;
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ClosePullRequestProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ClosePullRequestProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ClosePullRequestProducer.java
index a09517b..b887b66 100755
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ClosePullRequestProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/ClosePullRequestProducer.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.github.producer;
 import java.util.Calendar;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.PullRequest;
@@ -36,7 +37,7 @@ public class ClosePullRequestProducer extends AbstractGitHubProducer {
         super(endpoint);
         
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubPullRequestService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
         if (service != null) {
             pullRequestService = (PullRequestService) service;
         } else {
@@ -46,7 +47,7 @@ public class ClosePullRequestProducer extends AbstractGitHubProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        Integer pullRequestNumber = exchange.getIn().getHeader("GitHubPullRequest", Integer.class);
+        Integer pullRequestNumber = exchange.getIn().getHeader(GitHubConstants.GITHUB_PULLREQUEST,
Integer.class);
         PullRequest pullRequest = pullRequestService.getPullRequest(getRepository(), pullRequestNumber);
         pullRequest.setState("closed");
         pullRequest.setClosedAt(Calendar.getInstance().getTime());

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/CreateIssueProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/CreateIssueProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/CreateIssueProducer.java
index 7d7aef4..9fcd0e7 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/CreateIssueProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/CreateIssueProducer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.util.ObjectHelper;
@@ -35,7 +36,7 @@ public class CreateIssueProducer extends AbstractGitHubProducer {
         super(endpoint);
         
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubIssuesService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_ISSUE_SERVICE);
         if (service != null) {
             issueService = (IssueService) service;
         } else {
@@ -46,7 +47,7 @@ public class CreateIssueProducer extends AbstractGitHubProducer {
 
     public void process(Exchange exchange) throws Exception {
         Issue issue = new Issue();
-        String issueTitle = exchange.getIn().getHeader("GitHubIssueTitle", String.class);
+        String issueTitle = exchange.getIn().getHeader(GitHubConstants.GITHUB_ISSUE_TITLE,
String.class);
         if (ObjectHelper.isEmpty(issueTitle)) {
             throw new IllegalArgumentException("Issue Title must be specified to create an
issue");
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/GetCommitFileProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/GetCommitFileProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/GetCommitFileProducer.java
index 04dd6bd..88ac7de 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/GetCommitFileProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/GetCommitFileProducer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.apache.commons.codec.binary.Base64;
@@ -41,7 +42,7 @@ public class GetCommitFileProducer extends AbstractGitHubProducer {
         super(endpoint);
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubDataService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_DATA_SERVICE);
         if (service != null) {
             LOG.debug("Using DataService found in registry " + service.getClass().getCanonicalName());
             dataService = (DataService) service;

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestCommentProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestCommentProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestCommentProducer.java
index 03bd542..dd2de8a 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestCommentProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestCommentProducer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.Comment;
@@ -44,7 +45,7 @@ public class PullRequestCommentProducer extends AbstractGitHubProducer {
         super(endpoint);
         
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubPullRequestService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
         if (service != null) {
             LOG.debug("Using PullRequestService found in registry " + service.getClass().getCanonicalName());
             pullRequestService = (PullRequestService) service;
@@ -63,8 +64,8 @@ public class PullRequestCommentProducer extends AbstractGitHubProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        Integer pullRequestNumber = exchange.getIn().getHeader("GitHubPullRequest", Integer.class);
-        Integer inResponseTo = exchange.getIn().getHeader("GitHubInResponseTo", Integer.class);
+        Integer pullRequestNumber = exchange.getIn().getHeader(GitHubConstants.GITHUB_PULLREQUEST,
Integer.class);
+        Integer inResponseTo = exchange.getIn().getHeader(GitHubConstants.GITHUB_INRESPONSETO,
Integer.class);
         String text = exchange.getIn().getBody(String.class);
         
         Comment response;

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestFilesProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestFilesProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestFilesProducer.java
index a44a0c5..79e3367 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestFilesProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestFilesProducer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.CommitFile;
@@ -38,7 +39,7 @@ public class PullRequestFilesProducer extends AbstractGitHubProducer {
         super(endpoint);
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubPullRequestService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
         if (service != null) {
             LOG.debug("Using PullRequestService found in registry " + service.getClass().getCanonicalName());
             pullRequestService = (PullRequestService) service;
@@ -49,7 +50,7 @@ public class PullRequestFilesProducer extends AbstractGitHubProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        Integer pullRequestNumber = exchange.getIn().getHeader("GitHubPullRequest", Integer.class);
+        Integer pullRequestNumber = exchange.getIn().getHeader(GitHubConstants.GITHUB_PULLREQUEST,
Integer.class);
 
         java.util.List<CommitFile> response = pullRequestService.getFiles(getRepository(),
pullRequestNumber);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestStateProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestStateProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestStateProducer.java
index ab84fd1..2209fae 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestStateProducer.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/PullRequestStateProducer.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.github.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.github.GitHubConstants;
 import org.apache.camel.component.github.GitHubEndpoint;
 import org.apache.camel.spi.Registry;
 import org.eclipse.egit.github.core.CommitStatus;
@@ -42,7 +43,7 @@ public class PullRequestStateProducer extends AbstractGitHubProducer {
         super(endpoint);
 
         Registry registry = endpoint.getCamelContext().getRegistry();
-        Object service = registry.lookupByName("githubCommitService");
+        Object service = registry.lookupByName(GitHubConstants.GITHUB_COMMIT_SERVICE);
         if (service != null) {
             LOG.debug("Using CommitService found in registry " + service.getClass().getCanonicalName());
             commitService = (CommitService) service;
@@ -56,7 +57,7 @@ public class PullRequestStateProducer extends AbstractGitHubProducer {
     }
 
     public void process(Exchange exchange) throws Exception {
-        String pullRequestNumberSHA = exchange.getIn().getHeader("GitHubPullRequestHeadCommitSHA",
String.class);
+        String pullRequestNumberSHA = exchange.getIn().getHeader(GitHubConstants.GITHUB_PULLREQUEST_HEAD_COMMIT_SHA,
String.class);
         String text = exchange.getIn().getBody(String.class);
 
         CommitStatus status = new CommitStatus();

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
index 39a16de..fbaad18 100644
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
@@ -40,16 +40,16 @@ public abstract class GitHubComponentTestBase extends CamelTestSupport
{
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry registry = super.createRegistry();
         commitService = new MockCommitService();
-        registry.bind("githubCommitService", commitService);
+        registry.bind(GitHubConstants.GITHUB_COMMIT_SERVICE, commitService);
 
         repositoryService = new MockRepositoryService();
-        registry.bind("githubRepositoryService", repositoryService);
+        registry.bind(GitHubConstants.GITHUB_REPOSITORY_SERVICE, repositoryService);
 
         pullRequestService = new MockPullRequestService();
-        registry.bind("githubPullRequestService", pullRequestService);
+        registry.bind(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE, pullRequestService);
 
         issueService = new MockIssueService(pullRequestService);
-        registry.bind("githbIssueService", issueService);
+        registry.bind(GitHubConstants.GITHUB_ISSUE_SERVICE, issueService);
 
         return registry;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
index 1707a56..92cd27d 100755
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
@@ -26,6 +26,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.github.GitHubComponent;
 import org.apache.camel.component.github.GitHubComponentTestBase;
+import org.apache.camel.component.github.GitHubConstants;
 import org.eclipse.egit.github.core.PullRequest;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -89,7 +90,7 @@ public class ClosePullRequestProducerTest extends GitHubComponentTestBase
{
         public void process(Exchange exchange) throws Exception {
             Message in = exchange.getIn();
             Map<String, Object> headers = in.getHeaders();
-            headers.put("GitHubPullRequest", latestPullRequestId);
+            headers.put(GitHubConstants.GITHUB_PULLREQUEST, latestPullRequestId);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
index 3c40e28..8c95f3c 100644
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.github.GitHubComponent;
 import org.apache.camel.component.github.GitHubComponentTestBase;
+import org.apache.camel.component.github.GitHubConstants;
 import org.eclipse.egit.github.core.Issue;
 import org.eclipse.egit.github.core.Repository;
 import org.junit.Test;
@@ -39,7 +40,7 @@ public class CreateIssueProducerTest extends GitHubComponentTestBase {
             public void configure() throws Exception {
                 context.addComponent("github", new GitHubComponent());
                 from("direct:createIssue")
-                        .process(new MockPullRequestStateProducerProcessor())
+                        .process(new MockIssueCreateProducerProcessor())
                         .to("github://createissue?state=success&username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo");
             } // end of configure
 
@@ -66,12 +67,12 @@ public class CreateIssueProducerTest extends GitHubComponentTestBase {
     }
 
 
-    public class MockPullRequestStateProducerProcessor implements Processor {
+    public class MockIssueCreateProducerProcessor implements Processor {
         @Override
         public void process(Exchange exchange) throws Exception {
             Message in = exchange.getIn();
             Map<String, Object> headers = in.getHeaders();
-            headers.put("GitHubIssueTitle", "Error");
+            headers.put(GitHubConstants.GITHUB_ISSUE_TITLE, "Error");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
index ae5148e..11b3070 100644
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
@@ -27,6 +27,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.github.GitHubComponent;
 import org.apache.camel.component.github.GitHubComponentTestBase;
+import org.apache.camel.component.github.GitHubConstants;
 import org.eclipse.egit.github.core.CommitComment;
 import org.eclipse.egit.github.core.PullRequest;
 import org.junit.Test;
@@ -81,7 +82,7 @@ public class PullRequestCommentProducerTest extends GitHubComponentTestBase
{
         public void process(Exchange exchange) throws Exception {
             Message in = exchange.getIn();
             Map<String, Object> headers = in.getHeaders();
-            headers.put("GitHubPullRequest", latestPullRequestId);
+            headers.put(GitHubConstants.GITHUB_PULLREQUEST, latestPullRequestId);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
index 7ee4078..a312903 100644
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
@@ -27,6 +27,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.github.GitHubComponent;
 import org.apache.camel.component.github.GitHubComponentTestBase;
+import org.apache.camel.component.github.GitHubConstants;
 import org.eclipse.egit.github.core.CommitFile;
 import org.eclipse.egit.github.core.PullRequest;
 import org.junit.Test;
@@ -80,7 +81,7 @@ public class PullRequestFilesProducerTest extends GitHubComponentTestBase
{
         public void process(Exchange exchange) throws Exception {
             Message in = exchange.getIn();
             Map<String, Object> headers = in.getHeaders();
-            headers.put("GitHubPullRequest", latestPullRequestNumber);
+            headers.put(GitHubConstants.GITHUB_PULLREQUEST, latestPullRequestNumber);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/9307d0ce/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
index b0cfb02..7bbde10 100644
--- a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
+++ b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
@@ -26,6 +26,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.github.GitHubComponent;
 import org.apache.camel.component.github.GitHubComponentTestBase;
+import org.apache.camel.component.github.GitHubConstants;
 import org.eclipse.egit.github.core.CommitStatus;
 import org.junit.Test;
 
@@ -82,7 +83,7 @@ public class PullRequestStateProducerTest extends GitHubComponentTestBase
{
         public void process(Exchange exchange) throws Exception {
             Message in = exchange.getIn();
             Map<String, Object> headers = in.getHeaders();
-            headers.put("GitHubPullRequestHeadCommitSHA", commitsha);
+            headers.put(GitHubConstants.GITHUB_PULLREQUEST_HEAD_COMMIT_SHA, commitsha);
         }
     }
 


Mime
View raw message