CAMEL-12606: Fixed regression in camel test blueprint behaviour.
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 40b5b52..0b1f915 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -254,7 +254,7 @@
// it may be running outside real OSGi container such as when unit testing with camel-test-blueprint
// then we need to use a different canSee algorithm that works outside real OSGi
- if (bundle.getBundleId() > 0) {
+ if (bundle.getBundleId() >= 0) {
Bundle root = bundle.getBundleContext().getBundle(0);
if (root != null && "org.apache.felix.connect".equals(root.getSymbolicName())) {
return checkCompat(bundle, clazz);
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.java
new file mode 100644
index 0000000..369cc60
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.java
@@ -0,0 +1,44 @@
+/**
+ * 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.converter;
+
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.apache.camel.test.blueprint.Foo;
+import org.junit.Test;
+
+public class CustomConverterRegressionTest extends CamelBlueprintTestSupport {
+
+ @Override
+ protected String getBlueprintDescriptor() {
+ return "org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.xml";
+ }
+
+ @Test
+ public void testCustomConverter() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+ getMockEndpoint("mock:result").message(0).body().isInstanceOf(Foo.class);
+
+ template.sendBody("direct:start", "John,Doe");
+
+ assertMockEndpointsSatisfied();
+
+ Foo foo = getMockEndpoint("mock:result").getReceivedExchanges().get(0).getIn().getBody(Foo.class);
+ assertEquals("John", foo.getFirst());
+ assertEquals("Doe", foo.getLast());
+ }
+
+}
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/converter/FooConverterRegression.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/converter/FooConverterRegression.java
new file mode 100644
index 0000000..26c2ba3
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/converter/FooConverterRegression.java
@@ -0,0 +1,37 @@
+/**
+ * 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.converter;
+
+import org.apache.camel.Converter;
+import org.apache.camel.TypeConverters;
+import org.apache.camel.test.blueprint.Foo;
+
+public class FooConverterRegression {
+
+ public FooConverterRegression() {
+ }
+
+ @Converter
+ public Foo convertToFoo(String data) {
+ String[] s = data.split(",");
+ Foo foo = new Foo();
+ foo.setFirst(s[0]);
+ foo.setLast(s[1]);
+ return foo;
+ }
+
+}
diff --git a/components/camel-test-blueprint/src/test/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-test-blueprint/src/test/resources/META-INF/services/org/apache/camel/TypeConverter
index 2b0f5e5..ae8dad1 100644
--- a/components/camel-test-blueprint/src/test/resources/META-INF/services/org/apache/camel/TypeConverter
+++ b/components/camel-test-blueprint/src/test/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.camel.test.blueprint.converter.MyConverter
\ No newline at end of file
+org.apache.camel.test.blueprint.converter.FooConverterRegression
\ No newline at end of file
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.xml
new file mode 100644
index 0000000..8548e3e
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/converter/CustomConverterRegressionTest.xml
@@ -0,0 +1,36 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+ <route>
+ <from uri="direct:start"/>
+ <convertBodyTo type="org.apache.camel.test.blueprint.Foo"/>
+ <to uri="mock:result"/>
+ </route>
+
+ </camelContext>
+
+</blueprint>
+