You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by kl...@apache.org on 2022/11/10 07:50:36 UTC

[camel-karaf-examples] branch main updated: CAMEL-18664 fix build and examples to work in karaf. (#6)

This is an automated email from the ASF dual-hosted git repository.

klease pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karaf-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 444b651  CAMEL-18664 fix build and examples to work in karaf. (#6)
444b651 is described below

commit 444b651bc3e1e0ff494f095bc4e408198bd6f1eb
Author: klease <38...@users.noreply.github.com>
AuthorDate: Thu Nov 10 08:50:31 2022 +0100

    CAMEL-18664 fix build and examples to work in karaf. (#6)
    
    * CAMEL-18664: fix build and examples to run in karaf
    Filter the resources to replace placeholders.
    Upgrade chucknorris example yaml syntax.
    Remove unnecessary osgi package in artemis-amqp example.
    * Fix artemis-amqp-blueprint example integration test.
    Use EmbeddedActiveMQ and upgrade spring configuration.
---
 examples/camel-example-artemis-amqp-blueprint/pom.xml  |  3 ---
 .../example/artemis/amqp/EmbeddedBrokerSupport.java    | 18 +++++-------------
 .../resources/OSGI-INF/blueprint/embedded-broker.xml   |  2 ++
 .../src/test/resources/broker.xml                      |  3 ++-
 .../kamelets/chuck-norris-source.kamelet.yaml          |  2 +-
 examples/pom.xml                                       |  6 ++++++
 6 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/examples/camel-example-artemis-amqp-blueprint/pom.xml b/examples/camel-example-artemis-amqp-blueprint/pom.xml
index 9bedc1d..221ee2b 100644
--- a/examples/camel-example-artemis-amqp-blueprint/pom.xml
+++ b/examples/camel-example-artemis-amqp-blueprint/pom.xml
@@ -35,9 +35,6 @@
 
     <properties>
         <category>Messaging</category>
-        <camel.osgi.import.additional>
-            org.apache.qpid.*;version="[0.20,1)",
-        </camel.osgi.import.additional>
     </properties>
 
     <dependencyManagement>
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.java b/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.java
index 2313810..64b4907 100644
--- a/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.java
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.java
@@ -16,30 +16,22 @@
  */
 package org.apache.camel.example.artemis.amqp;
 
-import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
 
-// import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
-// import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
-
 
 //#################################################
 // Blueprint does not support Bean inheritance (necessary for Artemis EmbeddedJMS)
 // We need therefore a 'support' class
 //#################################################
-public class EmbeddedBrokerSupport extends EmbeddedJMS {
+public class EmbeddedBrokerSupport extends EmbeddedActiveMQ {
     
     public EmbeddedBrokerSupport(ActiveMQJAASSecurityManager securityManager) throws Exception {
         this.setSecurityManager(securityManager);
+    }
+    
+     public void startServer() throws Exception {
         this.start();
-
-        //if you need more twicking use Java to customise as follows:
-            // SecurityConfiguration securityConfig = new SecurityConfiguration();
-            // securityConfig.addUser("guest", "guest");
-            // securityConfig.addRole("guest", "guest");
-            // securityConfig.setDefaultUser("guest");
-            // ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfig);
-            // this.setSecurityManager(securityManager);
     }
 
     public void close() throws Exception {
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml
index 0cc179e..9aad1c5 100644
--- a/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml
@@ -50,10 +50,12 @@
     </argument>
   </bean>
 
+
   <!-- Blueprint does not support Bean inheritance (necessary for Artemis EmbeddedJMS)
        We need therefore a 'support' class -->
   <bean id="embeddedJMS"
         class="org.apache.camel.example.artemis.amqp.EmbeddedBrokerSupport"
+        init-method="startServer"
         destroy-method="close">
     <argument ref="securityManager"/>
   </bean>
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml
index 746eaf3..f3319ab 100644
--- a/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml
@@ -39,10 +39,11 @@
             <permission type="deleteDurableQueue" roles="guest"/>
             <permission type="createNonDurableQueue" roles="guest"/>
             <permission type="deleteNonDurableQueue" roles="guest"/>
+            <permission type="createAddress" roles="guest"/>
             <permission type="consume" roles="guest"/>
             <permission type="send" roles="guest"/>
          </security-setting>
       </security-settings>
 
    </core>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/examples/camel-example-kamelet-chucknorris/src/main/resources/kamelets/chuck-norris-source.kamelet.yaml b/examples/camel-example-kamelet-chucknorris/src/main/resources/kamelets/chuck-norris-source.kamelet.yaml
index b47dde7..72346d7 100644
--- a/examples/camel-example-kamelet-chucknorris/src/main/resources/kamelets/chuck-norris-source.kamelet.yaml
+++ b/examples/camel-example-kamelet-chucknorris/src/main/resources/kamelets/chuck-norris-source.kamelet.yaml
@@ -30,7 +30,7 @@ spec:
     - "camel:timer"
     - "camel:http"
     - "camel:jsonpath"
-  flow:
+  template:
     from:
       uri: "timer:chuck"
       parameters:
diff --git a/examples/pom.xml b/examples/pom.xml
index 05a0648..b47490a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -207,6 +207,12 @@
     </pluginRepositories>
 
     <build>
+       <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>