You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/03/02 11:07:13 UTC

camel git commit: Make ServceNow test configuration easier

Repository: camel
Updated Branches:
  refs/heads/master d05a6d9cc -> 7f2422922


Make ServceNow test configuration easier


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

Branch: refs/heads/master
Commit: 7f24229223408d68669e57b1f752de3075006e21
Parents: d05a6d9
Author: lburgazzoli <lb...@gmail.com>
Authored: Thu Mar 2 12:06:22 2017 +0100
Committer: lburgazzoli <lb...@gmail.com>
Committed: Thu Mar 2 12:06:30 2017 +0100

----------------------------------------------------------------------
 .../servicenow/ServiceNowAttachmentTest.java    |  8 +--
 .../ServiceNowBlueprintComponentAuthTest.java   |  2 +-
 .../ServiceNowBlueprintEndpointAuthTest.java    |  2 +-
 .../servicenow/ServiceNowImportSetTest.java     |  6 +--
 .../servicenow/ServiceNowScorecardTest.java     |  8 +--
 .../ServiceNowServiceCatalogTest.java           | 12 ++---
 .../servicenow/ServiceNowTableTest.java         | 30 +++++------
 .../component/servicenow/ServiceNowTest.java    | 14 +++---
 .../servicenow/ServiceNowTestSupport.java       | 52 ++++++++++++++++----
 9 files changed, 71 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowAttachmentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowAttachmentTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowAttachmentTest.java
index 19f140f..18772d2 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowAttachmentTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowAttachmentTest.java
@@ -40,7 +40,7 @@ public class ServiceNowAttachmentTest extends ServiceNowTestSupport {
         List<AttachmentMeta> attachmentMetaList = template.requestBodyAndHeaders(
             "direct:servicenow",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_ATTACHMENT)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowConstants.MODEL, AttachmentMeta.class)
@@ -120,11 +120,7 @@ public class ServiceNowAttachmentTest extends ServiceNowTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:servicenow")
-                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}")
-                        //+ "&oauthClientId={{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
-                        //+ "&oauthClientSecret={{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}")
+                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")
                     .to("mock:servicenow");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java
index 941ec9e..c3b524a 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java
@@ -40,7 +40,7 @@ public class ServiceNowBlueprintComponentAuthTest extends CamelBlueprintTestSupp
         template().sendBodyAndHeaders(
             "direct:servicenow",
             null,
-            new ServiceNowTestSupport.KVBuilder()
+            ServiceNowTestSupport.kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, "table")
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowParams.SYSPARM_LIMIT, 10)

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java
index dd4ad36..581404c 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java
@@ -39,7 +39,7 @@ public class ServiceNowBlueprintEndpointAuthTest extends CamelBlueprintTestSuppo
         template().sendBodyAndHeaders(
             "direct:servicenow",
             null,
-            new ServiceNowTestSupport.KVBuilder()
+            ServiceNowTestSupport.kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, "table")
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowParams.SYSPARM_LIMIT, 10)

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
index 098965c..c46758c 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowImportSetTest.java
@@ -60,7 +60,7 @@ public class ServiceNowImportSetTest extends ServiceNowTestSupport {
         template().sendBodyAndHeaders(
             "direct:servicenow",
             incident,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_IMPORT)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_CREATE)
                 .put(ServiceNowConstants.REQUEST_MODEL, IncidentImportRequest.class)
@@ -96,9 +96,7 @@ public class ServiceNowImportSetTest extends ServiceNowTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:servicenow")
-                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}")
+                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")
                     .to("mock:servicenow");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowScorecardTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowScorecardTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowScorecardTest.java
index abacc24..429bec2 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowScorecardTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowScorecardTest.java
@@ -33,7 +33,7 @@ public class ServiceNowScorecardTest extends ServiceNowTestSupport {
         List<Scorecard> scorecardList = template.requestBodyAndHeaders(
             "direct:servicenow",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_SCORECARDS)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowConstants.ACTION_SUBJECT, ServiceNowConstants.ACTION_SUBJECT_PERFORMANCE_ANALYTICS)
