http://git-wip-us.apache.org/repos/asf/camel/blob/b490a90c/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/SearchResourceIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/SearchResourceIntegrationTest.java b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/SearchResourceIntegrationTest.java new file mode 100644 index 0000000..d3c9e5f --- /dev/null +++ b/components/camel-linkedin/camel-linkedin-component/src/test/java/org/apache/camel/component/linkedin/SearchResourceIntegrationTest.java @@ -0,0 +1,161 @@ +/* + * 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.SearchResourceApiMethod; + +/** + * Test class for {@link org.apache.camel.component.linkedin.api.SearchResource} APIs. + */ +public class SearchResourceIntegrationTest extends AbstractLinkedInTestSupport { + + private static final Logger LOG = LoggerFactory.getLogger(SearchResourceIntegrationTest.class); + private static final String PATH_PREFIX = LinkedInApiCollection.getCollection().getApiName(SearchResourceApiMethod.class).getName(); + + @Test + public void testSearchCompanies() throws Exception { + final Map<String, Object> headers = new HashMap<String, Object>(); + // parameter type is String + headers.put("CamelLinkedIn.fields", ""); + // parameter type is String + headers.put("CamelLinkedIn.keywords", "linkedin"); + // all fields are nullable, and fields defaults to "" +/* + // parameter type is String + headers.put("CamelLinkedIn.hq_only", null); + // parameter type is String + headers.put("CamelLinkedIn.facet", null); + // parameter type is String + headers.put("CamelLinkedIn.facets", null); + // parameter type is Long + headers.put("CamelLinkedIn.start", null); + // parameter type is Long + headers.put("CamelLinkedIn.count", null); + // parameter type is String + headers.put("CamelLinkedIn.sort", null); +*/ + + final org.apache.camel.component.linkedin.api.model.CompanySearch result = requestBodyAndHeaders("direct://SEARCHCOMPANIES", null, headers); + + assertNotNull("searchCompanies result", result); + LOG.debug("searchCompanies: " + result); + } + + @Ignore("Requires vetted API Access Program") + @Test + public void testSearchJobs() throws Exception { + final Map<String, Object> headers = new HashMap<String, Object>(); + // parameter type is String + headers.put("CamelLinkedIn.fields", ""); +/* + // parameter type is String + headers.put("CamelLinkedIn.keywords", null); + // parameter type is String + headers.put("CamelLinkedIn.company_name", null); + // parameter type is String + headers.put("CamelLinkedIn.job_title", null); + // parameter type is String + headers.put("CamelLinkedIn.country_code", null); + // parameter type is String + headers.put("CamelLinkedIn.postal_code", null); + // parameter type is org.apache.camel.component.linkedin.api.model.Distance + headers.put("CamelLinkedIn.distance", null); + // parameter type is String + headers.put("CamelLinkedIn.facet", null); + // parameter type is String + headers.put("CamelLinkedIn.facets", null); + // parameter type is Long + headers.put("CamelLinkedIn.start", null); + // parameter type is Long + headers.put("CamelLinkedIn.count", null); + // parameter type is String + headers.put("CamelLinkedIn.sort", null); +*/ + + final org.apache.camel.component.linkedin.api.model.JobSearch result = requestBodyAndHeaders("direct://SEARCHJOBS", null, headers); + + assertNotNull("searchJobs result", result); + LOG.debug("searchJobs: " + result); + } + + @Ignore("Requires vetted API Access Program") + @Test + public void testSearchPeople() throws Exception { + final Map<String, Object> headers = new HashMap<String, Object>(); + // parameter type is String + headers.put("CamelLinkedIn.fields", ""); +/* + // parameter type is String + headers.put("CamelLinkedIn.keywords", null); + // parameter type is String + headers.put("CamelLinkedIn.first_name", null); + // parameter type is String + headers.put("CamelLinkedIn.last_name", null); + // parameter type is String + headers.put("CamelLinkedIn.company_name", null); + // parameter type is String + headers.put("CamelLinkedIn.current_company", null); + // parameter type is String + headers.put("CamelLinkedIn.title", null); + // parameter type is String + headers.put("CamelLinkedIn.current_title", null); + // parameter type is String + headers.put("CamelLinkedIn.school_name", null); + // parameter type is String + headers.put("CamelLinkedIn.current_school", null); + // parameter type is String + headers.put("CamelLinkedIn.country_code", null); + // parameter type is String + headers.put("CamelLinkedIn.postal_code", null); + // parameter type is org.apache.camel.component.linkedin.api.model.Distance + headers.put("CamelLinkedIn.distance", null); + // parameter type is String + headers.put("CamelLinkedIn.facet", null); + // parameter type is String + headers.put("CamelLinkedIn.facets", null); + // parameter type is Long + headers.put("CamelLinkedIn.start", null); + // parameter type is Long + headers.put("CamelLinkedIn.count", null); + // parameter type is String + headers.put("CamelLinkedIn.sort", null); +*/ + + final org.apache.camel.component.linkedin.api.model.PeopleSearch result = requestBodyAndHeaders("direct://SEARCHPEOPLE", null, headers); + + assertNotNull("searchPeople result", result); + LOG.debug("searchPeople: " + result); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + public void configure() { + // test route for searchCompanies + from("direct://SEARCHCOMPANIES") + .to("linkedin://" + PATH_PREFIX + "/searchCompanies"); + + // test route for searchJobs + from("direct://SEARCHJOBS") + .to("linkedin://" + PATH_PREFIX + "/searchJobs"); + + // test route for searchPeople + from("direct://SEARCHPEOPLE") + .to("linkedin://" + PATH_PREFIX + "/searchPeople"); + + } + }; + } +}
http://git-wip-us.apache.org/repos/asf/camel/blob/b490a90c/components/camel-linkedin/camel-linkedin-component/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/resources/log4j.properties b/components/camel-linkedin/camel-linkedin-component/src/test/resources/log4j.properties new file mode 100644 index 0000000..fb1d365 --- /dev/null +++ b/components/camel-linkedin/camel-linkedin-component/src/test/resources/log4j.properties @@ -0,0 +1,36 @@ +# +# 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. +# + +# +# The logging properties used for testing. +# +log4j.rootLogger=INFO, file + +# uncomment the following line to turn on component debug messages +#log4j.logger.org.apache.camel.component.linkedin=DEBUG + +# CONSOLE appender not used by default +log4j.appender.out=org.apache.log4j.ConsoleAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n +log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n + +# File appender +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +log4j.appender.file.file=target/camel-linkedin-test.log http://git-wip-us.apache.org/repos/asf/camel/blob/b490a90c/components/camel-linkedin/camel-linkedin-component/src/test/resources/test-options.properties ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/camel-linkedin-component/src/test/resources/test-options.properties b/components/camel-linkedin/camel-linkedin-component/src/test/resources/test-options.properties new file mode 100644 index 0000000..4bb03f0 --- /dev/null +++ b/components/camel-linkedin/camel-linkedin-component/src/test/resources/test-options.properties @@ -0,0 +1,28 @@ +# +# 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. +# +# LinkedIn user name +userName= +# LinkedIn user password +userPassword= +# LinkedIn App clientId +clientId= +# LinkedIn App clientSecret +clientSecret= +# LinkedIn App required scopes +scope=r_basicprofile,r_fullprofile,r_emailaddress,r_network,r_contactinfo,rw_nus,rw_company_admin,rw_groups,w_messages +# LinkedIn App redirect URI +redirectUri= http://git-wip-us.apache.org/repos/asf/camel/blob/b490a90c/components/camel-linkedin/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/pom.xml b/components/camel-linkedin/pom.xml new file mode 100644 index 0000000..7398fb7 --- /dev/null +++ b/components/camel-linkedin/pom.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>components</artifactId> + <groupId>org.apache.camel</groupId> + <version>2.14-SNAPSHOT</version> + </parent> + + <groupId>org.apache.camel.component.linkedin</groupId> + <artifactId>camel-linkedin-parent</artifactId> + <packaging>pom</packaging> + <version>2.14-SNAPSHOT</version> + + <name>Camel LinkedIn Component Parent</name> + <description>Parent project for Camel {LinkedIn} Component</description> + + <modules> + <module>camel-linkedin-component</module> + <module>camel-linkedin-api</module> + </modules> + + <profiles> + <profile> + <id>linkedin-test</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <childDelegation>false</childDelegation> + <useFile>true</useFile> + <forkMode>once</forkMode> + <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds> + <excludes> + <exclude>**/*XXXTest.java</exclude> + </excludes> + <includes> + <include>**/*Test.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/camel/blob/b490a90c/components/pom.xml ---------------------------------------------------------------------- diff --git a/components/pom.xml b/components/pom.xml index 0d6c971..fb2bfa9 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -128,6 +128,7 @@ <module>camel-krati</module> <module>camel-ldap</module> <module>camel-leveldb</module> + <module>camel-linkedin</module> <module>camel-lucene</module> <module>camel-mail</module> <module>camel-mina</module>