Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2026-01-19 Thread via GitHub


essobedo commented on PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#issuecomment-3767031851

   Thank you for the contribution


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2026-01-19 Thread via GitHub


essobedo merged PR #651:
URL: https://github.com/apache/camel-karaf/pull/651


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2026-01-16 Thread via GitHub


essobedo commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2699428063


##
tests/camel-test-blueprint-junit5/src/test/resources/junit-platform.properties:
##


Review Comment:
   Can be removed



##
tests/camel-blueprint-main/src/generated/resources/blueprint-main.json:
##
@@ -0,0 +1,15 @@
+{
+  "other": {
+"kind": "other",
+"name": "blueprint-main",
+"title": "Blueprint Main",
+"description": "Main support for OSGi Blueprint",
+"deprecated": false,
+"firstVersion": "3.2.0",
+"label": "java,osgi",
+"supportLevel": "Stable",
+"groupId": "org.apache.camel.karaf",
+"artifactId": "camel-blueprint-main",
+"version": "3.22.0-SNAPSHOT"

Review Comment:
   ```suggestion
   "version": "4.10.8-SNAPSHOT"
   ```



##
tests/camel-blueprint-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties:
##
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+name=blueprint-main
+groupId=org.apache.camel.karaf
+artifactId=camel-blueprint-main
+version=3.22.0-SNAPSHOT

Review Comment:
   ```suggestion
   version=4.10.8-SNAPSHOT
   ```



##
tests/camel-test-blueprint-junit5/src/generated/resources/META-INF/services/org/apache/camel/other.properties:
##
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+name=test-blueprint-junit5
+groupId=org.apache.camel.karaf
+artifactId=camel-test-blueprint-junit5
+version=3.22.0-SNAPSHOT

Review Comment:
   ```suggestion
   version=4.10.8-SNAPSHOT
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2026-01-13 Thread via GitHub


jhattab commented on PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#issuecomment-3743109789

   > Why did you remove the content of several classes into 
[camel-integration-test](https://github.com/apache/camel-karaf/tree/f96f9dee6c5bcd5b1f36272e7feda01b6e37b03a/tests/camel-integration-test/src/main/java/org/apache/karaf/camel/itests)?
   
   Sorry about that — it wasn’t intentional and I missed it. (Probably 
automatic refactoring.)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2026-01-12 Thread via GitHub


essobedo commented on PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#issuecomment-3739985745

   Why did you remove the content of several classes into 
[camel-integration-test](https://github.com/apache/camel-karaf/tree/f96f9dee6c5bcd5b1f36272e7feda01b6e37b03a/tests/camel-integration-test)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2026-01-06 Thread via GitHub


essobedo commented on PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#issuecomment-3714014925

   > camel-blueprint-main and camel-test-blueprint-junit5 are not bundles or 
components; perhaps we should consider moving these dependencies to another 
directory in the project, for example under tests?
   
   I agree, if they are not compoments, please move them under tests indeed 👍  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-23 Thread via GitHub


jhattab commented on PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#issuecomment-3686150500

   camel-blueprint-main and camel-test-blueprint-junit5 are not a bundle or a 
component; perhaps we should consider moving these dependencies to another 
directory in the project, for example under tests?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641149824


##
components/camel-test/camel-test-blueprint-junit5/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java:
##
@@ -0,0 +1,757 @@
+/*
+ * 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.test.blueprint;
+
+import org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.blueprint.CamelBlueprintHelper;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.builder.xml.XMLConverterHelper;
+import org.apache.camel.test.junit5.*;
+import org.apache.camel.test.junit5.util.CamelContextTestHelper;
+import org.apache.camel.test.junit5.util.ExtensionHelper;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.KeyValueHolder;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
+import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.jar.JarFile;
+
+/**
+ * Base class for OSGi Blueprint unit tests with Camel
+ */
+public abstract class CamelBlueprintTestSupport extends AbstractTestSupport
+implements BeforeTestExecutionCallback, AfterTestExecutionCallback {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CamelBlueprintTestSupport.class);
+
+/** Name of a system property that sets camel context creation timeout. */
+public static final String SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT = 
"org.apache.camel.test.blueprint.camelContextCreationTimeout";
+
+private static ThreadLocal threadLocalBundleContext = new 
ThreadLocal<>();
+private volatile BundleContext bundleContext;
+private final Set> services = new LinkedHashSet<>();
+
+private final StopWatch watch = new StopWatch();
+
+@RegisterExtension
+@Order(1)
+public final ContextManagerExtension contextManagerExtension;
+private CamelContextManager contextManager;
+
+protected CamelBlueprintTestSupport() {
+super(new TestExecutionConfiguration(), new 
CamelBlueprintContextConfiguration());
+
+configureTest(testConfigurationBuilder);
+configureContext(camelContextConfiguration);
+contextManagerExtension = new 
ContextManagerExtension(testConfigurationBuilder, camelContextConfiguration);
+}
+
+/**
+ * Override this method if you don't want CamelBlueprintTestSupport create 
the test bundle
+ * @return includeTestBundle
+ * If the return value is true CamelBlueprintTestSupport creates the test 
bundle which includes blueprint configuration files
+ * If the return value is false CamelBlueprintTestSupport won't create the 
test bundle
+ */
+protected boolean includeTestBundle() {
+return true;
+}
+
+/**
+ * Override 

Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641148895


##
components/camel-test/camel-test-blueprint-junit5/src/test/java/org/apache/camel/test/blueprint/BlueprintPropertiesTest.java:
##
@@ -0,0 +1,79 @@
+/*
+ * 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.test.blueprint;
+
+import org.apache.camel.blueprint.CamelBlueprintHelper;
+import org.junit.jupiter.api.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+
+import static org.junit.jupiter.api.Assertions.fail;
+
+/**
+ *
+ */
+public class BlueprintPropertiesTest extends CamelBlueprintTestSupport {
+
+@Override
+protected String getBlueprintDescriptor() {
+return "org/apache/camel/test/blueprint/configadmin.xml";
+}
+
+@Test
+public void testProperties() throws Exception {
+Bundle camelCore = getBundleBySymbolicName("camel-blueprint");
+Bundle test = getBundleBySymbolicName(getClass().getSimpleName());
+
+camelCore.stop();
+test.stop();
+
+Thread.sleep(500);

Review Comment:
   This is inherited from the legacy code; I assume it provides some value in 
terms of non-regression.
   
https://github.com/apache/camel-karaf/commits/camel-karaf-3.22.4/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPropertiesTest.java



##
components/camel-test/camel-test-blueprint-junit5/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java:
##
@@ -0,0 +1,757 @@
+/*
+ * 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.test.blueprint;
+
+import org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.blueprint.CamelBlueprintHelper;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.builder.xml.XMLConverterHelper;
+import org.apache.camel.test.junit5.*;
+import org.apache.camel.test.junit5.util.CamelContextTestHelper;
+import org.apache.camel.test.junit5.util.ExtensionHelper;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.KeyValueHolder;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
+import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.

Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641139618


##
components/camel-test/camel-test-blueprint-junit5/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java:
##
@@ -0,0 +1,757 @@
+/*
+ * 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.test.blueprint;
+
+import org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.blueprint.CamelBlueprintHelper;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.builder.xml.XMLConverterHelper;
+import org.apache.camel.test.junit5.*;
+import org.apache.camel.test.junit5.util.CamelContextTestHelper;
+import org.apache.camel.test.junit5.util.ExtensionHelper;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.KeyValueHolder;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
+import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.jar.JarFile;
+
+/**
+ * Base class for OSGi Blueprint unit tests with Camel
+ */
+public abstract class CamelBlueprintTestSupport extends AbstractTestSupport
+implements BeforeTestExecutionCallback, AfterTestExecutionCallback {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CamelBlueprintTestSupport.class);
+
+/** Name of a system property that sets camel context creation timeout. */
+public static final String SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT = 
"org.apache.camel.test.blueprint.camelContextCreationTimeout";
+
+private static ThreadLocal threadLocalBundleContext = new 
ThreadLocal<>();
+private volatile BundleContext bundleContext;
+private final Set> services = new LinkedHashSet<>();
+
+private final StopWatch watch = new StopWatch();
+
+@RegisterExtension
+@Order(1)
+public final ContextManagerExtension contextManagerExtension;
+private CamelContextManager contextManager;
+
+protected CamelBlueprintTestSupport() {
+super(new TestExecutionConfiguration(), new 
CamelBlueprintContextConfiguration());
+
+configureTest(testConfigurationBuilder);
+configureContext(camelContextConfiguration);
+contextManagerExtension = new 
ContextManagerExtension(testConfigurationBuilder, camelContextConfiguration);
+}
+
+/**
+ * Override this method if you don't want CamelBlueprintTestSupport create 
the test bundle
+ * @return includeTestBundle
+ * If the return value is true CamelBlueprintTestSupport creates the test 
bundle which includes blueprint configuration files
+ * If the return value is false CamelBlueprintTestSupport won't create the 
test bundle
+ */
+protected boolean includeTestBundle() {
+return true;
+}
+
+/**
+ * Override 

Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641138803


##
components/camel-test/camel-test-blueprint-junit5/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java:
##
@@ -0,0 +1,757 @@
+/*
+ * 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.test.blueprint;
+
+import org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.blueprint.CamelBlueprintHelper;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.builder.xml.XMLConverterHelper;
+import org.apache.camel.test.junit5.*;
+import org.apache.camel.test.junit5.util.CamelContextTestHelper;
+import org.apache.camel.test.junit5.util.ExtensionHelper;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.KeyValueHolder;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
+import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.jar.JarFile;
+
+/**
+ * Base class for OSGi Blueprint unit tests with Camel
+ */
+public abstract class CamelBlueprintTestSupport extends AbstractTestSupport
+implements BeforeTestExecutionCallback, AfterTestExecutionCallback {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CamelBlueprintTestSupport.class);
+
+/** Name of a system property that sets camel context creation timeout. */
+public static final String SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT = 
"org.apache.camel.test.blueprint.camelContextCreationTimeout";
+
+private static ThreadLocal threadLocalBundleContext = new 
ThreadLocal<>();
+private volatile BundleContext bundleContext;
+private final Set> services = new LinkedHashSet<>();
+
+private final StopWatch watch = new StopWatch();
+
+@RegisterExtension
+@Order(1)
+public final ContextManagerExtension contextManagerExtension;
+private CamelContextManager contextManager;
+
+protected CamelBlueprintTestSupport() {
+super(new TestExecutionConfiguration(), new 
CamelBlueprintContextConfiguration());
+
+configureTest(testConfigurationBuilder);
+configureContext(camelContextConfiguration);
+contextManagerExtension = new 
ContextManagerExtension(testConfigurationBuilder, camelContextConfiguration);
+}
+
+/**
+ * Override this method if you don't want CamelBlueprintTestSupport create 
the test bundle
+ * @return includeTestBundle
+ * If the return value is true CamelBlueprintTestSupport creates the test 
bundle which includes blueprint configuration files
+ * If the return value is false CamelBlueprintTestSupport won't create the 
test bundle
+ */
+protected boolean includeTestBundle() {
+return true;
+}
+
+/**
+ * Override 

Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641136151


##
components/camel-test/camel-test-blueprint-junit5/src/test/java/org/apache/camel/test/blueprint/ContextCreationTimeoutTest.java:
##
@@ -0,0 +1,146 @@
+/*
+ * 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.test.blueprint;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class ContextCreationTimeoutTest {
+
+@AfterEach
+public void cleanup() {
+
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);
+}
+
+@Test
+public void testDefault() {
+
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);

Review Comment:
   Done



##
components/camel-test/camel-test-blueprint-junit5/src/test/java/org/apache/camel/test/blueprint/ContextCreationTimeoutTest.java:
##
@@ -0,0 +1,146 @@
+/*
+ * 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.test.blueprint;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+public class ContextCreationTimeoutTest {
+
+@AfterEach
+public void cleanup() {
+
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);
+}
+
+@Test
+public void testDefault() {
+
System.clearProperty(CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT);
+CamelBlueprintTestSupport ts = new DefaultTestSupport();
+assertNull(ts.getCamelContextCreationTimeout());
+}
+
+@Test
+public void testSystemPropertyNormal() {
+final Long someValue = 6L;
+System.setProperty(
+CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+someValue.toString());
+CamelBlueprintTestSupport ts = new DefaultTestSupport();
+assertEquals(someValue, ts.getCamelContextCreationTimeout());
+}
+
+@Test
+public void testSystemPropertyMaxVal() {
+final Long someValue = Long.MAX_VALUE;
+System.setProperty(
+CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+someValue.toString());
+CamelBlueprintTestSupport ts = new DefaultTestSupport();
+assertEquals(someValue, ts.getCamelContextCreationTimeout());
+}
+
+@Test
+public void testSystemPropertyZero() {
+final Long zeroValue = 0L;
+System.setProperty(
+CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT,
+zeroValue.toString());
+CamelBlueprintTestSupport ts = new DefaultTestSupport();
+assertEquals(zeroValue, ts.getCamelContextCreationTimeout());
+}
+
+@Test
+public void testSystemPropertyNegative() {
+System.setProperty(
+CamelBlueprintTestSupport.SPROP_CAMEL_CONTEXT_CREAT

Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641135413


##
components/camel-blueprint-main/pom.xml:
##
@@ -0,0 +1,181 @@
+
+
+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/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+
+org.apache.camel.karaf
+camel-karaf-components
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-blueprint-main
+jar
+
+Apache Camel :: Karaf :: Blueprint Main

Review Comment:
   This is not a bundle or a component; perhaps we should consider moving these 
dependencies to another directory in the project, for example under tests?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641130526


##
components/camel-test/camel-test-blueprint-junit5/pom.xml:
##
@@ -0,0 +1,286 @@
+
+
+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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+4.0.0
+
+
+org.apache.camel.karaf
+camel-test-parent
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-test-blueprint-junit5
+jar

Review Comment:
   From my experience, this dependency is only useful when provided as a JAR. 
It allows unit tests to be executed without requiring a Karaf container.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2641126612


##
components/camel-test/camel-test-blueprint-junit5/pom.xml:
##
@@ -0,0 +1,286 @@
+
+
+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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+4.0.0
+
+
+org.apache.camel.karaf
+camel-test-parent
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-test-blueprint-junit5
+jar
+
+Apache Camel :: Karaf :: Test :: Blueprint :: Junit 5 

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-12-22 Thread via GitHub


jhattab commented on PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#issuecomment-3684018664

   Thank you very much for the code review. I have reworked the PR by splitting 
it into two commits: one containing the code inherited from the Karaf Camel 
3.22.0 version, and a second one with the adaptations for version 
4.10.8-SNAPSHOT.
   
   I hope this makes the changes easier to review.
   
   Regarding the tests, I believe they are necessary to ensure that the Camel 
patterns are correctly ported and behave as expected in a Blueprint context, 
even if they may appear to test Camel itself.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-11-14 Thread via GitHub


essobedo commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2527079633


##
components/camel-blueprint-main/pom.xml:
##
@@ -0,0 +1,181 @@
+
+
+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/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+
+org.apache.camel.karaf
+camel-karaf-components
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-blueprint-main
+jar

Review Comment:
   jar or bundle?



##
components/camel-test/camel-test-blueprint-junit5/pom.xml:
##
@@ -0,0 +1,286 @@
+
+
+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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+4.0.0
+
+
+org.apache.camel.karaf
+camel-test-parent
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-test-blueprint-junit5
+jar
+
+Apache Camel :: Karaf :: Test :: Blueprint :: Junit 5 

Review Comment:
   ```suggestion
   Apache Camel :: Karaf :: Test :: Blueprint :: JUnit 5 
   ```



##
components/camel-test/camel-test-blueprint-junit5/pom.xml:
##
@@ -0,0 +1,286 @@
+
+
+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 
https://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+4.0.0
+
+
+org.apache.camel.karaf
+camel-test-parent
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-test-blueprint-junit5
+jar

Review Comment:
   jar or bundle



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-11-14 Thread via GitHub


essobedo commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2527076969


##
components/camel-blueprint-main/pom.xml:
##
@@ -0,0 +1,181 @@
+
+
+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/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+
+org.apache.camel.karaf
+camel-karaf-components
+4.10.8-SNAPSHOT
+../pom.xml
+
+
+camel-blueprint-main
+jar
+
+Apache Camel :: Karaf :: Blueprint Main

Review Comment:
   ```suggestion
   Apache Camel :: Karaf :: Components :: Blueprint Main
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] Ref #596: adapt library 'camel-test-blueprint-junit5' to camel-karaf [camel-karaf]

2025-11-13 Thread via GitHub


essobedo commented on code in PR #651:
URL: https://github.com/apache/camel-karaf/pull/651#discussion_r2524080359


##
components/camel-test/camel-test-blueprint-junit5/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java:
##
@@ -0,0 +1,757 @@
+/*
+ * 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.test.blueprint;
+
+import org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.blueprint.CamelBlueprintHelper;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.support.builder.xml.XMLConverterHelper;
+import org.apache.camel.test.junit5.*;
+import org.apache.camel.test.junit5.util.CamelContextTestHelper;
+import org.apache.camel.test.junit5.util.ExtensionHelper;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.KeyValueHolder;
+import org.apache.camel.util.StopWatch;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
+import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.jar.JarFile;
+
+/**
+ * Base class for OSGi Blueprint unit tests with Camel
+ */
+public abstract class CamelBlueprintTestSupport extends AbstractTestSupport
+implements BeforeTestExecutionCallback, AfterTestExecutionCallback {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(CamelBlueprintTestSupport.class);
+
+/** Name of a system property that sets camel context creation timeout. */
+public static final String SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT = 
"org.apache.camel.test.blueprint.camelContextCreationTimeout";
+
+private static ThreadLocal threadLocalBundleContext = new 
ThreadLocal<>();
+private volatile BundleContext bundleContext;
+private final Set> services = new LinkedHashSet<>();
+
+private final StopWatch watch = new StopWatch();
+
+@RegisterExtension
+@Order(1)
+public final ContextManagerExtension contextManagerExtension;
+private CamelContextManager contextManager;
+
+protected CamelBlueprintTestSupport() {
+super(new TestExecutionConfiguration(), new 
CamelBlueprintContextConfiguration());
+
+configureTest(testConfigurationBuilder);
+configureContext(camelContextConfiguration);
+contextManagerExtension = new 
ContextManagerExtension(testConfigurationBuilder, camelContextConfiguration);
+}
+
+/**
+ * Override this method if you don't want CamelBlueprintTestSupport create 
the test bundle
+ * @return includeTestBundle
+ * If the return value is true CamelBlueprintTestSupport creates the test 
bundle which includes blueprint configuration files
+ * If the return value is false CamelBlueprintTestSupport won't create the 
test bundle
+ */
+protected boolean includeTestBundle() {
+return true;
+}
+
+/**
+ * Override