@@ -54,11 +54,7 @@ public class ServiceNowScorecardTest extends ServiceNowTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:servicenow")
-                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}")
-                        //+ "&oauthClientId={{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
-                        //+ "&oauthClientSecret={{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}")
+                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")
                     .to("mock:servicenow");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowServiceCatalogTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowServiceCatalogTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowServiceCatalogTest.java
index e605a86..9562be8 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowServiceCatalogTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowServiceCatalogTest.java
@@ -35,7 +35,7 @@ public class ServiceNowServiceCatalogTest extends ServiceNowTestSupport {
         List<Map> result1 = template.requestBodyAndHeaders(
             "direct:servicenow",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_SERVICE_CATALOG)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .build(),
@@ -47,7 +47,7 @@ public class ServiceNowServiceCatalogTest extends ServiceNowTestSupport {
         List<Map> result2 = template.requestBodyAndHeaders(
             "direct:servicenow",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_SERVICE_CATALOG)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowConstants.ACTION_SUBJECT, ServiceNowConstants.ACTION_SUBJECT_CATEGORIES)
@@ -64,7 +64,7 @@ public class ServiceNowServiceCatalogTest extends ServiceNowTestSupport {
         List<Map> result = template.requestBodyAndHeaders(
             "direct:servicenow",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_SERVICE_CATALOG)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowConstants.ACTION_SUBJECT, "Invalid")
@@ -84,11 +84,7 @@ public class ServiceNowServiceCatalogTest extends ServiceNowTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:servicenow")
-                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}")
-                        //+ "&oauthClientId={{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
-                        //+ "&oauthClientSecret={{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}")
+                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")
                     .to("mock:servicenow");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
index 4697750..b5403b0 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTableTest.java
@@ -35,7 +35,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
         template().sendBodyAndHeaders(
             "direct:servicenow",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, "table")
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowParams.SYSPARM_LIMIT, 10)
@@ -63,7 +63,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
         template().sendBodyAndHeaders(
             "direct:servicenow-defaults",
             null,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                 .put(ServiceNowParams.SYSPARM_LIMIT, 10)
                 .build()
@@ -103,7 +103,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 incident,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_CREATE)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -136,7 +136,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 null,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -171,7 +171,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 incident,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_MODIFY)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -201,7 +201,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 null,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -233,7 +233,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 null,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -263,7 +263,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 null,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_DELETE)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -285,7 +285,7 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
                 template().sendBodyAndHeaders(
                     "direct:servicenow",
                     null,
-                    new KVBuilder()
+                    kvBuilder()
                         .put(ServiceNowConstants.RESOURCE, "table")
                         .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                         .put(ServiceNowParams.PARAM_SYS_ID, sysId)
@@ -311,20 +311,12 @@ public class ServiceNowTableTest extends ServiceNowTestSupport {
             public void configure() {
                 from("direct:servicenow")
                     .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}"
-                        //+ "&oauthClientId={{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
-                        //+ "&oauthClientSecret={{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}"
-                        + "&model.incident=org.apache.camel.component.servicenow.model.Incident")
+                        + "?model.incident=org.apache.camel.component.servicenow.model.Incident")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")
                     .to("mock:servicenow");
                 from("direct:servicenow-defaults")
                     .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}"
-                        //+ "&oauthClientId={{env:SERVICENOW_OAUTH2_CLIENT_ID}}"
-                        //+ "&oauthClientSecret={{env:SERVICENOW_OAUTH2_CLIENT_SECRET}}"
-                        + "&model.incident=org.apache.camel.component.servicenow.model.Incident"
+                        + "?model.incident=org.apache.camel.component.servicenow.model.Incident"
                         + "&resource=table"
                         + "&table=incident")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTest.java
index d19b799..426a8bfa 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTest.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTest.java
@@ -34,7 +34,7 @@ public class ServiceNowTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 null,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                     .put(ServiceNowParams.SYSPARM_QUERY, "number=" + UUID.randomUUID().toString())
@@ -55,7 +55,7 @@ public class ServiceNowTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 null,
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE)
                     .put(ServiceNowParams.SYSPARM_QUERY, "number=" + UUID.randomUUID().toString())
