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 3967fc1  CAMEL-15186: Adding support for Workday Common REST API. 
(#3920)
3967fc1 is described below

commit 3967fc170d3881697be9383eb04169a70ee8aeb6
Author: favalos <gaval...@gmail.com>
AuthorDate: Tue Jun 16 21:41:19 2020 -0700

    CAMEL-15186: Adding support for Workday Common REST API. (#3920)
    
    * CAMEL-15186: Adding support for Workday Common REST API.
    
    * CAMEL-15186: Add Category enum removed.
    
    * CAMEL-15186: Fix code style warnings.
---
 .../apache/camel/component/workday/workday.json    |   2 +-
 .../src/main/docs/workday-component.adoc           |   2 +-
 .../component/workday/WorkdayConfiguration.java    |   5 +-
 .../camel/component/workday/WorkdayEndpoint.java   |   4 +
 .../workday/producer/WorkdayCommonAPIProducer.java | 100 ++++++++++++++
 .../WorkdayDefaultProducer.java}                   |  31 +----
 .../workday/producer/WorkdayReportProducer.java    |  59 ++++++++
 .../apache/camel/WorkdayCommonAPIProducerTest.java | 152 +++++++++++++++++++++
 .../apache/camel/WorkdayReportProducerTest.java    |   2 +-
 .../component/ComponentsBuilderFactory.java        |   4 +-
 .../dsl/WorkdayComponentBuilderFactory.java        |   6 +-
 .../src/generated/resources/metadata.json          |   4 +-
 .../builder/endpoint/StaticEndpointBuilders.java   |  12 +-
 .../dsl/WorkdayEndpointBuilderFactory.java         |  14 +-
 .../modules/ROOT/pages/workday-component.adoc      |   4 +-
 15 files changed, 350 insertions(+), 51 deletions(-)

diff --git 
a/components/camel-workday/src/generated/resources/org/apache/camel/component/workday/workday.json
 
b/components/camel-workday/src/generated/resources/org/apache/camel/component/workday/workday.json
index 3e0dd57..62dab38 100644
--- 
a/components/camel-workday/src/generated/resources/org/apache/camel/component/workday/workday.json
+++ 
b/components/camel-workday/src/generated/resources/org/apache/camel/component/workday/workday.json
@@ -25,7 +25,7 @@
     "basicPropertyBinding": { "kind": "property", "displayName": "Basic 
Property Binding", "group": "advanced", "label": "advanced", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Whether the component should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities" }
   },
   "properties": {
-    "entity": { "kind": "path", "displayName": "Entity", "group": "producer", 
"label": "", "required": true, "type": "object", "javaType": 
"org.apache.camel.component.workday.WorkdayConfiguration.Entity", "enum": [ 
"report" ], "deprecated": false, "deprecationNote": "", "secret": false, 
"configurationClass": 
"org.apache.camel.component.workday.WorkdayConfiguration", 
"configurationField": "workdayConfiguration", "description": "The entity to be 
requested or subscribed via API." },
+    "entity": { "kind": "path", "displayName": "Entity", "group": "producer", 
"label": "", "required": true, "type": "object", "javaType": 
"org.apache.camel.component.workday.WorkdayConfiguration.Entity", "enum": [ 
"report", "commonAPI" ], "deprecated": false, "deprecationNote": "", "secret": 
false, "configurationClass": 
"org.apache.camel.component.workday.WorkdayConfiguration", 
"configurationField": "workdayConfiguration", "description": "The entity to be 
requested or subscribed via API." },
     "path": { "kind": "path", "displayName": "Path", "group": "producer", 
"label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "secret": 
false, "configurationClass": 
"org.apache.camel.component.workday.WorkdayConfiguration", 
"configurationField": "workdayConfiguration", "description": "The API path to 
access an entity structure." },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start 
Producer", "group": "producer", "label": "producer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a producer may otherwise 
fail during starting and cause the  [...]
     "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic 
Property Binding", "group": "advanced", "label": "advanced", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Whether the endpoint should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities" },
diff --git a/components/camel-workday/src/main/docs/workday-component.adoc 
b/components/camel-workday/src/main/docs/workday-component.adoc
index acbfe39..3530e79 100644
--- a/components/camel-workday/src/main/docs/workday-component.adoc
+++ b/components/camel-workday/src/main/docs/workday-component.adoc
@@ -59,7 +59,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *entity* | *Required* The entity to be requested or subscribed via API. The 
value can be one of: report |  | Entity
+| *entity* | *Required* The entity to be requested or subscribed via API. The 
value can be one of: report, commonAPI |  | Entity
 | *path* | *Required* The API path to access an entity structure. |  | String
 |===
 
diff --git 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayConfiguration.java
 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayConfiguration.java
index 55fc369..f0a403e 100644
--- 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayConfiguration.java
+++ 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayConfiguration.java
@@ -32,10 +32,11 @@ public class WorkdayConfiguration {
 
     // Implemented entities
     public enum Entity {
-        report
+        report,
+        commonAPI
     }
 
-    @UriPath(description = "The entity to be requested or subscribed via 
API.", enums = "report")
+    @UriPath(description = "The entity to be requested or subscribed via 
API.", enums = "report,commonAPI")
     @Metadata(required = true)
     private Entity entity;
 
diff --git 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayEndpoint.java
 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayEndpoint.java
index 6a42229..fe572b1 100644
--- 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayEndpoint.java
+++ 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayEndpoint.java
@@ -20,6 +20,8 @@ import org.apache.camel.Category;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.component.workday.producer.WorkdayCommonAPIProducer;
+import org.apache.camel.component.workday.producer.WorkdayReportProducer;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
@@ -45,6 +47,8 @@ public class WorkdayEndpoint extends DefaultEndpoint {
         switch (workdayConfiguration.getEntity()) {
             case report:
                 return new WorkdayReportProducer(this);
+            case commonAPI:
+                return new WorkdayCommonAPIProducer(this);
             default:
                 throw new UnsupportedOperationException(String.format("Workday 
producer %s is not implemented", workdayConfiguration.getEntity()));
         }
diff --git 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayCommonAPIProducer.java
 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayCommonAPIProducer.java
new file mode 100644
index 0000000..6bef578
--- /dev/null
+++ 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayCommonAPIProducer.java
@@ -0,0 +1,100 @@
+/*
+ * 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.workday.producer;
+
+import java.net.MalformedURLException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.camel.component.workday.WorkdayConfiguration;
+import org.apache.camel.component.workday.WorkdayEndpoint;
+
+/**
+ * The Workday Common REST API producer.
+ */
+public class WorkdayCommonAPIProducer extends WorkdayDefaultProducer {
+
+    public static final String WORKDAY_COMMON_API_URL_TEMPLATE = 
"https://%s/ccx/api/v1/%s%s";;
+
+    public static final String WORKDAY_ID_PATTERN = "([0-9a-f]{32})";
+
+    public static final String WORKDAY_GENERIC_ID = "{ID}";
+
+    private final Set<String> workdayValidEndpointSet;
+
+    public WorkdayCommonAPIProducer(WorkdayEndpoint endpoint) {
+
+        super(endpoint);
+
+        this.workdayValidEndpointSet = new HashSet<>();
+        this.workdayValidEndpointSet.add("/auditLogs");
+        this.workdayValidEndpointSet.add("/auditLogs/{ID}");
+        this.workdayValidEndpointSet.add("/businessTitleChanges/{ID}");
+        this.workdayValidEndpointSet.add("/currencies");
+        this.workdayValidEndpointSet.add("/currencies/{ID}");
+        this.workdayValidEndpointSet.add("/customers/{ID}");
+        this.workdayValidEndpointSet.add("/customers/{ID}/activities");
+        this.workdayValidEndpointSet.add("/customers/{ID}/activities/{ID}");
+        this.workdayValidEndpointSet.add("/jobChangeReasons");
+        this.workdayValidEndpointSet.add("/jobChangeReasons/{ID}");
+        this.workdayValidEndpointSet.add("/organizationTypes");
+        this.workdayValidEndpointSet.add("/organizationTypes/{ID}");
+        this.workdayValidEndpointSet.add("/organizations");
+        this.workdayValidEndpointSet.add("/organizations/{ID}");
+        this.workdayValidEndpointSet.add("/supervisoryOrganizations");
+        this.workdayValidEndpointSet.add("/supervisoryOrganizations/{ID}");
+        
this.workdayValidEndpointSet.add("/supervisoryOrganizations/{ID}/workers");
+        
this.workdayValidEndpointSet.add("/supervisoryOrganizations/{ID}/workers/{ID}");
+        this.workdayValidEndpointSet.add("/workers");
+        this.workdayValidEndpointSet.add("/workers/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/businessTitleChanges");
+        
this.workdayValidEndpointSet.add("/workers/{ID}/businessTitleChanges/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/directReports");
+        this.workdayValidEndpointSet.add("/workers/{ID}/directReports/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/history");
+        this.workdayValidEndpointSet.add("/workers/{ID}/history/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/inboxTasks");
+        this.workdayValidEndpointSet.add("/workers/{ID}/inboxTasks/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/organizations");
+        this.workdayValidEndpointSet.add("/workers/{ID}/organizations/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/paySlips");
+        this.workdayValidEndpointSet.add("/workers/{ID}/paySlips/{ID}");
+        
this.workdayValidEndpointSet.add("/workers/{ID}/supervisoryOrganizationsManaged");
+        
this.workdayValidEndpointSet.add("/workers/{ID}/supervisoryOrganizationsManaged/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/timeOffEntries");
+        this.workdayValidEndpointSet.add("/workers/{ID}/timeOffEntries/{ID}");
+        this.workdayValidEndpointSet.add("/workers/{ID}/timeOffPlans");
+        this.workdayValidEndpointSet.add("/workers/{ID}/timeOffPlans/{ID}");
+
+    }
+
+    @Override
+    public String prepareUri(WorkdayConfiguration configuration) throws 
Exception {
+
+        String pathString = new String(configuration.getPath());
+        String genericPath = pathString.replaceAll(WORKDAY_ID_PATTERN, 
WORKDAY_GENERIC_ID);
+
+        if (!this.workdayValidEndpointSet.contains(genericPath)) {
+            throw new MalformedURLException(String.format("An invalid Workday 
Common endpoint: '%s' was provided.", genericPath));
+        }
+
+        String uriString = String.format(WORKDAY_COMMON_API_URL_TEMPLATE, 
configuration.getHost(), configuration.getTenant(), pathString);
+
+        return uriString;
+    }
+
+}
\ No newline at end of file
diff --git 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayReportProducer.java
 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayDefaultProducer.java
similarity index 73%
rename from 
components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayReportProducer.java
rename to 
components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayDefaultProducer.java
index 3e3aa09..09a3aad 100644
--- 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/WorkdayReportProducer.java
+++ 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayDefaultProducer.java
@@ -14,12 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.workday;
-
-import java.util.Map;
-import java.util.stream.Collectors;
+package org.apache.camel.component.workday.producer;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.workday.WorkdayConfiguration;
+import org.apache.camel.component.workday.WorkdayEndpoint;
 import org.apache.camel.component.workday.auth.AuthClientForIntegration;
 import org.apache.camel.component.workday.auth.AutheticationClient;
 import org.apache.camel.support.DefaultProducer;
@@ -33,12 +32,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * The Workday Report producer.
+ * The Workday Default producer.
  */
-public class WorkdayReportProducer extends DefaultProducer {
+public abstract class WorkdayDefaultProducer extends DefaultProducer {
 
     public static final String WORKDAY_URL_HEADER = "CamelWorkdayURL";
-    public static final String WORKDAY_RASS_URL_TEMPALTE = 
"https://%s/ccx/service/customreport2/%s%s";;
 
     private static final Logger LOG = 
LoggerFactory.getLogger(WorkdayReportProducer.class);
 
@@ -46,7 +44,7 @@ public class WorkdayReportProducer extends DefaultProducer {
 
     private AutheticationClient autheticationClient;
 
-    public WorkdayReportProducer(WorkdayEndpoint endpoint) {
+    public WorkdayDefaultProducer(WorkdayEndpoint endpoint) {
         super(endpoint);
         this.endpoint = endpoint;
         this.autheticationClient = new 
AuthClientForIntegration(this.endpoint.getWorkdayConfiguration());
@@ -81,21 +79,6 @@ public class WorkdayReportProducer extends DefaultProducer {
         exchange.getIn().setHeader(WORKDAY_URL_HEADER, workdayUri);
     }
 
-    public String prepareUri(WorkdayConfiguration configuration) {
-        Map<String, Object> parameters = configuration.getParameters();
-        StringBuilder stringBuilder = new 
StringBuilder(configuration.getPath());
-        stringBuilder.append("?");
-        if (parameters.size() > 0) {
-            String params = parameters.keySet().stream().map(k -> k + "=" + 
parameters.get(k)).collect(Collectors.joining("&"));
-            stringBuilder.append(params);
-            stringBuilder.append("&");
-        }
-
-        stringBuilder.append("format=");
-        stringBuilder.append(configuration.getReportFormat());
-        String uriString = String.format(WORKDAY_RASS_URL_TEMPALTE, 
configuration.getHost(), configuration.getTenant(), stringBuilder.toString());
-
-        return uriString;
-    }
+    public abstract String prepareUri(WorkdayConfiguration configuration) 
throws Exception;
 
 }
diff --git 
a/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayReportProducer.java
 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayReportProducer.java
new file mode 100644
index 0000000..3bd1c7c
--- /dev/null
+++ 
b/components/camel-workday/src/main/java/org/apache/camel/component/workday/producer/WorkdayReportProducer.java
@@ -0,0 +1,59 @@
+/*
+ * 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.workday.producer;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.camel.component.workday.WorkdayConfiguration;
+import org.apache.camel.component.workday.WorkdayEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The Workday Report producer.
+ */
+public class WorkdayReportProducer extends WorkdayDefaultProducer {
+
+    public static final String WORKDAY_RASS_URL_TEMPLATE = 
"https://%s/ccx/service/customreport2/%s%s";;
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(WorkdayReportProducer.class);
+
+    public WorkdayReportProducer(WorkdayEndpoint endpoint) {
+        super(endpoint);
+    }
+
+
+    @Override
+    public String prepareUri(WorkdayConfiguration configuration) {
+        Map<String, Object> parameters = configuration.getParameters();
+        StringBuilder stringBuilder = new 
StringBuilder(configuration.getPath());
+        stringBuilder.append("?");
+        if (parameters.size() > 0) {
+            String params = parameters.keySet().stream().map(k -> k + "=" + 
parameters.get(k)).collect(Collectors.joining("&"));
+            stringBuilder.append(params);
+            stringBuilder.append("&");
+        }
+
+        stringBuilder.append("format=");
+        stringBuilder.append(configuration.getReportFormat());
+        String uriString = String.format(WORKDAY_RASS_URL_TEMPLATE, 
configuration.getHost(), configuration.getTenant(), stringBuilder.toString());
+
+        return uriString;
+    }
+
+}
\ No newline at end of file
diff --git 
a/components/camel-workday/src/test/java/org/apache/camel/WorkdayCommonAPIProducerTest.java
 
b/components/camel-workday/src/test/java/org/apache/camel/WorkdayCommonAPIProducerTest.java
new file mode 100644
index 0000000..3d12e84
--- /dev/null
+++ 
b/components/camel-workday/src/test/java/org/apache/camel/WorkdayCommonAPIProducerTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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;
+
+import java.net.MalformedURLException;
+
+import org.apache.camel.component.workday.WorkdayComponent;
+import org.apache.camel.component.workday.WorkdayConfiguration;
+import org.apache.camel.component.workday.WorkdayEndpoint;
+import org.apache.camel.component.workday.producer.WorkdayCommonAPIProducer;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class WorkdayCommonAPIProducerTest extends CamelTestSupport {
+
+    @Test
+    public void createProducerMinimalConfiguration() throws Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+        WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+            .createEndpoint("workday:commonAPI:/workers?" + 
"host=impl.workday.com" + "&tenant=camel" + 
"&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                            + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&reportFormat=json");
+
+        WorkdayConfiguration workdayConfiguration = 
workdayEndpoint.getWorkdayConfiguration();
+
+        assertEquals(workdayConfiguration.getEntity(), 
WorkdayConfiguration.Entity.commonAPI);
+        assertEquals(workdayConfiguration.getPath(), "/workers");
+        assertEquals(workdayConfiguration.getHost(), "impl.workday.com");
+        assertEquals(workdayConfiguration.getTenant(), "camel");
+        assertEquals(workdayConfiguration.getClientId(), 
"f7014d38-99d2-4969-b740-b5b62db6b46a");
+        assertEquals(workdayConfiguration.getClientSecret(), 
"7dbaf280-3cea-11ea-b77f-2e728ce88125");
+        assertEquals(workdayConfiguration.getTokenRefresh(), "88689ab63cda");
+    }
+
+    @Test
+    public void createProducerNoHostConfiguration() throws Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+        try {
+
+            WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+                .createEndpoint("workday:commonAPI:/workers?" + "tenant=camel" 
+ "&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                                + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&format=json");
+        } catch (Exception exception) {
+
+            assertEquals(exception.getClass(), IllegalArgumentException.class);
+            assertEquals(exception.getMessage(), "Host must be specified");
+            return;
+        }
+
+        assertTrue("Required parameters validation failed.", false);
+    }
+
+    @Test
+    public void createProducerInvalidAPIConfiguration() throws Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+
+        WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+            .createEndpoint("workday:commonAPI:/worker?" + 
"host=impl.workday.com" + "&tenant=camel" + 
"&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                            + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&format=json");
+
+        WorkdayCommonAPIProducer workdayProducer = new 
WorkdayCommonAPIProducer(workdayEndpoint);
+
+        try {
+
+            String workdayUri = 
workdayProducer.prepareUri(workdayEndpoint.getWorkdayConfiguration());
+        } catch (Exception exception) {
+
+            assertEquals(exception.getClass(), MalformedURLException.class);
+            assertEquals(exception.getMessage(), "An invalid Workday Common 
endpoint: '/worker' was provided.");
+            return;
+        }
+
+        assertTrue("Required parameters validation failed.", false);
+    }
+
+    @Test
+    public void createProducerWorkersValidAPIConfiguration() throws Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+
+        WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+            .createEndpoint("workday:commonAPI:/workers?" + 
"host=impl.workday.com" + "&tenant=camel" + 
"&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                            + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&format=json");
+
+        WorkdayCommonAPIProducer workdayProducer = new 
WorkdayCommonAPIProducer(workdayEndpoint);
+
+        String workdayUri = 
workdayProducer.prepareUri(workdayEndpoint.getWorkdayConfiguration());
+
+        assertEquals(workdayUri, 
"https://impl.workday.com/ccx/api/v1/camel/workers";);
+    }
+
+    @Test
+    public void createProducerPayslipByIDValidAPIConfiguration() throws 
Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+
+        WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+            
.createEndpoint("workday:commonAPI:/workers/4ab56f4b34c4b4a2be3e4f5a732c2343/paySlips/4ab56f4c39c4b4a2bf3e4f5a732c2343?"
 + "host=impl.workday.com" + "&tenant=camel" + 
"&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                            + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&format=json");
+
+        WorkdayCommonAPIProducer workdayProducer = new 
WorkdayCommonAPIProducer(workdayEndpoint);
+
+        String workdayUri = 
workdayProducer.prepareUri(workdayEndpoint.getWorkdayConfiguration());
+
+        assertEquals(workdayUri, 
"https://impl.workday.com/ccx/api/v1/camel/workers/4ab56f4b34c4b4a2be3e4f5a732c2343/paySlips/4ab56f4c39c4b4a2bf3e4f5a732c2343";);
+    }
+
+    @Test(expected = Test.None.class /* no exception expected */)
+    public void createProducerCurrenciesValidConfiguration() throws Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+
+        WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+            .createEndpoint("workday:commonAPI:/currencies?" + 
"host=impl.workday.com" + "&tenant=camel" + 
"&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                            + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&format=json");
+
+        WorkdayCommonAPIProducer workdayProducer = new 
WorkdayCommonAPIProducer(workdayEndpoint);
+
+        workdayProducer.prepareUri(workdayEndpoint.getWorkdayConfiguration());
+    }
+
+    @Test(expected = MalformedURLException.class /* no exception expected */)
+    public void createProducerCurrenciesInvalidIDConfiguration() throws 
Exception {
+        WorkdayComponent workdayComponent = context.getComponent("workday", 
WorkdayComponent.class);
+
+
+        WorkdayEndpoint workdayEndpoint = (WorkdayEndpoint)workdayComponent
+            
.createEndpoint("workday:commonAPI:/currencies/4ab56f4b34c4b4a2be3g4f5a732c2343?"
 + "host=impl.workday.com" + "&tenant=camel" + 
"&clientId=f7014d38-99d2-4969-b740-b5b62db6b46a"
+                            + 
"&clientSecret=7dbaf280-3cea-11ea-b77f-2e728ce88125" + 
"&tokenRefresh=88689ab63cda" + "&format=json");
+
+        WorkdayCommonAPIProducer workdayProducer = new 
WorkdayCommonAPIProducer(workdayEndpoint);
+
+        workdayProducer.prepareUri(workdayEndpoint.getWorkdayConfiguration());
+    }
+}
+
diff --git 
a/components/camel-workday/src/test/java/org/apache/camel/WorkdayReportProducerTest.java
 
b/components/camel-workday/src/test/java/org/apache/camel/WorkdayReportProducerTest.java
index 0b3f096..776c94f 100644
--- 
a/components/camel-workday/src/test/java/org/apache/camel/WorkdayReportProducerTest.java
+++ 
b/components/camel-workday/src/test/java/org/apache/camel/WorkdayReportProducerTest.java
@@ -19,7 +19,7 @@ package org.apache.camel;
 import org.apache.camel.component.workday.WorkdayComponent;
 import org.apache.camel.component.workday.WorkdayConfiguration;
 import org.apache.camel.component.workday.WorkdayEndpoint;
-import org.apache.camel.component.workday.WorkdayReportProducer;
+import org.apache.camel.component.workday.producer.WorkdayReportProducer;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
diff --git 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
index 3467d7d..2efd3a2 100644
--- 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
+++ 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
@@ -3820,9 +3820,9 @@ public interface ComponentsBuilderFactory {
     }
     /**
      * Workday (camel-workday)
-     * Detect and parse documents using Workday.
+     * Represents a Workday endpoint.
      * 
-     * Category: cloud,api,hcm
+     * Category: hcm
      * Since: 3.1
      * Maven coordinates: org.apache.camel:camel-workday
      */
diff --git 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WorkdayComponentBuilderFactory.java
 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WorkdayComponentBuilderFactory.java
index 763e64d..ba2c67a 100644
--- 
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WorkdayComponentBuilderFactory.java
+++ 
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/WorkdayComponentBuilderFactory.java
@@ -23,7 +23,7 @@ import org.apache.camel.builder.component.ComponentBuilder;
 import org.apache.camel.component.workday.WorkdayComponent;
 
 /**
- * Detect and parse documents using Workday.
+ * Represents a Workday endpoint.
  * 
  * Generated by camel-package-maven-plugin - do not edit this file!
  */
@@ -32,9 +32,9 @@ public interface WorkdayComponentBuilderFactory {
 
     /**
      * Workday (camel-workday)
-     * Detect and parse documents using Workday.
+     * Represents a Workday endpoint.
      * 
-     * Category: cloud,api,hcm
+     * Category: hcm
      * Since: 3.1
      * Maven coordinates: org.apache.camel:camel-workday
      */
diff --git a/core/camel-componentdsl/src/generated/resources/metadata.json 
b/core/camel-componentdsl/src/generated/resources/metadata.json
index 28dae62..605b41d 100644
--- a/core/camel-componentdsl/src/generated/resources/metadata.json
+++ b/core/camel-componentdsl/src/generated/resources/metadata.json
@@ -7127,10 +7127,10 @@
     "kind": "component",
     "name": "workday",
     "title": "Workday",
-    "description": "Detect and parse documents using Workday.",
+    "description": "Represents a Workday endpoint.",
     "deprecated": false,
     "firstVersion": "3.1.0",
-    "label": "cloud,api,hcm",
+    "label": "hcm",
     "javaType": "org.apache.camel.component.workday.WorkdayComponent",
     "supportLevel": "Stable",
     "groupId": "org.apache.camel",
diff --git 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index 0be4911..e37e7e5 100644
--- 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++ 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -14787,9 +14787,9 @@ public class StaticEndpointBuilders {
     }
     /**
      * Workday (camel-workday)
-     * Detect and parse documents using Workday.
+     * Represents a Workday endpoint.
      * 
-     * Category: cloud,api,hcm
+     * Category: hcm
      * Since: 3.1
      * Maven coordinates: org.apache.camel:camel-workday
      * 
@@ -14797,7 +14797,7 @@ public class StaticEndpointBuilders {
      * 
      * Path parameter: entity (required)
      * The entity to be requested or subscribed via API.
-     * The value can be one of: report
+     * The value can be one of: report, commonAPI
      * 
      * Path parameter: path (required)
      * The API path to access an entity structure.
@@ -14810,9 +14810,9 @@ public class StaticEndpointBuilders {
     }
     /**
      * Workday (camel-workday)
-     * Detect and parse documents using Workday.
+     * Represents a Workday endpoint.
      * 
-     * Category: cloud,api,hcm
+     * Category: hcm
      * Since: 3.1
      * Maven coordinates: org.apache.camel:camel-workday
      * 
@@ -14820,7 +14820,7 @@ public class StaticEndpointBuilders {
      * 
      * Path parameter: entity (required)
      * The entity to be requested or subscribed via API.
-     * The value can be one of: report
+     * The value can be one of: report, commonAPI
      * 
      * Path parameter: path (required)
      * The API path to access an entity structure.
diff --git 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WorkdayEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WorkdayEndpointBuilderFactory.java
index 17a36a8..2f39722 100644
--- 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WorkdayEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WorkdayEndpointBuilderFactory.java
@@ -22,7 +22,7 @@ import org.apache.camel.builder.EndpointProducerBuilder;
 import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
 
 /**
- * Detect and parse documents using Workday.
+ * Represents a Workday endpoint.
  * 
  * Generated by camel build tools - do NOT edit this file!
  */
@@ -247,9 +247,9 @@ public interface WorkdayEndpointBuilderFactory {
     public interface WorkdayBuilders {
         /**
          * Workday (camel-workday)
-         * Detect and parse documents using Workday.
+         * Represents a Workday endpoint.
          * 
-         * Category: cloud,api,hcm
+         * Category: hcm
          * Since: 3.1
          * Maven coordinates: org.apache.camel:camel-workday
          * 
@@ -257,7 +257,7 @@ public interface WorkdayEndpointBuilderFactory {
          * 
          * Path parameter: entity (required)
          * The entity to be requested or subscribed via API.
-         * The value can be one of: report
+         * The value can be one of: report, commonAPI
          * 
          * Path parameter: path (required)
          * The API path to access an entity structure.
@@ -269,9 +269,9 @@ public interface WorkdayEndpointBuilderFactory {
         }
         /**
          * Workday (camel-workday)
-         * Detect and parse documents using Workday.
+         * Represents a Workday endpoint.
          * 
-         * Category: cloud,api,hcm
+         * Category: hcm
          * Since: 3.1
          * Maven coordinates: org.apache.camel:camel-workday
          * 
@@ -279,7 +279,7 @@ public interface WorkdayEndpointBuilderFactory {
          * 
          * Path parameter: entity (required)
          * The entity to be requested or subscribed via API.
-         * The value can be one of: report
+         * The value can be one of: report, commonAPI
          * 
          * Path parameter: path (required)
          * The API path to access an entity structure.
diff --git a/docs/components/modules/ROOT/pages/workday-component.adoc 
b/docs/components/modules/ROOT/pages/workday-component.adoc
index 1bafc14..993975a 100644
--- a/docs/components/modules/ROOT/pages/workday-component.adoc
+++ b/docs/components/modules/ROOT/pages/workday-component.adoc
@@ -4,7 +4,7 @@
 :page-source: components/camel-workday/src/main/docs/workday-component.adoc
 :docTitle: Workday
 :artifactId: camel-workday
-:description: Detect and parse documents using Workday.
+:description: Represents a Workday endpoint.
 :since: 3.1
 :supportLevel: Stable
 :component-header: Only producer is supported
@@ -61,7 +61,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *entity* | *Required* The entity to be requested or subscribed via API. The 
value can be one of: report |  | Entity
+| *entity* | *Required* The entity to be requested or subscribed via API. The 
value can be one of: report, commonAPI |  | Entity
 | *path* | *Required* The API path to access an entity structure. |  | String
 |===
 

Reply via email to