Repository: camel Updated Branches: refs/heads/master 33b5eb4d4 -> bbe35fb90
CAMEL-10402: camel-servicenow : Allow to configure credentials on ServiceNow component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bbe35fb9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bbe35fb9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bbe35fb9 Branch: refs/heads/master Commit: bbe35fb9034e386ab8ac70e59b2a0792cbc81216 Parents: 33b5eb4 Author: lburgazzoli <lburgazz...@gmail.com> Authored: Thu Oct 20 15:57:11 2016 +0200 Committer: lburgazzoli <lburgazz...@gmail.com> Committed: Thu Oct 20 15:57:32 2016 +0200 ---------------------------------------------------------------------- .../ServiceNowComponentAutoConfiguration.java | 72 +++++++++++++ .../ServiceNowComponentConfiguration.java | 102 +++++++++++++++++++ .../main/resources/META-INF/spring.factories | 19 ++++ components/camel-servicenow/pom.xml | 24 +++++ .../src/main/docs/servicenow-component.adoc | 17 +++- .../servicenow/ServiceNowComponent.java | 92 ++++++++++++++++- .../ServiceNowBlueprintComponentAuthTest.java | 67 ++++++++++++ .../ServiceNowBlueprintEndpointAuthTest.java | 61 +++++++++++ .../blueprint/blueprint-component-auth.xml | 53 ++++++++++ .../blueprint/blueprint-endpoint-auth.xml | 35 +++++++ 10 files changed, 539 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java b/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java new file mode 100644 index 0000000..5d9fde7 --- /dev/null +++ b/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java @@ -0,0 +1,72 @@ +/** + * 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.servicenow.springboot; + +import java.util.HashMap; +import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.component.servicenow.ServiceNowComponent; +import org.apache.camel.util.IntrospectionSupport; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Configuration +@EnableConfigurationProperties(ServiceNowComponentConfiguration.class) +public class ServiceNowComponentAutoConfiguration { + + @Bean(name = "servicenow-component") + @ConditionalOnClass(CamelContext.class) + @ConditionalOnMissingBean(ServiceNowComponent.class) + public ServiceNowComponent configureServiceNowComponent( + CamelContext camelContext, + ServiceNowComponentConfiguration configuration) throws Exception { + ServiceNowComponent component = new ServiceNowComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java b/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java new file mode 100644 index 0000000..e68f2a6 --- /dev/null +++ b/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java @@ -0,0 +1,102 @@ +/** + * 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.servicenow.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The servicenow component is used to integrate Camel with ServiceNow cloud + * services. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.servicenow") +public class ServiceNowComponentConfiguration { + + /** + * The ServiceNow REST API url + */ + private String apiUrl; + /** + * ServiceNow user account name MUST be provided + */ + private String userName; + /** + * ServiceNow account password MUST be provided + */ + private String password; + /** + * OAuth2 ClientID + */ + private String oauthClientId; + /** + * OAuth2 ClientSecret + */ + private String oauthClientSecret; + /** + * OAuth token Url + */ + private String oauthTokenUrl; + + public String getApiUrl() { + return apiUrl; + } + + public void setApiUrl(String apiUrl) { + this.apiUrl = apiUrl; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getOauthClientId() { + return oauthClientId; + } + + public void setOauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + } + + public String getOauthClientSecret() { + return oauthClientSecret; + } + + public void setOauthClientSecret(String oauthClientSecret) { + this.oauthClientSecret = oauthClientSecret; + } + + public String getOauthTokenUrl() { + return oauthTokenUrl; + } + + public void setOauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories b/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..ff19d5a --- /dev/null +++ b/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories @@ -0,0 +1,19 @@ +# +# 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. +# + +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.servicenow.springboot.ServiceNowComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/pom.xml b/components/camel-servicenow/pom.xml index 1bfcd7a..e7dbcc3 100644 --- a/components/camel-servicenow/pom.xml +++ b/components/camel-servicenow/pom.xml @@ -96,11 +96,30 @@ </dependency> <!-- testing --> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>${javax.servlet-api-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${osgi-version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-blueprint</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> @@ -161,6 +180,11 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>false</skipTests> + <systemPropertyVariables> + <servicenow.instance>${env.SERVICENOW_INSTANCE}</servicenow.instance> + <servicenow.username>${env.SERVICENOW_USERNAME}</servicenow.username> + <servicenow.password>${env.SERVICENOW_PASSWORD}</servicenow.password> + </systemPropertyVariables> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/src/main/docs/servicenow-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/src/main/docs/servicenow-component.adoc b/components/camel-servicenow/src/main/docs/servicenow-component.adoc index 5869258..301c55a 100644 --- a/components/camel-servicenow/src/main/docs/servicenow-component.adoc +++ b/components/camel-servicenow/src/main/docs/servicenow-component.adoc @@ -36,7 +36,22 @@ Options // component options: START -The ServiceNow component has no options. +The ServiceNow component supports 6 options which are listed below. + + + +{% raw %} +[width="100%",cols="2,1m,7",options="header"] +|======================================================================= +| Name | Java Type | Description +| apiUrl | String | The ServiceNow REST API url +| userName | String | ServiceNow user account name MUST be provided +| password | String | ServiceNow account password MUST be provided +| oauthClientId | String | OAuth2 ClientID +| oauthClientSecret | String | OAuth2 ClientSecret +| oauthTokenUrl | String | OAuth token Url +|======================================================================= +{% endraw %} // component options: END http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java b/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java index db0c6f9..b69991f 100644 --- a/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java +++ b/components/camel-servicenow/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java @@ -29,6 +29,13 @@ import org.apache.camel.util.IntrospectionSupport; */ public class ServiceNowComponent extends UriEndpointComponent { + private String userName; + private String password; + private String oauthClientId; + private String oauthClientSecret; + private String oauthTokenUrl; + private String apiUrl; + public ServiceNowComponent() { super(ServiceNowEndpoint.class); } @@ -47,14 +54,95 @@ public class ServiceNowComponent extends UriEndpointComponent { setProperties(configuration, parameters); + if (configuration.getUserName() == null) { + configuration.setUserName(userName); + } + if (configuration.getPassword() == null) { + configuration.setPassword(password); + } + if (configuration.getOauthClientId() == null) { + configuration.setOauthClientId(oauthClientId); + } + if (configuration.getOauthClientSecret() == null) { + configuration.setOauthClientSecret(oauthClientSecret); + } + String instanceName = getCamelContext().resolvePropertyPlaceholders(remaining); if (!configuration.hasApiUrl()) { - configuration.setApiUrl(String.format("https://%s.service-now.com/api", instanceName)); + configuration.setApiUrl(apiUrl != null + ? apiUrl + : String.format("https://%s.service-now.com/api", instanceName) + ); } if (!configuration.hasOautTokenUrl()) { - configuration.setOauthTokenUrl(String.format("https://%s.service-now.com/oauth_token.do", instanceName)); + configuration.setOauthTokenUrl(oauthTokenUrl != null + ? oauthTokenUrl + : String.format("https://%s.service-now.com/oauth_token.do", instanceName) + ); } return new ServiceNowEndpoint(uri, this, configuration, instanceName); } + + public String getApiUrl() { + return apiUrl; + } + + /** + * The ServiceNow REST API url + */ + public void setApiUrl(String apiUrl) { + this.apiUrl = apiUrl; + } + + public String getUserName() { + return userName; + } + + /** + * ServiceNow user account name, MUST be provided + */ + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + /** + * ServiceNow account password, MUST be provided + */ + public void setPassword(String password) { + this.password = password; + } + + public String getOauthClientId() { + return oauthClientId; + } + + /** + * OAuth2 ClientID + */ + public void setOauthClientId(String oauthClientId) { + this.oauthClientId = oauthClientId; + } + + /** + * OAuth2 ClientSecret + */ + public void setOauthClientSecret(String oauthClientSecret) { + this.oauthClientSecret = oauthClientSecret; + } + + public String getOauthTokenUrl() { + return oauthTokenUrl; + } + + /** + * OAuth token Url + */ + public void setOauthTokenUrl(String oauthTokenUrl) { + this.oauthTokenUrl = oauthTokenUrl; + } } http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java new file mode 100644 index 0000000..941ec9e --- /dev/null +++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintComponentAuthTest.java @@ -0,0 +1,67 @@ +/** + * 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.servicenow; + +import java.util.List; + +import org.apache.camel.Exchange; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.servicenow.model.Incident; +import org.apache.camel.test.blueprint.CamelBlueprintTestSupport; +import org.junit.Test; + +public class ServiceNowBlueprintComponentAuthTest extends CamelBlueprintTestSupport { + @Override + protected String getBlueprintDescriptor() { + return "OSGI-INF/blueprint/blueprint-component-auth.xml"; + } + + @Test + public void testAuth() throws Exception { + MockEndpoint mock1 = getMockEndpoint("mock:servicenow-1"); + mock1.expectedMessageCount(1); + MockEndpoint mock2 = getMockEndpoint("mock:servicenow-2"); + mock2.expectedMessageCount(1); + + template().sendBodyAndHeaders( + "direct:servicenow", + null, + new ServiceNowTestSupport.KVBuilder() + .put(ServiceNowConstants.RESOURCE, "table") + .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE) + .put(ServiceNowParams.SYSPARM_LIMIT, 10) + .put(ServiceNowParams.PARAM_TABLE_NAME, "incident") + .build() + ); + + mock1.assertIsSatisfied(); + mock2.assertIsSatisfied(); + + validate(mock1.getExchanges().get(0)); + validate(mock2.getExchanges().get(0)); + } + + private void validate(Exchange exchange) { + List<Incident> items = exchange.getIn().getBody(List.class); + + assertNotNull(items); + assertTrue(items.size() <= 10); + assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_FIRST)); + assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_NEXT)); + assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_LAST)); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java new file mode 100644 index 0000000..dd4ad36 --- /dev/null +++ b/components/camel-servicenow/src/test/java/org/apache/camel/component/servicenow/ServiceNowBlueprintEndpointAuthTest.java @@ -0,0 +1,61 @@ +/** + * 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.servicenow; + +import java.util.List; + +import org.apache.camel.Exchange; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.servicenow.model.Incident; +import org.apache.camel.test.blueprint.CamelBlueprintTestSupport; +import org.junit.Test; + +public class ServiceNowBlueprintEndpointAuthTest extends CamelBlueprintTestSupport { + @Override + protected String getBlueprintDescriptor() { + return "OSGI-INF/blueprint/blueprint-endpoint-auth.xml"; + } + + @Test + public void testAuth() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:servicenow"); + mock.expectedMessageCount(1); + + template().sendBodyAndHeaders( + "direct:servicenow", + null, + new ServiceNowTestSupport.KVBuilder() + .put(ServiceNowConstants.RESOURCE, "table") + .put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_RETRIEVE) + .put(ServiceNowParams.SYSPARM_LIMIT, 10) + .put(ServiceNowParams.PARAM_TABLE_NAME, "incident") + .build() + ); + + mock.assertIsSatisfied(); + + Exchange exchange = mock.getExchanges().get(0); + List<Incident> items = exchange.getIn().getBody(List.class); + + assertNotNull(items); + assertTrue(items.size() <= 10); + assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_FIRST)); + assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_NEXT)); + assertNotNull(exchange.getIn().getHeader(ServiceNowConstants.OFFSET_LAST)); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-component-auth.xml ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-component-auth.xml b/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-component-auth.xml new file mode 100644 index 0000000..c838e60 --- /dev/null +++ b/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-component-auth.xml @@ -0,0 +1,53 @@ +<?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. + --> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"> + + <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/> + + <bean id="servicenow" class="org.apache.camel.component.servicenow.ServiceNowComponent"> + <property name="userName" value="$[servicenow.username]"/> + <property name="password" value="$[servicenow.password]"/> + </bean> + + <camelContext xmlns="http://camel.apache.org/schema/blueprint"> + <route> + <from uri="direct:servicenow"/> + <multicast> + <to uri="direct:route-1"/> + <to uri="direct:route-2"/> + </multicast> + </route> + + <route> + <from uri="direct:route-1"/> + <to uri="servicenow:{{sys:servicenow.instance}}?excludeReferenceLink=true"/> + <to uri="log:org.apache.camel.component.servicenow-1?level=INFO"/> + <to uri="mock:servicenow-1"/> + </route> + + <route> + <from uri="direct:route-2"/> + <to uri="servicenow:{{sys:servicenow.instance}}?excludeReferenceLink=false"/> + <to uri="log:org.apache.camel.component.servicenow-2?level=INFO"/> + <to uri="mock:servicenow-2"/> + </route> + + </camelContext> + +</blueprint> http://git-wip-us.apache.org/repos/asf/camel/blob/bbe35fb9/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-endpoint-auth.xml ---------------------------------------------------------------------- diff --git a/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-endpoint-auth.xml b/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-endpoint-auth.xml new file mode 100644 index 0000000..5c0b852 --- /dev/null +++ b/components/camel-servicenow/src/test/resources/OSGI-INF/blueprint/blueprint-endpoint-auth.xml @@ -0,0 +1,35 @@ +<?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. + --> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"> + + <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/> + + <bean id="servicenow" class="org.apache.camel.component.servicenow.ServiceNowComponent"> + </bean> + + <camelContext xmlns="http://camel.apache.org/schema/blueprint"> + <route> + <from uri="direct:servicenow"/> + <to uri="servicenow:{{sys:servicenow.instance}}?userName={{sys:servicenow.username}}&password={{sys:servicenow.password}}"/> + <to uri="log:org.apache.camel.component.servicenow?level=INFO"/> + <to uri="mock:servicenow"/> + </route> + </camelContext> + +</blueprint>