@@ -78,7 +78,7 @@ public class ServiceNowTest extends ServiceNowTestSupport {
             template().sendBodyAndHeaders(
                 "direct:servicenow",
                 "NotAnIncidentObject",
-                new KVBuilder()
+                kvBuilder()
                     .put(ServiceNowConstants.RESOURCE, "table")
                     .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_CREATE)
                     .put(ServiceNowParams.PARAM_TABLE_NAME, "incident")
@@ -107,7 +107,7 @@ public class ServiceNowTest extends ServiceNowTestSupport {
         template().sendBodyAndHeaders(
             "direct:servicenow",
             incident,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_TABLE)
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_CREATE)
                 .put(ServiceNowConstants.REQUEST_MODEL, Incident.class)
@@ -139,7 +139,7 @@ public class ServiceNowTest extends ServiceNowTestSupport {
         template().sendBodyAndHeaders(
             "direct:servicenow",
             incident,
-            new KVBuilder()
+            kvBuilder()
                 .put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_TABLE)
                 .put(ServiceNowConstants.API_VERSION, "v1")
                 .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_CREATE)
@@ -165,9 +165,7 @@ public class ServiceNowTest extends ServiceNowTestSupport {
         return new RouteBuilder() {
             public void configure() {
                 from("direct:servicenow")
-                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}"
-                        + "?userName={{env:SERVICENOW_USERNAME}}"
-                        + "&password={{env:SERVICENOW_PASSWORD}}")
+                    .to("servicenow:{{env:SERVICENOW_INSTANCE}}")
                     .to("log:org.apache.camel.component.servicenow?level=INFO&showAll=true")
                     .to("mock:servicenow");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/7f242292/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTestSupport.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTestSupport.java
index 2aaf9e4..8ed29b2 100644
--- a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTestSupport.java
+++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowTestSupport.java
@@ -22,31 +22,63 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 class ServiceNowTestSupport extends CamelTestSupport {
-
     protected static final Logger LOGGER = LoggerFactory.getLogger(ServiceNowTestSupport.class);
 
     @Override
     protected CamelContext createCamelContext() throws Exception {
-        return super.createCamelContext();
+        return configureServicenowComponent(super.createCamelContext());
     }
 
-    protected static class KVBuilder {
-        private final Map<String, Object> headers;
+    protected CamelContext configureServicenowComponent(CamelContext camelContext) throws Exception {
+        String userName = getSystemPropertyOrEnvVar("servicenow.username");
+        String password = getSystemPropertyOrEnvVar("servicenow.password");
+        String oauthClientId = getSystemPropertyOrEnvVar("servicenow.oauth2.client.id");
+        String oauthClientSecret = getSystemPropertyOrEnvVar("servicenow.oauth2.client.secret");
+
+        if (ObjectHelper.isNotEmpty(userName) && ObjectHelper.isNotEmpty(password)) {
+            ServiceNowComponent component = new ServiceNowComponent();
+            component.setUserName(userName);
+            component.setPassword(password);
+
+            if (ObjectHelper.isNotEmpty(oauthClientId) && ObjectHelper.isNotEmpty(oauthClientSecret)) {
+                component.setOauthClientId(oauthClientId);
+                component.setOauthClientSecret(oauthClientSecret);
+            }
 
-        public KVBuilder() {
-            this(new HashMap<>());
+            camelContext.addComponent("servicenow", component);
         }
 
-        private KVBuilder(Map<String, Object> headers) {
-            this.headers = headers;
+        return camelContext;
+    }
+
+    protected String getSystemPropertyOrEnvVar(String systemProperty) {
+        String answer = System.getProperty(systemProperty);
+        if (ObjectHelper.isEmpty(answer)) {
+            String envProperty = systemProperty.toUpperCase().replaceAll("[.-]", "_");
+            answer = System.getenv(envProperty);
         }
 
-        public KVBuilder on(Map<String, Object> headers) {
-            return new KVBuilder(headers);
+        return answer;
+    }
+
+    protected static KVBuilder kvBuilder() {
+        return new KVBuilder(new HashMap<>());
+    }
+
+    protected static KVBuilder kvBuilder(Map<String, Object> headers) {
+        return new KVBuilder(headers);
+    }
+
+    protected static final class KVBuilder {
+        private final Map<String, Object> headers;
+
+        private KVBuilder(Map<String, Object> headers) {
+            this.headers = new HashMap<>(headers);
         }
 
         public KVBuilder put(String key, Object val) {