You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dh...@apache.org on 2014/07/11 03:06:09 UTC
[4/7] CAMEL-6568: Initial version of LinkedIn component
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConsumer.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConsumer.java
new file mode 100644
index 0000000..bb1e029
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConsumer.java
@@ -0,0 +1,58 @@
+/**
+ * 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.linkedin;
+
+import java.util.Map;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.Processor;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.linkedin.api.LinkedInException;
+import org.apache.camel.component.linkedin.api.model.Error;
+import org.apache.camel.component.linkedin.internal.LinkedInApiName;
+import org.apache.camel.util.component.AbstractApiConsumer;
+
+/**
+ * The LinkedIn consumer.
+ */
+public class LinkedInConsumer extends AbstractApiConsumer<LinkedInApiName, LinkedInConfiguration> {
+
+ public LinkedInConsumer(LinkedInEndpoint endpoint, Processor processor) {
+ super(endpoint, processor);
+ }
+
+ @Override
+ protected Object doInvokeMethod(Map<String, Object> args) {
+ try {
+ return super.doInvokeMethod(args);
+ } catch (RuntimeCamelException e) {
+ if (e.getCause() instanceof WebApplicationException) {
+ WebApplicationException cause = (WebApplicationException) e.getCause();
+ final Response response = cause.getResponse();
+ if (response.hasEntity()) {
+ // try and convert it to LinkedInException
+ final org.apache.camel.component.linkedin.api.model.Error error = response.readEntity(Error.class);
+ throw new RuntimeCamelException(
+ String.format("Error invoking %s: %s", method.getName(), error.getMessage()),
+ new LinkedInException(error, response));
+ }
+ }
+ throw e;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java
new file mode 100644
index 0000000..12f8ade
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java
@@ -0,0 +1,174 @@
+/**
+ * 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.linkedin;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.linkedin.api.CommentsResource;
+import org.apache.camel.component.linkedin.api.CompaniesResource;
+import org.apache.camel.component.linkedin.api.GroupsResource;
+import org.apache.camel.component.linkedin.api.JobsResource;
+import org.apache.camel.component.linkedin.api.LinkedInOAuthRequestFilter;
+import org.apache.camel.component.linkedin.api.PeopleResource;
+import org.apache.camel.component.linkedin.api.PostsResource;
+import org.apache.camel.component.linkedin.api.SearchResource;
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.LinkedInApiName;
+import org.apache.camel.component.linkedin.internal.LinkedInConstants;
+import org.apache.camel.component.linkedin.internal.LinkedInPropertiesHelper;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.util.component.AbstractApiEndpoint;
+import org.apache.camel.util.component.ApiMethod;
+import org.apache.camel.util.component.ApiMethodPropertiesHelper;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
+
+/**
+ * Represents a LinkedIn endpoint.
+ */
+@UriEndpoint(scheme = "linkedin", consumerClass = LinkedInConsumer.class, consumerPrefix = "consumer")
+public class LinkedInEndpoint extends AbstractApiEndpoint<LinkedInApiName, LinkedInConfiguration> {
+
+ private static final String DEFAULT_FIELDS_SELECTOR = "";
+ private static final String FIELDS_OPTION = "fields";
+ // OAuth request filter
+ private LinkedInOAuthRequestFilter requestFilter;
+
+ // Resource API proxy
+ private Object resourceProxy;
+
+ public LinkedInEndpoint(String uri, LinkedInComponent component,
+ LinkedInApiName apiName, String methodName, LinkedInConfiguration endpointConfiguration) {
+ super(uri, component, apiName, methodName, LinkedInApiCollection.getCollection().getHelper(apiName), endpointConfiguration);
+
+ }
+
+ public Producer createProducer() throws Exception {
+ return new LinkedInProducer(this);
+ }
+
+ public Consumer createConsumer(Processor processor) throws Exception {
+ // make sure inBody is not set for consumers
+ if (inBody != null) {
+ throw new IllegalArgumentException("Option inBody is not supported for consumer endpoint");
+ }
+ final LinkedInConsumer consumer = new LinkedInConsumer(this, processor);
+ // also set consumer.* properties
+ configureConsumer(consumer);
+ return consumer;
+ }
+
+ @Override
+ protected ApiMethodPropertiesHelper<LinkedInConfiguration> getPropertiesHelper() {
+ return LinkedInPropertiesHelper.getHelper();
+ }
+
+ protected String getThreadProfileName() {
+ return LinkedInConstants.THREAD_PROFILE_NAME;
+ }
+
+ @Override
+ protected void afterConfigureProperties() {
+ createProxy();
+ }
+
+ // create API proxy, set connection properties, etc.
+ private void createProxy() {
+ // create endpoint filter or get shared filter if configuration values are same as component
+ requestFilter = getComponent().getRequestFilter(configuration);
+
+ final Class<?> proxyClass;
+ switch (apiName) {
+ case COMMENTS:
+ proxyClass = CommentsResource.class;
+ break;
+ case COMPANIES:
+ proxyClass = CompaniesResource.class;
+ break;
+ case GROUPS:
+ proxyClass = GroupsResource.class;
+ break;
+ case JOBS:
+ proxyClass = JobsResource.class;
+ break;
+ case PEOPLE:
+ proxyClass = PeopleResource.class;
+ break;
+ case POSTS:
+ proxyClass = PostsResource.class;
+ break;
+ case SEARCH:
+ proxyClass = SearchResource.class;
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid API name " + apiName);
+ }
+
+ // create endpoint proxy
+ resourceProxy = JAXRSClientFactory.create(LinkedInOAuthRequestFilter.BASE_ADDRESS, proxyClass,
+ Arrays.asList(new Object[]{requestFilter}));
+ }
+
+ @Override
+ public Object getApiProxy(ApiMethod method, Map<String, Object> args) {
+ return resourceProxy;
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ super.doStart();
+
+ if (resourceProxy == null) {
+ createProxy();
+ }
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ super.doStop();
+
+ if (resourceProxy != null) {
+ try {
+ WebClient.client(resourceProxy).close();
+ } catch (Exception e) {
+ log.warn("Error closing LinkedIn REST proxy: " + e.getMessage(), e);
+ }
+ resourceProxy = null;
+ }
+
+ if (requestFilter != null) {
+ getComponent().closeRequestFilter(requestFilter);
+ requestFilter = null;
+ }
+ }
+
+ @Override
+ public LinkedInComponent getComponent() {
+ return (LinkedInComponent) super.getComponent();
+ }
+
+ @Override
+ public void interceptProperties(Map<String, Object> properties) {
+ if (!properties.containsKey(FIELDS_OPTION)) {
+ properties.put(FIELDS_OPTION, DEFAULT_FIELDS_SELECTOR);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInProducer.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInProducer.java
new file mode 100644
index 0000000..4c03856
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInProducer.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.linkedin;
+
+import java.util.Map;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.linkedin.api.LinkedInException;
+import org.apache.camel.component.linkedin.api.model.Error;
+import org.apache.camel.component.linkedin.internal.LinkedInApiName;
+import org.apache.camel.component.linkedin.internal.LinkedInPropertiesHelper;
+import org.apache.camel.util.component.AbstractApiProducer;
+import org.apache.camel.util.component.ApiMethod;
+
+/**
+ * The LinkedIn producer.
+ */
+public class LinkedInProducer extends AbstractApiProducer<LinkedInApiName, LinkedInConfiguration> {
+
+ public LinkedInProducer(LinkedInEndpoint endpoint) {
+ super(endpoint, LinkedInPropertiesHelper.getHelper());
+ }
+
+ @Override
+ protected Object doInvokeMethod(ApiMethod method, Map<String, Object> properties) throws RuntimeCamelException {
+ try {
+ return super.doInvokeMethod(method, properties);
+ } catch (RuntimeCamelException e) {
+ if (e.getCause() instanceof WebApplicationException) {
+ final WebApplicationException cause = (WebApplicationException) e.getCause();
+ final Response response = cause.getResponse();
+ if (response.hasEntity()) {
+ // try and convert it to LinkedInException
+ final org.apache.camel.component.linkedin.api.model.Error error = response.readEntity(Error.class);
+ throw new RuntimeCamelException(
+ String.format("Error invoking %s: %s", method.getName(), error.getMessage()),
+ new LinkedInException(error, response));
+ }
+ }
+ throw e;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/CachingOAuthSecureStorage.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/CachingOAuthSecureStorage.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/CachingOAuthSecureStorage.java
new file mode 100644
index 0000000..029e3ab
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/CachingOAuthSecureStorage.java
@@ -0,0 +1,50 @@
+/**
+ * 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.linkedin.internal;
+
+import org.apache.camel.component.linkedin.api.OAuthSecureStorage;
+import org.apache.camel.component.linkedin.api.OAuthToken;
+
+/**
+ * Caching implementation of {@link org.apache.camel.component.linkedin.api.OAuthSecureStorage}
+ */
+public class CachingOAuthSecureStorage implements OAuthSecureStorage {
+
+ private final OAuthSecureStorage secureStorage;
+ private OAuthToken token;
+
+ public CachingOAuthSecureStorage(OAuthSecureStorage secureStorage) {
+ this.secureStorage = secureStorage;
+ }
+
+ @Override
+ public OAuthToken getOAuthToken() {
+ // delegate only if token doesn't exist or has expired
+ if (secureStorage != null && (token == null || token.getExpiryTime() < System.currentTimeMillis())) {
+ token = secureStorage.getOAuthToken();
+ }
+ return token;
+ }
+
+ @Override
+ public void saveOAuthToken(OAuthToken newToken) {
+ token = newToken;
+ if (secureStorage != null) {
+ secureStorage.saveOAuthToken(newToken);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInConstants.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInConstants.java
new file mode 100644
index 0000000..9ef5575b
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInConstants.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.linkedin.internal;
+
+/**
+ * Constants for LinkedIn component.
+ */
+public interface LinkedInConstants {
+
+ // suffix for parameters when passed as exchange header properties
+ String PROPERTY_PREFIX = "CamelLinkedIn.";
+
+ // thread profile name for this component
+ String THREAD_PROFILE_NAME = "CamelLinkedIn";
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInPropertiesHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInPropertiesHelper.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInPropertiesHelper.java
new file mode 100644
index 0000000..b4a31b6
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/internal/LinkedInPropertiesHelper.java
@@ -0,0 +1,40 @@
+/**
+ * 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.linkedin.internal;
+
+import org.apache.camel.util.component.ApiMethodPropertiesHelper;
+
+import org.apache.camel.component.linkedin.LinkedInConfiguration;
+
+/**
+ * Singleton {@link ApiMethodPropertiesHelper} for LinkedIn component.
+ */
+public final class LinkedInPropertiesHelper extends ApiMethodPropertiesHelper<LinkedInConfiguration> {
+
+ private static LinkedInPropertiesHelper helper;
+
+ private LinkedInPropertiesHelper() {
+ super(LinkedInConfiguration.class, LinkedInConstants.PROPERTY_PREFIX);
+ }
+
+ public static synchronized LinkedInPropertiesHelper getHelper() {
+ if (helper == null) {
+ helper = new LinkedInPropertiesHelper();
+ }
+ return helper;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/main/resources/META-INF/services/org/apache/camel/component/linkedin
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/resources/META-INF/services/org/apache/camel/component/linkedin b/components/camel-linkedin/camel-linkedin-component/src/main/resources/META-INF/services/org/apache/camel/component/linkedin
new file mode 100644
index 0000000..6d67bad
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/main/resources/META-INF/services/org/apache/camel/component/linkedin
@@ -0,0 +1 @@
+class=org.apache.camel.component.linkedin.LinkedInComponent
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/AbstractLinkedInTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/AbstractLinkedInTestSupport.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/AbstractLinkedInTestSupport.java
new file mode 100644
index 0000000..1282aef
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/AbstractLinkedInTestSupport.java
@@ -0,0 +1,73 @@
+package org.apache.camel.component.linkedin;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.component.linkedin.api.OAuthScope;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.IntrospectionSupport;
+
+/**
+ * Abstract base class for LinkedIn Integration tests generated by Camel API component maven plugin.
+ */
+public class AbstractLinkedInTestSupport extends CamelTestSupport {
+
+ private static final String TEST_OPTIONS_PROPERTIES = "/test-options.properties";
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+
+ final CamelContext context = super.createCamelContext();
+
+ // read LinkedIn component configuration from TEST_OPTIONS_PROPERTIES
+ final Properties properties = new Properties();
+ try {
+ properties.load(getClass().getResourceAsStream(TEST_OPTIONS_PROPERTIES));
+ } catch (Exception e) {
+ throw new IOException(String.format("%s could not be loaded: %s", TEST_OPTIONS_PROPERTIES, e.getMessage()),
+ e);
+ }
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+ options.put(entry.getKey().toString(), entry.getValue());
+ }
+ // set scopes
+ final String scope = properties.getProperty("scope");
+ if (scope != null) {
+ options.put("scopes", OAuthScope.fromValues(scope.split(",")));
+ }
+ // TODO save and load token from TEST_OPTIONS_PROPERTIES
+
+ final LinkedInConfiguration configuration = new LinkedInConfiguration();
+ IntrospectionSupport.setProperties(configuration, options);
+
+ // add LinkedInComponent to Camel context
+ final LinkedInComponent component = new LinkedInComponent(context);
+ component.setConfiguration(configuration);
+ context.addComponent("linkedin", component);
+
+ return context;
+ }
+
+ @Override
+ public boolean isCreateCamelContextPerClass() {
+ // only create the context once for this class
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers)
+ throws CamelExecutionException {
+ return (T) template().requestBodyAndHeaders(endpointUri, body, headers);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T requestBody(String endpoint, Object body) throws CamelExecutionException {
+ return (T) template().requestBody(endpoint, body);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CommentsResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CommentsResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CommentsResourceIntegrationTest.java
new file mode 100644
index 0000000..844ff7a
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CommentsResourceIntegrationTest.java
@@ -0,0 +1,66 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Wed Jul 09 19:57:10 PDT 2014
+ */
+package org.apache.camel.component.linkedin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.CommentsResourceApiMethod;
+
+/**
+ * Test class for {@link org.apache.camel.component.linkedin.api.CommentsResource} APIs.
+ */
+public class CommentsResourceIntegrationTest extends AbstractLinkedInTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CommentsResourceIntegrationTest.class);
+ private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(CommentsResourceApiMethod.class).getName();
+
+ // TODO provide parameter values for getComment
+ @Ignore
+ @Test
+ public void testGetComment() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.comment_id", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+
+ final org.apache.camel.component.linkedin.api.model.Comment result = requestBodyAndHeaders("direct://GETCOMMENT", null, headers);
+
+ assertNotNull("getComment result", result);
+ LOG.debug("getComment: " + result);
+ }
+
+ // TODO provide parameter values for removeComment
+ @Ignore
+ @Test
+ public void testRemoveComment() throws Exception {
+ // using String message body for single parameter "comment_id"
+ requestBody("direct://REMOVECOMMENT", null);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for getComment
+ from("direct://GETCOMMENT")
+ .to("linkedin://" + PATH_PREFIX + "/getComment");
+
+ // test route for removeComment
+ from("direct://REMOVECOMMENT")
+ .to("linkedin://" + PATH_PREFIX + "/removeComment?inBody=comment_id");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CompaniesResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CompaniesResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CompaniesResourceIntegrationTest.java
new file mode 100644
index 0000000..fd7cb47
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/CompaniesResourceIntegrationTest.java
@@ -0,0 +1,353 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Wed Jul 09 19:57:10 PDT 2014
+ */
+package org.apache.camel.component.linkedin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.CompaniesResourceApiMethod;
+
+/**
+ * Test class for {@link org.apache.camel.component.linkedin.api.CompaniesResource} APIs.
+ */
+public class CompaniesResourceIntegrationTest extends AbstractLinkedInTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CompaniesResourceIntegrationTest.class);
+ private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(CompaniesResourceApiMethod.class).getName();
+ private static final Long TEST_COMPANY_ID = 1337L;
+
+ // TODO provide parameter values for addCompanyUpdateComment
+ @Ignore
+ @Test
+ public void testAddCompanyUpdateComment() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.UpdateComment
+ headers.put("CamelLinkedIn.updatecomment", null);
+
+ requestBodyAndHeaders("direct://ADDCOMPANYUPDATECOMMENT", null, headers);
+ }
+
+ // TODO provide parameter values for addCompanyUpdateCommentAsCompany
+ @Ignore
+ @Test
+ public void testAddCompanyUpdateCommentAsCompany() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.UpdateComment
+ headers.put("CamelLinkedIn.updatecomment", null);
+
+ requestBodyAndHeaders("direct://ADDCOMPANYUPDATECOMMENTASCOMPANY", null, headers);
+ }
+
+ // TODO provide parameter values for addShare
+ @Ignore
+ @Test
+ public void testAddShare() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is org.apache.camel.component.linkedin.api.model.Share
+ headers.put("CamelLinkedIn.share", null);
+
+ requestBodyAndHeaders("direct://ADDSHARE", null, headers);
+ }
+
+ @Test
+ public void testGetCompanies() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // use defaults
+ // parameter type is String
+// headers.put("CamelLinkedIn.fields", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.email_domain", "linkedin.com");
+ // parameter type is Boolean
+// headers.put("CamelLinkedIn.is_company_admin", null);
+
+ final org.apache.camel.component.linkedin.api.model.Companies result = requestBodyAndHeaders("direct://GETCOMPANIES", null, headers);
+
+ assertNotNull("getCompanies result", result);
+ LOG.debug("getCompanies: " + result);
+ }
+
+ @Test
+ public void testGetCompanyById() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", TEST_COMPANY_ID);
+ // use default value
+/*
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+*/
+
+ final org.apache.camel.component.linkedin.api.model.Company result = requestBodyAndHeaders("direct://GETCOMPANYBYID", null, headers);
+
+ assertNotNull("getCompanyById result", result);
+ LOG.debug("getCompanyById: " + result);
+ }
+
+ @Test
+ public void testGetCompanyByName() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.universal_name", "linkedin");
+ // use default fields
+/*
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+*/
+
+ final org.apache.camel.component.linkedin.api.model.Company result = requestBodyAndHeaders("direct://GETCOMPANYBYNAME", null, headers);
+
+ assertNotNull("getCompanyByName result", result);
+ LOG.debug("getCompanyByName: " + result);
+ }
+
+ // TODO provide parameter values for getCompanyUpdateComments
+ @Ignore
+ @Test
+ public void testGetCompanyUpdateComments() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Comments result = requestBodyAndHeaders("direct://GETCOMPANYUPDATECOMMENTS", null, headers);
+
+ assertNotNull("getCompanyUpdateComments result", result);
+ LOG.debug("getCompanyUpdateComments: " + result);
+ }
+
+ // TODO provide parameter values for getCompanyUpdateLikes
+ @Ignore
+ @Test
+ public void testGetCompanyUpdateLikes() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Likes result = requestBodyAndHeaders("direct://GETCOMPANYUPDATELIKES", null, headers);
+
+ assertNotNull("getCompanyUpdateLikes result", result);
+ LOG.debug("getCompanyUpdateLikes: " + result);
+ }
+
+ @Test
+ public void testGetCompanyUpdates() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", TEST_COMPANY_ID);
+ // use defaults
+/*
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Eventtype
+ headers.put("CamelLinkedIn.event_type", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+*/
+
+ final org.apache.camel.component.linkedin.api.model.Updates result = requestBodyAndHeaders("direct://GETCOMPANYUPDATES", null, headers);
+
+ assertNotNull("getCompanyUpdates result", result);
+ LOG.debug("getCompanyUpdates: " + result);
+ }
+
+ // TODO provide parameter values for getHistoricalFollowStatistics
+ @Ignore
+ @Test
+ public void testGetHistoricalFollowStatistics() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start_timestamp", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.end_timestamp", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Timegranularity
+ headers.put("CamelLinkedIn.time_granularity", null);
+
+ final org.apache.camel.component.linkedin.api.model.HistoricalFollowStatistics result = requestBodyAndHeaders("direct://GETHISTORICALFOLLOWSTATISTICS", null, headers);
+
+ assertNotNull("getHistoricalFollowStatistics result", result);
+ LOG.debug("getHistoricalFollowStatistics: " + result);
+ }
+
+ // TODO provide parameter values for getHistoricalStatusUpdateStatistics
+ @Ignore
+ @Test
+ public void testGetHistoricalStatusUpdateStatistics() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", TEST_COMPANY_ID);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start_timestamp", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.end_timestamp", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Timegranularity
+ headers.put("CamelLinkedIn.time_granularity", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+
+ final org.apache.camel.component.linkedin.api.model.HistoricalStatusUpdateStatistics result = requestBodyAndHeaders("direct://GETHISTORICALSTATUSUPDATESTATISTICS", null, headers);
+
+ assertNotNull("getHistoricalStatusUpdateStatistics result", result);
+ LOG.debug("getHistoricalStatusUpdateStatistics: " + result);
+ }
+
+ @Test
+ public void testGetNumberOfFollowers() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", TEST_COMPANY_ID);
+ // parameter type is java.util.List
+ headers.put("CamelLinkedIn.geos", null);
+ // parameter type is java.util.List
+ headers.put("CamelLinkedIn.companySizes", null);
+ // parameter type is java.util.List
+ headers.put("CamelLinkedIn.jobFunc", null);
+ // parameter type is java.util.List
+ headers.put("CamelLinkedIn.industries", null);
+ // parameter type is java.util.List
+ headers.put("CamelLinkedIn.seniorities", null);
+
+ final org.apache.camel.component.linkedin.api.model.NumFollowers result = requestBodyAndHeaders("direct://GETNUMBEROFFOLLOWERS", null, headers);
+
+ assertNotNull("getNumberOfFollowers result", result);
+ LOG.debug("getNumberOfFollowers: " + result);
+ }
+
+ // TODO provide parameter values for getStatistics
+ @Ignore
+ @Test
+ public void testGetStatistics() throws Exception {
+ // using long message body for single parameter "company_id"
+ final org.apache.camel.component.linkedin.api.model.CompanyStatistics result = requestBody("direct://GETSTATISTICS", 0L);
+
+ assertNotNull("getStatistics result", result);
+ LOG.debug("getStatistics: " + result);
+ }
+
+ @Test
+ public void testIsShareEnabled() throws Exception {
+ // using long message body for single parameter "company_id"
+ final org.apache.camel.component.linkedin.api.model.IsCompanyShareEnabled result = requestBody("direct://ISSHAREENABLED", TEST_COMPANY_ID);
+
+ assertNotNull("isShareEnabled result", result);
+ LOG.debug("isShareEnabled: " + result);
+ }
+
+ @Test
+ public void testIsViewerShareEnabled() throws Exception {
+ // using long message body for single parameter "company_id"
+ final org.apache.camel.component.linkedin.api.model.IsCompanyShareEnabled result = requestBody("direct://ISVIEWERSHAREENABLED", TEST_COMPANY_ID);
+
+ assertNotNull("isViewerShareEnabled result", result);
+ LOG.debug("isViewerShareEnabled: " + result);
+ }
+
+ // TODO provide parameter values for likeCompanyUpdate
+ @Ignore
+ @Test
+ public void testLikeCompanyUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.company_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.IsLiked
+ headers.put("CamelLinkedIn.isliked", null);
+
+ requestBodyAndHeaders("direct://LIKECOMPANYUPDATE", null, headers);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for addCompanyUpdateComment
+ from("direct://ADDCOMPANYUPDATECOMMENT")
+ .to("linkedin://" + PATH_PREFIX + "/addCompanyUpdateComment");
+
+ // test route for addCompanyUpdateCommentAsCompany
+ from("direct://ADDCOMPANYUPDATECOMMENTASCOMPANY")
+ .to("linkedin://" + PATH_PREFIX + "/addCompanyUpdateCommentAsCompany");
+
+ // test route for addShare
+ from("direct://ADDSHARE")
+ .to("linkedin://" + PATH_PREFIX + "/addShare");
+
+ // test route for getCompanies
+ from("direct://GETCOMPANIES")
+ .to("linkedin://" + PATH_PREFIX + "/getCompanies");
+
+ // test route for getCompanyById
+ from("direct://GETCOMPANYBYID")
+ .to("linkedin://" + PATH_PREFIX + "/getCompanyById");
+
+ // test route for getCompanyByName
+ from("direct://GETCOMPANYBYNAME")
+ .to("linkedin://" + PATH_PREFIX + "/getCompanyByName");
+
+ // test route for getCompanyUpdateComments
+ from("direct://GETCOMPANYUPDATECOMMENTS")
+ .to("linkedin://" + PATH_PREFIX + "/getCompanyUpdateComments");
+
+ // test route for getCompanyUpdateLikes
+ from("direct://GETCOMPANYUPDATELIKES")
+ .to("linkedin://" + PATH_PREFIX + "/getCompanyUpdateLikes");
+
+ // test route for getCompanyUpdates
+ from("direct://GETCOMPANYUPDATES")
+ .to("linkedin://" + PATH_PREFIX + "/getCompanyUpdates");
+
+ // test route for getHistoricalFollowStatistics
+ from("direct://GETHISTORICALFOLLOWSTATISTICS")
+ .to("linkedin://" + PATH_PREFIX + "/getHistoricalFollowStatistics");
+
+ // test route for getHistoricalStatusUpdateStatistics
+ from("direct://GETHISTORICALSTATUSUPDATESTATISTICS")
+ .to("linkedin://" + PATH_PREFIX + "/getHistoricalStatusUpdateStatistics");
+
+ // test route for getNumberOfFollowers
+ from("direct://GETNUMBEROFFOLLOWERS")
+ .to("linkedin://" + PATH_PREFIX + "/getNumberOfFollowers");
+
+ // test route for getStatistics
+ from("direct://GETSTATISTICS")
+ .to("linkedin://" + PATH_PREFIX + "/getStatistics?inBody=company_id");
+
+ // test route for isShareEnabled
+ from("direct://ISSHAREENABLED")
+ .to("linkedin://" + PATH_PREFIX + "/isShareEnabled?inBody=company_id");
+
+ // test route for isViewerShareEnabled
+ from("direct://ISVIEWERSHAREENABLED")
+ .to("linkedin://" + PATH_PREFIX + "/isViewerShareEnabled?inBody=company_id");
+
+ // test route for likeCompanyUpdate
+ from("direct://LIKECOMPANYUPDATE")
+ .to("linkedin://" + PATH_PREFIX + "/likeCompanyUpdate");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/GroupsResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/GroupsResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/GroupsResourceIntegrationTest.java
new file mode 100644
index 0000000..0c7ab84
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/GroupsResourceIntegrationTest.java
@@ -0,0 +1,65 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Wed Jul 09 19:57:10 PDT 2014
+ */
+package org.apache.camel.component.linkedin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.GroupsResourceApiMethod;
+
+/**
+ * Test class for {@link org.apache.camel.component.linkedin.api.GroupsResource} APIs.
+ */
+public class GroupsResourceIntegrationTest extends AbstractLinkedInTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GroupsResourceIntegrationTest.class);
+ private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(GroupsResourceApiMethod.class).getName();
+
+ // TODO provide parameter values for addPost
+ @Ignore
+ @Test
+ public void testAddPost() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.group_id", 0L);
+ // parameter type is org.apache.camel.component.linkedin.api.model.Post
+ headers.put("CamelLinkedIn.post", null);
+
+ requestBodyAndHeaders("direct://ADDPOST", null, headers);
+ }
+
+ // TODO provide parameter values for getGroup
+ @Ignore
+ @Test
+ public void testGetGroup() throws Exception {
+ // using long message body for single parameter "group_id"
+ final org.apache.camel.component.linkedin.api.model.Group result = requestBody("direct://GETGROUP", 0L);
+
+ assertNotNull("getGroup result", result);
+ LOG.debug("getGroup: " + result);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for addPost
+ from("direct://ADDPOST")
+ .to("linkedin://" + PATH_PREFIX + "/addPost");
+
+ // test route for getGroup
+ from("direct://GETGROUP")
+ .to("linkedin://" + PATH_PREFIX + "/getGroup?inBody=group_id");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/JobsResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/JobsResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/JobsResourceIntegrationTest.java
new file mode 100644
index 0000000..43cf3c0
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/JobsResourceIntegrationTest.java
@@ -0,0 +1,93 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Wed Jul 09 19:57:11 PDT 2014
+ */
+package org.apache.camel.component.linkedin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.JobsResourceApiMethod;
+
+/**
+ * Test class for {@link org.apache.camel.component.linkedin.api.JobsResource} APIs.
+ */
+public class JobsResourceIntegrationTest extends AbstractLinkedInTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JobsResourceIntegrationTest.class);
+ private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(JobsResourceApiMethod.class).getName();
+
+ // TODO provide parameter values for addJob
+ @Ignore
+ @Test
+ public void testAddJob() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.Job message body for single parameter "job"
+ requestBody("direct://ADDJOB", null);
+ }
+
+ // TODO provide parameter values for editJob
+ @Ignore
+ @Test
+ public void testEditJob() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.partner_job_id", 0L);
+ // parameter type is org.apache.camel.component.linkedin.api.model.Job
+ headers.put("CamelLinkedIn.job", null);
+
+ requestBodyAndHeaders("direct://EDITJOB", null, headers);
+ }
+
+ // TODO provide parameter values for getJob
+ @Ignore
+ @Test
+ public void testGetJob() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.job_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+
+ final org.apache.camel.component.linkedin.api.model.Job result = requestBodyAndHeaders("direct://GETJOB", null, headers);
+
+ assertNotNull("getJob result", result);
+ LOG.debug("getJob: " + result);
+ }
+
+ // TODO provide parameter values for removeJob
+ @Ignore
+ @Test
+ public void testRemoveJob() throws Exception {
+ // using long message body for single parameter "partner_job_id"
+ requestBody("direct://REMOVEJOB", 0L);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for addJob
+ from("direct://ADDJOB")
+ .to("linkedin://" + PATH_PREFIX + "/addJob?inBody=job");
+
+ // test route for editJob
+ from("direct://EDITJOB")
+ .to("linkedin://" + PATH_PREFIX + "/editJob");
+
+ // test route for getJob
+ from("direct://GETJOB")
+ .to("linkedin://" + PATH_PREFIX + "/getJob");
+
+ // test route for removeJob
+ from("direct://REMOVEJOB")
+ .to("linkedin://" + PATH_PREFIX + "/removeJob?inBody=partner_job_id");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PeopleResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PeopleResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PeopleResourceIntegrationTest.java
new file mode 100644
index 0000000..53567cf
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PeopleResourceIntegrationTest.java
@@ -0,0 +1,636 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Wed Jul 09 19:57:11 PDT 2014
+ */
+package org.apache.camel.component.linkedin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.linkedin.api.model.Person;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.PeopleResourceApiMethod;
+
+/**
+ * Test class for {@link org.apache.camel.component.linkedin.api.PeopleResource} APIs.
+ */
+public class PeopleResourceIntegrationTest extends AbstractLinkedInTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PeopleResourceIntegrationTest.class);
+ private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(PeopleResourceApiMethod.class).getName();
+
+ // TODO provide parameter values for addActivity
+ @Ignore
+ @Test
+ public void testAddActivity() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.Activity message body for single parameter "activity"
+ requestBody("direct://ADDACTIVITY", null);
+ }
+
+ // TODO provide parameter values for addGroupMembership
+ @Ignore
+ @Test
+ public void testAddGroupMembership() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.GroupMembership message body for single parameter "groupmembership"
+ requestBody("direct://ADDGROUPMEMBERSHIP", null);
+ }
+
+ // TODO provide parameter values for addInvite
+ @Ignore
+ @Test
+ public void testAddInvite() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.MailboxItem message body for single parameter "mailboxitem"
+ requestBody("direct://ADDINVITE", null);
+ }
+
+ // TODO provide parameter values for addJobBookmark
+ @Ignore
+ @Test
+ public void testAddJobBookmark() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.JobBookmark message body for single parameter "jobbookmark"
+ requestBody("direct://ADDJOBBOOKMARK", null);
+ }
+
+ // TODO provide parameter values for addUpdateComment
+ @Ignore
+ @Test
+ public void testAddUpdateComment() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.UpdateComment
+ headers.put("CamelLinkedIn.updatecomment", null);
+
+ requestBodyAndHeaders("direct://ADDUPDATECOMMENT", null, headers);
+ }
+
+ // TODO provide parameter values for followCompany
+ @Ignore
+ @Test
+ public void testFollowCompany() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.Company message body for single parameter "company"
+ requestBody("direct://FOLLOWCOMPANY", null);
+ }
+
+ @Test
+ public void testGetConnections() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // use defaults
+/*
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+*/
+
+ final org.apache.camel.component.linkedin.api.model.Connections result = requestBodyAndHeaders("direct://GETCONNECTIONS", null, headers);
+
+ assertNotNull("getConnections result", result);
+ LOG.debug("getConnections: " + result);
+ }
+
+ // TODO provide parameter values for getConnectionsById
+ @Ignore
+ @Test
+ public void testGetConnectionsById() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.person_id", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Connections result = requestBodyAndHeaders("direct://GETCONNECTIONSBYID", null, headers);
+
+ assertNotNull("getConnectionsById result", result);
+ LOG.debug("getConnectionsById: " + result);
+ }
+
+ // TODO provide parameter values for getConnectionsByUrl
+ @Ignore
+ @Test
+ public void testGetConnectionsByUrl() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.public_profile_url", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Connections result = requestBodyAndHeaders("direct://GETCONNECTIONSBYURL", null, headers);
+
+ assertNotNull("getConnectionsByUrl result", result);
+ LOG.debug("getConnectionsByUrl: " + result);
+ }
+
+ @Test
+ public void testGetFollowedCompanies() throws Exception {
+ // using String message body for single parameter "fields"
+ final org.apache.camel.component.linkedin.api.model.Companies result = requestBody("direct://GETFOLLOWEDCOMPANIES", "");
+
+ assertNotNull("getFollowedCompanies result", result);
+ LOG.debug("getFollowedCompanies: " + result);
+ }
+
+ // TODO provide parameter values for getGroupMembershipSettings
+ @Ignore
+ @Test
+ public void testGetGroupMembershipSettings() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.group_id", 0L);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+
+ final org.apache.camel.component.linkedin.api.model.GroupMemberships result = requestBodyAndHeaders("direct://GETGROUPMEMBERSHIPSETTINGS", null, headers);
+
+ assertNotNull("getGroupMembershipSettings result", result);
+ LOG.debug("getGroupMembershipSettings: " + result);
+ }
+
+ @Test
+ public void testGetGroupMemberships() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // use defaults
+/*
+ // parameter type is org.apache.camel.component.linkedin.api.model.MembershipState
+ headers.put("CamelLinkedIn.membership_state", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+*/
+
+ final org.apache.camel.component.linkedin.api.model.GroupMemberships result = requestBodyAndHeaders("direct://GETGROUPMEMBERSHIPS", null, headers);
+
+ assertNotNull("getGroupMemberships result", result);
+ LOG.debug("getGroupMemberships: " + result);
+ }
+
+ @Test
+ public void testGetJobBookmarks() throws Exception {
+ final org.apache.camel.component.linkedin.api.model.JobBookmarks result = requestBody("direct://GETJOBBOOKMARKS", null);
+
+ assertNotNull("getJobBookmarks result", result);
+ LOG.debug("getJobBookmarks: " + result);
+ }
+
+ @Test
+ public void testGetNetworkStats() throws Exception {
+ final org.apache.camel.component.linkedin.api.model.NetworkStats result = requestBody("direct://GETNETWORKSTATS", null);
+
+ assertNotNull("getNetworkStats result", result);
+ LOG.debug("getNetworkStats: " + result);
+ }
+
+ @Test
+ public void testGetNetworkUpdates() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // use defaults
+/*
+ // parameter type is String
+ headers.put("CamelLinkedIn.scope", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Type
+ headers.put("CamelLinkedIn.type", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.after", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.before", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.show_hidden_members", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+*/
+
+ final org.apache.camel.component.linkedin.api.model.Updates result = requestBodyAndHeaders("direct://GETNETWORKUPDATES", null, headers);
+
+ assertNotNull("getNetworkUpdates result", result);
+ LOG.debug("getNetworkUpdates: " + result);
+ }
+
+ // TODO provide parameter values for getNetworkUpdatesById
+ @Ignore
+ @Test
+ public void testGetNetworkUpdatesById() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.scope", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Type
+ headers.put("CamelLinkedIn.type", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.after", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.before", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.show_hidden_members", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.person_id", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Updates result = requestBodyAndHeaders("direct://GETNETWORKUPDATESBYID", null, headers);
+
+ assertNotNull("getNetworkUpdatesById result", result);
+ LOG.debug("getNetworkUpdatesById: " + result);
+ }
+
+ @Test
+ public void testGetPerson() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", "");
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", true);
+
+ final Person result = requestBodyAndHeaders("direct://GETPERSON", null, headers);
+
+ assertNotNull("getPerson result", result);
+ LOG.debug("getPerson: " + result);
+ }
+
+ // TODO provide parameter values for getPersonById
+ @Ignore
+ @Test
+ public void testGetPersonById() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.person_id", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final Person result = requestBodyAndHeaders("direct://GETPERSONBYID", null, headers);
+
+ assertNotNull("getPersonById result", result);
+ LOG.debug("getPersonById: " + result);
+ }
+
+ // TODO provide parameter values for getPersonByUrl
+ @Ignore
+ @Test
+ public void testGetPersonByUrl() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.public_profile_url", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final Person result = requestBodyAndHeaders("direct://GETPERSONBYURL", null, headers);
+
+ assertNotNull("getPersonByUrl result", result);
+ LOG.debug("getPersonByUrl: " + result);
+ }
+
+ // TODO provide parameter values for getPosts
+ @Ignore
+ @Test
+ public void testGetPosts() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.group_id", 0L);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Order
+ headers.put("CamelLinkedIn.order", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Role
+ headers.put("CamelLinkedIn.role", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Category
+ headers.put("CamelLinkedIn.category", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.modified_since", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+
+ final org.apache.camel.component.linkedin.api.model.Posts result = requestBodyAndHeaders("direct://GETPOSTS", null, headers);
+
+ assertNotNull("getPosts result", result);
+ LOG.debug("getPosts: " + result);
+ }
+
+ @Test
+ public void testGetSuggestedCompanies() throws Exception {
+ // using String message body for single parameter "fields"
+ final org.apache.camel.component.linkedin.api.model.Companies result = requestBody("direct://GETSUGGESTEDCOMPANIES", "");
+
+ assertNotNull("getSuggestedCompanies result", result);
+ LOG.debug("getSuggestedCompanies: " + result);
+ }
+
+ // TODO provide parameter values for getSuggestedGroupPosts
+ @Ignore
+ @Test
+ public void testGetSuggestedGroupPosts() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.group_id", 0L);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Order
+ headers.put("CamelLinkedIn.order", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Role
+ headers.put("CamelLinkedIn.role", null);
+ // parameter type is org.apache.camel.component.linkedin.api.Category
+ headers.put("CamelLinkedIn.category", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.modified_since", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+
+ final org.apache.camel.component.linkedin.api.model.Posts result = requestBodyAndHeaders("direct://GETSUGGESTEDGROUPPOSTS", null, headers);
+
+ assertNotNull("getSuggestedGroupPosts result", result);
+ LOG.debug("getSuggestedGroupPosts: " + result);
+ }
+
+ @Test
+ public void testGetSuggestedGroups() throws Exception {
+ // using String message body for single parameter "fields"
+ final org.apache.camel.component.linkedin.api.model.Groups result = requestBody("direct://GETSUGGESTEDGROUPS", "");
+
+ assertNotNull("getSuggestedGroups result", result);
+ LOG.debug("getSuggestedGroups: " + result);
+ }
+
+ @Test
+ public void testGetSuggestedJobs() throws Exception {
+ // using String message body for single parameter "fields"
+ final org.apache.camel.component.linkedin.api.model.JobSuggestions result = requestBody("direct://GETSUGGESTEDJOBS", "");
+
+ assertNotNull("getSuggestedJobs result", result);
+ LOG.debug("getSuggestedJobs: " + result);
+ }
+
+ // TODO provide parameter values for getUpdateComments
+ @Ignore
+ @Test
+ public void testGetUpdateComments() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Comments result = requestBodyAndHeaders("direct://GETUPDATECOMMENTS", null, headers);
+
+ assertNotNull("getUpdateComments result", result);
+ LOG.debug("getUpdateComments: " + result);
+ }
+
+ // TODO provide parameter values for getUpdateLikes
+ @Ignore
+ @Test
+ public void testGetUpdateLikes() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+ // parameter type is Boolean
+ headers.put("CamelLinkedIn.secure_urls", null);
+
+ final org.apache.camel.component.linkedin.api.model.Likes result = requestBodyAndHeaders("direct://GETUPDATELIKES", null, headers);
+
+ assertNotNull("getUpdateLikes result", result);
+ LOG.debug("getUpdateLikes: " + result);
+ }
+
+ // TODO provide parameter values for likeUpdate
+ @Ignore
+ @Test
+ public void testLikeUpdate() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.update_key", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.IsLiked
+ headers.put("CamelLinkedIn.isliked", null);
+
+ requestBodyAndHeaders("direct://LIKEUPDATE", null, headers);
+ }
+
+ // TODO provide parameter values for removeGroupMembership
+ @Ignore
+ @Test
+ public void testRemoveGroupMembership() throws Exception {
+ // using long message body for single parameter "group_id"
+ requestBody("direct://REMOVEGROUPMEMBERSHIP", 0L);
+ }
+
+ // TODO provide parameter values for removeGroupSuggestion
+ @Ignore
+ @Test
+ public void testRemoveGroupSuggestion() throws Exception {
+ // using long message body for single parameter "group_id"
+ requestBody("direct://REMOVEGROUPSUGGESTION", 0L);
+ }
+
+ // TODO provide parameter values for removeJobBookmark
+ @Ignore
+ @Test
+ public void testRemoveJobBookmark() throws Exception {
+ // using long message body for single parameter "job_id"
+ requestBody("direct://REMOVEJOBBOOKMARK", 0L);
+ }
+
+ // TODO provide parameter values for share
+ @Ignore
+ @Test
+ public void testShare() throws Exception {
+ // using org.apache.camel.component.linkedin.api.model.Share message body for single parameter "share"
+ final org.apache.camel.component.linkedin.api.model.Update result = requestBody("direct://SHARE", null);
+
+ assertNotNull("share result", result);
+ LOG.debug("share: " + result);
+ }
+
+ // TODO provide parameter values for stopFollowingCompany
+ @Ignore
+ @Test
+ public void testStopFollowingCompany() throws Exception {
+ // using long message body for single parameter "company_id"
+ requestBody("direct://STOPFOLLOWINGCOMPANY", 0L);
+ }
+
+ // TODO provide parameter values for updateGroupMembership
+ @Ignore
+ @Test
+ public void testUpdateGroupMembership() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ headers.put("CamelLinkedIn.group_id", 0L);
+ // parameter type is org.apache.camel.component.linkedin.api.model.GroupMembership
+ headers.put("CamelLinkedIn.groupmembership", null);
+
+ requestBodyAndHeaders("direct://UPDATEGROUPMEMBERSHIP", null, headers);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for addActivity
+ from("direct://ADDACTIVITY")
+ .to("linkedin://" + PATH_PREFIX + "/addActivity?inBody=activity");
+
+ // test route for addGroupMembership
+ from("direct://ADDGROUPMEMBERSHIP")
+ .to("linkedin://" + PATH_PREFIX + "/addGroupMembership?inBody=groupmembership");
+
+ // test route for addInvite
+ from("direct://ADDINVITE")
+ .to("linkedin://" + PATH_PREFIX + "/addInvite?inBody=mailboxitem");
+
+ // test route for addJobBookmark
+ from("direct://ADDJOBBOOKMARK")
+ .to("linkedin://" + PATH_PREFIX + "/addJobBookmark?inBody=jobbookmark");
+
+ // test route for addUpdateComment
+ from("direct://ADDUPDATECOMMENT")
+ .to("linkedin://" + PATH_PREFIX + "/addUpdateComment");
+
+ // test route for followCompany
+ from("direct://FOLLOWCOMPANY")
+ .to("linkedin://" + PATH_PREFIX + "/followCompany?inBody=company");
+
+ // test route for getConnections
+ from("direct://GETCONNECTIONS")
+ .to("linkedin://" + PATH_PREFIX + "/getConnections");
+
+ // test route for getConnectionsById
+ from("direct://GETCONNECTIONSBYID")
+ .to("linkedin://" + PATH_PREFIX + "/getConnectionsById");
+
+ // test route for getConnectionsByUrl
+ from("direct://GETCONNECTIONSBYURL")
+ .to("linkedin://" + PATH_PREFIX + "/getConnectionsByUrl");
+
+ // test route for getFollowedCompanies
+ from("direct://GETFOLLOWEDCOMPANIES")
+ .to("linkedin://" + PATH_PREFIX + "/getFollowedCompanies?inBody=fields");
+
+ // test route for getGroupMembershipSettings
+ from("direct://GETGROUPMEMBERSHIPSETTINGS")
+ .to("linkedin://" + PATH_PREFIX + "/getGroupMembershipSettings");
+
+ // test route for getGroupMemberships
+ from("direct://GETGROUPMEMBERSHIPS")
+ .to("linkedin://" + PATH_PREFIX + "/getGroupMemberships");
+
+ // test route for getJobBookmarks
+ from("direct://GETJOBBOOKMARKS")
+ .to("linkedin://" + PATH_PREFIX + "/getJobBookmarks");
+
+ // test route for getNetworkStats
+ from("direct://GETNETWORKSTATS")
+ .to("linkedin://" + PATH_PREFIX + "/getNetworkStats");
+
+ // test route for getNetworkUpdates
+ from("direct://GETNETWORKUPDATES")
+ .to("linkedin://" + PATH_PREFIX + "/getNetworkUpdates");
+
+ // test route for getNetworkUpdatesById
+ from("direct://GETNETWORKUPDATESBYID")
+ .to("linkedin://" + PATH_PREFIX + "/getNetworkUpdatesById");
+
+ // test route for getPerson
+ from("direct://GETPERSON")
+ .to("linkedin://" + PATH_PREFIX + "/getPerson");
+
+ // test route for getPersonById
+ from("direct://GETPERSONBYID")
+ .to("linkedin://" + PATH_PREFIX + "/getPersonById");
+
+ // test route for getPersonByUrl
+ from("direct://GETPERSONBYURL")
+ .to("linkedin://" + PATH_PREFIX + "/getPersonByUrl");
+
+ // test route for getPosts
+ from("direct://GETPOSTS")
+ .to("linkedin://" + PATH_PREFIX + "/getPosts");
+
+ // test route for getSuggestedCompanies
+ from("direct://GETSUGGESTEDCOMPANIES")
+ .to("linkedin://" + PATH_PREFIX + "/getSuggestedCompanies?inBody=fields");
+
+ // test route for getSuggestedGroupPosts
+ from("direct://GETSUGGESTEDGROUPPOSTS")
+ .to("linkedin://" + PATH_PREFIX + "/getSuggestedGroupPosts");
+
+ // test route for getSuggestedGroups
+ from("direct://GETSUGGESTEDGROUPS")
+ .to("linkedin://" + PATH_PREFIX + "/getSuggestedGroups?inBody=fields");
+
+ // test route for getSuggestedJobs
+ from("direct://GETSUGGESTEDJOBS")
+ .to("linkedin://" + PATH_PREFIX + "/getSuggestedJobs?inBody=fields");
+
+ // test route for getUpdateComments
+ from("direct://GETUPDATECOMMENTS")
+ .to("linkedin://" + PATH_PREFIX + "/getUpdateComments");
+
+ // test route for getUpdateLikes
+ from("direct://GETUPDATELIKES")
+ .to("linkedin://" + PATH_PREFIX + "/getUpdateLikes");
+
+ // test route for likeUpdate
+ from("direct://LIKEUPDATE")
+ .to("linkedin://" + PATH_PREFIX + "/likeUpdate");
+
+ // test route for removeGroupMembership
+ from("direct://REMOVEGROUPMEMBERSHIP")
+ .to("linkedin://" + PATH_PREFIX + "/removeGroupMembership?inBody=group_id");
+
+ // test route for removeGroupSuggestion
+ from("direct://REMOVEGROUPSUGGESTION")
+ .to("linkedin://" + PATH_PREFIX + "/removeGroupSuggestion?inBody=group_id");
+
+ // test route for removeJobBookmark
+ from("direct://REMOVEJOBBOOKMARK")
+ .to("linkedin://" + PATH_PREFIX + "/removeJobBookmark?inBody=job_id");
+
+ // test route for share
+ from("direct://SHARE")
+ .to("linkedin://" + PATH_PREFIX + "/share?inBody=share");
+
+ // test route for stopFollowingCompany
+ from("direct://STOPFOLLOWINGCOMPANY")
+ .to("linkedin://" + PATH_PREFIX + "/stopFollowingCompany?inBody=company_id");
+
+ // test route for updateGroupMembership
+ from("direct://UPDATEGROUPMEMBERSHIP")
+ .to("linkedin://" + PATH_PREFIX + "/updateGroupMembership");
+
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/b35c335c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PostsResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PostsResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PostsResourceIntegrationTest.java
new file mode 100644
index 0000000..5f79673
--- /dev/null
+++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/PostsResourceIntegrationTest.java
@@ -0,0 +1,162 @@
+/*
+ * Camel Api Route test generated by camel-component-util-maven-plugin
+ * Generated on: Wed Jul 09 19:57:11 PDT 2014
+ */
+package org.apache.camel.component.linkedin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.camel.component.linkedin.internal.LinkedInApiCollection;
+import org.apache.camel.component.linkedin.internal.PostsResourceApiMethod;
+
+/**
+ * Test class for {@link org.apache.camel.component.linkedin.api.PostsResource} APIs.
+ */
+public class PostsResourceIntegrationTest extends AbstractLinkedInTestSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PostsResourceIntegrationTest.class);
+ private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(PostsResourceApiMethod.class).getName();
+
+ // TODO provide parameter values for addComment
+ @Ignore
+ @Test
+ public void testAddComment() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.post_id", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.Comment
+ headers.put("CamelLinkedIn.comment", null);
+
+ requestBodyAndHeaders("direct://ADDCOMMENT", null, headers);
+ }
+
+ // TODO provide parameter values for flagCategory
+ @Ignore
+ @Test
+ public void testFlagCategory() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.post_id", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.PostCategoryCode
+ headers.put("CamelLinkedIn.postcategorycode", null);
+
+ requestBodyAndHeaders("direct://FLAGCATEGORY", null, headers);
+ }
+
+ // TODO provide parameter values for followPost
+ @Ignore
+ @Test
+ public void testFollowPost() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.post_id", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.IsFollowing
+ headers.put("CamelLinkedIn.isfollowing", null);
+
+ requestBodyAndHeaders("direct://FOLLOWPOST", null, headers);
+ }
+
+ // TODO provide parameter values for getPost
+ @Ignore
+ @Test
+ public void testGetPost() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.post_id", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+
+ final org.apache.camel.component.linkedin.api.model.Post result = requestBodyAndHeaders("direct://GETPOST", null, headers);
+
+ assertNotNull("getPost result", result);
+ LOG.debug("getPost: " + result);
+ }
+
+ // TODO provide parameter values for getPostComments
+ @Ignore
+ @Test
+ public void testGetPostComments() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.post_id", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.count", null);
+ // parameter type is Long
+ headers.put("CamelLinkedIn.start", null);
+ // parameter type is String
+ headers.put("CamelLinkedIn.fields", null);
+
+ final org.apache.camel.component.linkedin.api.model.Comments result = requestBodyAndHeaders("direct://GETPOSTCOMMENTS", null, headers);
+
+ assertNotNull("getPostComments result", result);
+ LOG.debug("getPostComments: " + result);
+ }
+
+ // TODO provide parameter values for likePost
+ @Ignore
+ @Test
+ public void testLikePost() throws Exception {
+ final Map<String, Object> headers = new HashMap<String, Object>();
+ // parameter type is String
+ headers.put("CamelLinkedIn.post_id", null);
+ // parameter type is org.apache.camel.component.linkedin.api.model.IsLiked
+ headers.put("CamelLinkedIn.isliked", null);
+
+ requestBodyAndHeaders("direct://LIKEPOST", null, headers);
+ }
+
+ // TODO provide parameter values for removePost
+ @Ignore
+ @Test
+ public void testRemovePost() throws Exception {
+ // using String message body for single parameter "post_id"
+ requestBody("direct://REMOVEPOST", null);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ // test route for addComment
+ from("direct://ADDCOMMENT")
+ .to("linkedin://" + PATH_PREFIX + "/addComment");
+
+ // test route for flagCategory
+ from("direct://FLAGCATEGORY")
+ .to("linkedin://" + PATH_PREFIX + "/flagCategory");
+
+ // test route for followPost
+ from("direct://FOLLOWPOST")
+ .to("linkedin://" + PATH_PREFIX + "/followPost");
+
+ // test route for getPost
+ from("direct://GETPOST")
+ .to("linkedin://" + PATH_PREFIX + "/getPost");
+
+ // test route for getPostComments
+ from("direct://GETPOSTCOMMENTS")
+ .to("linkedin://" + PATH_PREFIX + "/getPostComments");
+
+ // test route for likePost
+ from("direct://LIKEPOST")
+ .to("linkedin://" + PATH_PREFIX + "/likePost");
+
+ // test route for removePost
+ from("direct://REMOVEPOST")
+ .to("linkedin://" + PATH_PREFIX + "/removePost?inBody=post_id");
+
+ }
+ };
+ }
+}