You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/12/13 09:35:32 UTC
[camel] 09/15: CAMEL-12954 - Regen starter and add SB test
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5f68c2f8a8b2ea7896ab1ddb5c336e0a7f4be5c3
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 13 08:52:37 2018 +0100
CAMEL-12954 - Regen starter and add SB test
---
.../src/main/docs/websocket-jsr356-component.adoc | 5 +-
.../camel-websocket-jsr356-starter/pom.xml | 4 +-
.../JSR356WebSocketComponentAutoConfiguration.java | 129 ---------------------
.../JSR356WebSocketComponentConfiguration.java | 54 ---------
.../src/main/resources/META-INF/spring.factories | 2 +-
.../itest/springboot/CamelWebsocketJsr356Test.java | 47 ++++++++
6 files changed, 54 insertions(+), 187 deletions(-)
diff --git a/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc b/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc
index b30f1a9..1112720 100644
--- a/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc
+++ b/components/camel-websocket-jsr356/src/main/docs/websocket-jsr356-component.adoc
@@ -1,5 +1,8 @@
+[[websocket-jsr356-component]]
== Javax Websocket Component
*Available as of Camel version 2.23*
+*Available as of Camel version 2.23*
+
*Available as of Camel version 2.23*
@@ -66,4 +69,4 @@ with the following path and query parameters:
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern
| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
|===
-// endpoint options: END
+// endpoint options: END
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml
index 600bf07..b45af78 100644
--- a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/pom.xml
@@ -22,11 +22,11 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components-starter</artifactId>
- <version>2.23.0-SNAPSHOT</version>
+ <version>2.24.0-SNAPSHOT</version>
</parent>
<artifactId>camel-websocket-jsr356-starter</artifactId>
<packaging>jar</packaging>
- <name>Spring-Boot Starter :: camel-websocket-jsr356</name>
+ <name>Spring-Boot Starter :: Camel :: WebSocket JSR356</name>
<description>Spring-Boot Starter for Camel WebSocket using JSR356 (javax)</description>
<dependencies>
<dependency>
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java
deleted file mode 100644
index b76f689..0000000
--- a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentAutoConfiguration.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.jsr356.springboot;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.Generated;
-import org.apache.camel.CamelContext;
-import org.apache.camel.jsr356.JSR356WebSocketComponent;
-import org.apache.camel.spi.ComponentCustomizer;
-import org.apache.camel.spi.HasId;
-import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.apache.camel.spring.boot.ComponentConfigurationProperties;
-import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
-import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
-import org.apache.camel.spring.boot.util.GroupCondition;
-import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
-import org.apache.camel.util.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Lazy;
-
-/**
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
-@Configuration
-@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
- JSR356WebSocketComponentAutoConfiguration.GroupConditions.class})
-@AutoConfigureAfter(CamelAutoConfiguration.class)
-@EnableConfigurationProperties({ComponentConfigurationProperties.class,
- JSR356WebSocketComponentConfiguration.class})
-public class JSR356WebSocketComponentAutoConfiguration {
-
- private static final Logger LOGGER = LoggerFactory
- .getLogger(JSR356WebSocketComponentAutoConfiguration.class);
- @Autowired
- private ApplicationContext applicationContext;
- @Autowired
- private CamelContext camelContext;
- @Autowired
- private JSR356WebSocketComponentConfiguration configuration;
- @Autowired(required = false)
- private List<ComponentCustomizer<JSR356WebSocketComponent>> customizers;
-
- static class GroupConditions extends GroupCondition {
- public GroupConditions() {
- super("camel.component", "camel.component.websocket-jsr356");
- }
- }
-
- @Lazy
- @Bean(name = "websocket-jsr356-component")
- @ConditionalOnMissingBean(JSR356WebSocketComponent.class)
- public JSR356WebSocketComponent configureJSR356WebSocketComponent()
- throws Exception {
- JSR356WebSocketComponent component = new JSR356WebSocketComponent();
- 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();
- CamelPropertiesHelper.setCamelProperties(camelContext,
- nestedProperty, nestedParameters, false);
- entry.setValue(nestedProperty);
- } catch (NoSuchFieldException e) {
- }
- }
- }
- CamelPropertiesHelper.setCamelProperties(camelContext, component,
- parameters, false);
- if (ObjectHelper.isNotEmpty(customizers)) {
- for (ComponentCustomizer<JSR356WebSocketComponent> customizer : customizers) {
- boolean useCustomizer = (customizer instanceof HasId)
- ? HierarchicalPropertiesEvaluator.evaluate(
- applicationContext.getEnvironment(),
- "camel.component.customizer",
- "camel.component.websocket-jsr356.customizer",
- ((HasId) customizer).getId())
- : HierarchicalPropertiesEvaluator.evaluate(
- applicationContext.getEnvironment(),
- "camel.component.customizer",
- "camel.component.websocket-jsr356.customizer");
- if (useCustomizer) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
- }
- }
- }
- return component;
- }
-}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentConfiguration.java
deleted file mode 100644
index 1fa588a..0000000
--- a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/java/org/apache/camel/jsr356/springboot/JSR356WebSocketComponentConfiguration.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.jsr356.springboot;
-
-import javax.annotation.Generated;
-import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * Camel WebSocket using JSR356 (javax)
- *
- * Generated by camel-package-maven-plugin - do not edit this file!
- */
-@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
-@ConfigurationProperties(prefix = "camel.component.websocket-jsr356")
-public class JSR356WebSocketComponentConfiguration
- extends
- ComponentConfigurationPropertiesCommon {
-
- /**
- * Whether to enable auto configuration of the websocket-jsr356 component.
- * This is enabled by default.
- */
- private Boolean enabled;
- /**
- * Whether the component should resolve property placeholders on itself when
- * starting. Only properties which are of String type can use property
- * placeholders.
- */
- private Boolean resolvePropertyPlaceholders = true;
-
- public Boolean getResolvePropertyPlaceholders() {
- return resolvePropertyPlaceholders;
- }
-
- public void setResolvePropertyPlaceholders(
- Boolean resolvePropertyPlaceholders) {
- this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
- }
-}
\ No newline at end of file
diff --git a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.factories
index 3052b01..58d720b 100644
--- a/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.factories
+++ b/platforms/spring-boot/components-starter/camel-websocket-jsr356-starter/src/main/resources/META-INF/spring.factories
@@ -16,4 +16,4 @@
## ---------------------------------------------------------------------------
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.apache.camel.jsr356.springboot.JSR356WebSocketComponentAutoConfiguration
+org.apache.camel.websocket.jsr356.springboot.JSR356WebSocketComponentAutoConfiguration
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelWebsocketJsr356Test.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelWebsocketJsr356Test.java
new file mode 100644
index 0000000..9956591
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelWebsocketJsr356Test.java
@@ -0,0 +1,47 @@
+/**
+ * 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.itest.springboot;
+
+import org.apache.camel.itest.springboot.util.ArquillianPackager;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+@RunWith(Arquillian.class)
+public class CamelWebsocketJsr356Test extends AbstractSpringBootTestSupport {
+
+ @Deployment
+ public static Archive<?> createSpringBootPackage() throws Exception {
+ return ArquillianPackager.springBootPackage(createTestConfig());
+ }
+
+ public static ITestConfig createTestConfig() {
+ return new ITestConfigBuilder()
+ .module(inferModuleName(CamelWebsocketJsr356Test.class))
+ .build();
+ }
+
+ @Test
+ public void componentTests() throws Exception {
+ this.runComponentTest(createTestConfig(), "websocket-jsr356");
+ this.runModuleUnitTestsIfEnabled(config);
+ }
+
+}