[
https://issues.apache.org/jira/browse/CAMEL-12606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16527780#comment-16527780
]
ASF GitHub Bot commented on CAMEL-12606:
----------------------------------------
oscerd closed pull request #2400: CAMEL-12606: Fixed regression in camel test
blueprint behaviour.
URL: https://github.com/apache/camel/pull/2400
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 40b5b52ef81..0b1f9156967 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 @@ protected boolean canSee(Bundle bundle, Class<?> clazz) {
// 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 00000000000..369cc6007a0
--- /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 00000000000..26c2ba3d7ad
--- /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 2b0f5e590bf..ae8dad18d1c 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 00000000000..8548e3e9c6b
--- /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>
+
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> regression in camel test blueprint behaviour
> --------------------------------------------
>
> Key: CAMEL-12606
> URL: https://issues.apache.org/jira/browse/CAMEL-12606
> Project: Camel
> Issue Type: Bug
> Reporter: Andrea Tarocchi
> Priority: Major
>
> This commit
> https://github.com/apache/camel/commit/1a73fa61a6e0f1125e516798d0cabc1198328684
> introduced a regression on how camel test blue print behaves regarding
> loading of TypeConverters only defined in
> {{META-INF/services/org/apache/camel/TypeConverter}}:
> before the commit such a converter would be loaded because the felix.connect
> bundle would see the descriptor (i.e.
> {{META-INF/services/org/apache/camel/TypeConverter}} ) after that commit the
> TypeConverter is ignored.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)