You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/06/10 10:54:40 UTC
svn commit: r953252 - in /camel/trunk:
components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiLanguageResolver.java
tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java
Author: ningjiang
Date: Thu Jun 10 08:54:39 2010
New Revision: 953252
URL: http://svn.apache.org/viewvc?rev=953252&view=rev
Log:
CAMEL-2804 Fixed the Language resolver issue
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java (with props)
Modified:
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiLanguageResolver.java
Modified: camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiLanguageResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiLanguageResolver.java?rev=953252&r1=953251&r2=953252&view=diff
==============================================================================
--- camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiLanguageResolver.java (original)
+++ camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiLanguageResolver.java Thu Jun 10 08:54:39 2010
@@ -53,7 +53,7 @@ public class OsgiLanguageResolver implem
return (Language)bean;
}
Language lang = getLanguage(name, context);
- if (lang == null) {
+ if (lang != null) {
return lang;
}
LanguageResolver resolver = getLanguageResolver("default", context);
Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java?rev=953252&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java (added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java Thu Jun 10 08:54:39 2010
@@ -0,0 +1,84 @@
+/**
+ * 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.osgi;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.profile;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
+@RunWith(JUnit4TestRunner.class)
+public class LanguageTest extends OSGiIntegrationTestSupport {
+
+ @Test
+ public void testSimpleLanguage() throws Exception {
+ MockEndpoint result = getMockEndpoint("mock:result");
+ result.expectedBodiesReceived("Hello IS processed!");
+ template.sendBody("direct:simple", "Hello");
+ result.assertIsSatisfied();
+ }
+
+ @Test
+ public void testGroovyLanguage() throws Exception {
+ MockEndpoint result = getMockEndpoint("mock:result");
+ result.expectedBodiesReceived("Hello is processed!");
+ template.sendBody("direct:groovy", "Hello");
+ result.assertIsSatisfied();
+ }
+
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ // Test the simple expression
+ from("direct:simple").setBody().simple("${body} IS processed!").to("mock:result");
+ // Test other language from other bundle
+ from("direct:groovy").setBody().groovy("request.body + ' is processed!'").to("mock:result");
+ }
+ };
+ }
+
+ @Configuration
+ public static Option[] configure() {
+ Option[] options = options(
+ // install the spring dm profile
+ profile("spring.dm").version("1.2.0"),
+ // this is how you set the default log level when using pax logging (logProfile)
+ org.ops4j.pax.exam.CoreOptions.systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+
+ // using the features to install the camel components
+ scanFeatures(mavenBundle().groupId("org.apache.camel.karaf").
+ artifactId("apache-camel").versionAsInProject().type("xml/features"),
+ "camel-core", "camel-spring", "camel-test", "camel-groovy"),
+
+ workingDirectory("target/paxrunner/"),
+
+ felix());
+
+ return options;
+ }
+
+}
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/LanguageTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date