Author: davsclaus
Date: Mon May 30 15:55:00 2011
New Revision: 1129232
URL: http://svn.apache.org/viewvc?rev=1129232&view=rev
Log:
CAMEL-3934: Fixed resource based component to load from classpath using Camels
ClassResolver which ensures they now work in OSGi blueprint.
Added:
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelClassPathResource.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelResourceLoader.java
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
- copied, changed from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-19.xml
- copied, changed from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-20.xml
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/example.vm
- copied, changed from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/velocity/example.vm
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/example.xsl
- copied unchanged from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/spring/xslt/example.xsl
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedComponent.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedEndpoint.java
camel/trunk/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityComponent.java
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1129232&r1=1129231&r2=1129232&view=diff
==============================================================================
---
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
(original)
+++
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java
Mon May 30 15:55:00 2011
@@ -278,7 +278,7 @@ public class XsltBuilder implements Proc
* Sets the XSLT transformer from the given input stream
*/
public void setTransformerInputStream(InputStream in) throws
TransformerConfigurationException, IOException {
- notNull(in, "in");
+ notNull(in, "InputStream");
setTransformerSource(new StreamSource(in));
}
Added:
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelClassPathResource.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelClassPathResource.java?rev=1129232&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelClassPathResource.java
(added)
+++
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelClassPathResource.java
Mon May 30 15:55:00 2011
@@ -0,0 +1,59 @@
+/**
+ * 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.component;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.camel.spi.ClassResolver;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.Assert;
+
+/**
+ * Camel specific {@link ClassPathResource} which uses the {@link
ClassResolver} to load resources from the classpath.
+ */
+public class CamelClassPathResource extends ClassPathResource {
+
+ private final ClassResolver resolver;
+
+ public CamelClassPathResource(ClassResolver resolver, String path,
ClassLoader classLoader) {
+ super(path, classLoader);
+ Assert.notNull(resolver, "Resolver must not be null");
+ this.resolver = resolver;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ InputStream is = resolver.loadResourceAsStream(getPath());
+ if (is == null) {
+ return super.getInputStream();
+ } else {
+ return is;
+ }
+ }
+
+ @Override
+ public URL getURL() throws IOException {
+ URL url = resolver.loadResourceAsURL(getPath());
+ if (url == null) {
+ return super.getURL();
+ } else {
+ return url;
+ }
+ }
+}
Added:
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelResourceLoader.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelResourceLoader.java?rev=1129232&view=auto
==============================================================================
---
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelResourceLoader.java
(added)
+++
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/CamelResourceLoader.java
Mon May 30 15:55:00 2011
@@ -0,0 +1,50 @@
+/**
+ * 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.component;
+
+import org.apache.camel.CamelContext;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.util.Assert;
+
+/**
+ * A Camel specific {@link org.springframework.core.io.ResourceLoader} which
can load
+ * resources from classpath using the Camel {@link
org.apache.camel.spi.ClassResolver}.
+ */
+public class CamelResourceLoader extends DefaultResourceLoader {
+
+ private final CamelContext camelContext;
+
+ public CamelResourceLoader(CamelContext camelContext) {
+ this.camelContext = camelContext;
+ }
+
+ @Override
+ public Resource getResource(String location) {
+ Assert.notNull(location, "Location must not be null");
+ if (location.startsWith(CLASSPATH_URL_PREFIX)) {
+ return new CamelClassPathResource(camelContext.getClassResolver(),
location.substring(CLASSPATH_URL_PREFIX.length()), getClassLoader());
+ }
+ return super.getResource(location);
+ }
+
+ @Override
+ protected Resource getResourceByPath(String path) {
+ return new CamelClassPathResource(camelContext.getClassResolver(),
path, getClassLoader());
+ }
+
+}
Modified:
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedComponent.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedComponent.java?rev=1129232&r1=1129231&r2=1129232&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedComponent.java
(original)
+++
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedComponent.java
Mon May 30 15:55:00 2011
@@ -19,8 +19,6 @@ package org.apache.camel.component;
import org.apache.camel.impl.DefaultComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@@ -32,9 +30,12 @@ import org.springframework.core.io.Resou
*/
public abstract class ResourceBasedComponent extends DefaultComponent {
protected final transient Logger log = LoggerFactory.getLogger(getClass());
- private ResourceLoader resourceLoader = new DefaultResourceLoader();
+ private ResourceLoader resourceLoader;
public ResourceLoader getResourceLoader() {
+ if (resourceLoader == null) {
+ resourceLoader = new CamelResourceLoader(getCamelContext());
+ }
return resourceLoader;
}
Modified:
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedEndpoint.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedEndpoint.java?rev=1129232&r1=1129231&r2=1129232&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedEndpoint.java
(original)
+++
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedEndpoint.java
Mon May 30 15:55:00 2011
@@ -26,7 +26,6 @@ import org.apache.camel.converter.IOConv
import org.apache.camel.impl.ProcessorEndpoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@@ -39,7 +38,7 @@ import org.springframework.core.io.Resou
public abstract class ResourceBasedEndpoint extends ProcessorEndpoint {
protected final transient Logger log = LoggerFactory.getLogger(getClass());
private String resourceUri;
- private ResourceLoader resourceLoader = new DefaultResourceLoader();
+ private ResourceLoader resourceLoader;
private Resource resource;
private boolean contentCache;
private byte[] buffer;
@@ -50,6 +49,9 @@ public abstract class ResourceBasedEndpo
public ResourceBasedEndpoint(String endpointUri, Component component,
String resourceUri, Processor processor) {
super(endpointUri, component, processor);
this.resourceUri = resourceUri;
+ if (component instanceof ResourceBasedComponent) {
+ this.resourceLoader = ((ResourceBasedComponent)
component).getResourceLoader();
+ }
}
protected ResourceBasedEndpoint(String endpointUri, Processor processor,
String resourceUri) {
@@ -62,9 +64,7 @@ public abstract class ResourceBasedEndpo
if (log.isDebugEnabled()) {
log.debug("Loading resource: " + resourceUri + " using: " +
getResourceLoader());
}
-
resource = getResourceLoader().getResource(resourceUri);
-
if (resource == null) {
throw new IllegalArgumentException("Could not find resource
for URI: " + resourceUri + " using: " + getResourceLoader());
}
@@ -86,7 +86,7 @@ public abstract class ResourceBasedEndpo
// get the resource if not already done
resource = getResource();
}
- // try to get the resource inputstream
+ // try to get the resource input stream
InputStream is = null;
if (contentCache) {
synchronized (resource) {
@@ -95,7 +95,6 @@ public abstract class ResourceBasedEndpo
log.debug("Reading resource: " + resourceUri + " into
the content cache");
}
is = getResourceAsInputStreamWithoutCache();
-
buffer = IOConverter.toBytes(is);
}
}
@@ -104,12 +103,12 @@ public abstract class ResourceBasedEndpo
}
return new ByteArrayInputStream(buffer);
}
+
return getResourceAsInputStreamWithoutCache();
}
-
-
+
protected InputStream getResourceAsInputStreamWithoutCache() throws
IOException {
- InputStream result = null;
+ InputStream result;
try {
result = resource.getInputStream();
} catch (IOException exception) {
@@ -137,6 +136,9 @@ public abstract class ResourceBasedEndpo
}
public ResourceLoader getResourceLoader() {
+ if (resourceLoader == null) {
+ resourceLoader = new CamelResourceLoader(getCamelContext());
+ }
return resourceLoader;
}
Modified:
camel/trunk/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java?rev=1129232&r1=1129231&r2=1129232&view=diff
==============================================================================
---
camel/trunk/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java
(original)
+++
camel/trunk/components/camel-stringtemplate/src/main/java/org/apache/camel/component/stringtemplate/StringTemplateComponent.java
Mon May 30 15:55:00 2011
@@ -19,12 +19,12 @@ package org.apache.camel.component.strin
import java.util.Map;
import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.component.ResourceBasedComponent;
/**
* @version
*/
-public class StringTemplateComponent extends DefaultComponent {
+public class StringTemplateComponent extends ResourceBasedComponent {
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
return new StringTemplateEndpoint(uri, this, remaining, parameters);
Modified:
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityComponent.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityComponent.java?rev=1129232&r1=1129231&r2=1129232&view=diff
==============================================================================
---
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityComponent.java
(original)
+++
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityComponent.java
Mon May 30 15:55:00 2011
@@ -19,14 +19,14 @@ package org.apache.camel.component.veloc
import java.util.Map;
import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.component.ResourceBasedComponent;
import org.apache.camel.util.ObjectHelper;
import org.apache.velocity.app.VelocityEngine;
/**
* @version
*/
-public class VelocityComponent extends DefaultComponent {
+public class VelocityComponent extends ResourceBasedComponent {
private VelocityEngine velocityEngine;
public VelocityEngine getVelocityEngine() {
Modified:
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java?rev=1129232&r1=1129231&r2=1129232&view=diff
==============================================================================
---
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
(original)
+++
camel/trunk/components/camel-velocity/src/main/java/org/apache/camel/component/velocity/VelocityEndpoint.java
Mon May 30 15:55:00 2011
@@ -95,7 +95,6 @@ public class VelocityEndpoint extends Re
public void setVelocityEngine(VelocityEngine velocityEngine) {
this.velocityEngine = velocityEngine;
-
}
public boolean isLoaderCache() {
@@ -153,7 +152,7 @@ public class VelocityEndpoint extends Re
return;
}
- Resource resource = null;
+ Resource resource;
Reader reader;
String content =
exchange.getIn().getHeader(VelocityConstants.VELOCITY_TEMPLATE, String.class);
if (content != null) {
@@ -196,4 +195,5 @@ public class VelocityEndpoint extends Re
out.setHeader(entry.getKey(), entry.getValue());
}
}
+
}
\ No newline at end of file
Copied:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
(from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java)
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java&r1=1129133&r2=1129232&rev=1129232&view=diff
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
Mon May 30 15:55:00 2011
@@ -17,6 +17,8 @@
package org.apache.camel.itest.osgi.blueprint;
import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
import org.apache.karaf.testing.Helper;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -28,9 +30,7 @@ import org.osgi.service.blueprint.contai
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
-import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
import static org.ops4j.pax.exam.OptionUtils.combine;
-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;
import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
@@ -39,42 +39,36 @@ import static org.ops4j.pax.swissbox.tin
* @version
*/
@RunWith(JUnit4TestRunner.class)
-public class CamelBlueprint3Test extends OSGiBlueprintTestSupport {
+public class CamelBlueprint4Test extends OSGiBlueprintTestSupport {
@Test
- public void testRouteWithComponentFromBlueprint() throws Exception {
- getInstalledBundle("CamelBlueprintTestBundle6").start();
- BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle6)", 10000);
- CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle6)", 10000);
- assertEquals(1, ctx.getRoutes().size());
- assertSame(ctn.getComponentInstance("seda"), ctx.getComponent("seda"));
- }
+ public void testRouteWithXSLT() throws Exception {
+ getInstalledBundle("CamelBlueprintTestBundle19").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle19)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle19)", 10000);
- @Test
- public void testRouteWithInterceptStrategy() throws Exception {
- getInstalledBundle("CamelBlueprintTestBundle7").start();
- BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle7)", 10000);
- CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle7)", 10000);
- assertEquals(1, ctx.getRoutes().size());
- assertEquals(1, ctx.getInterceptStrategies().size());
- assertEquals(TestInterceptStrategy.class.getName(),
ctx.getInterceptStrategies().get(0).getClass().getName());
- }
+ ProducerTemplate template = ctx.createProducerTemplate();
- @Test
- public void testComponentProperties() throws Exception {
- getInstalledBundle("CamelBlueprintTestBundle8").start();
- BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle8)", 10000);
- CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle8)", 10000);
- assertEquals(1, ctx.getRoutes().size());
- assertEquals("direct://start",
ctx.getRoutes().get(0).getEndpoint().getEndpointUri());
+ MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
+ mock.expectedBodiesReceived("<?xml version=\"1.0\"
encoding=\"UTF-8\"?><goodbye>world!</goodbye>");
+ mock.message(0).body().isInstanceOf(String.class);
+
+ template.sendBody("direct:start", "<hello>world!</hello>");
+
+ mock.assertIsSatisfied();
+ template.stop();
}
@Test
- public void testRouteBuilderRef() throws Exception {
- getInstalledBundle("CamelBlueprintTestBundle9").start();
- BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle9)", 10000);
- CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle9)", 10000);
- assertEquals(1, ctx.getRoutes().size());
+ public void testRouteWithVelocity() throws Exception {
+ getInstalledBundle("CamelBlueprintTestBundle20").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class,
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle20)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CamelBlueprintTestBundle20)", 10000);
+
+ ProducerTemplate template = ctx.createProducerTemplate();
+ Object out = template.requestBody("direct:a", "world");
+ assertEquals("<hello>world</hello>", out);
+ template.stop();
}
@Configuration
@@ -83,39 +77,24 @@ public class CamelBlueprint3Test extends
Option[] options = combine(
// Default karaf environment
Helper.getDefaultOptions(
- // this is how you set the default log level when using pax
logging (logProfile)
- Helper.setLogLevel("WARN")),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-6.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle6")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()).noStart(),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-7.xml"))
- .add(TestInterceptStrategy.class)
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle7")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()).noStart(),
+ // this is how you set the default log level when
using pax logging (logProfile)
+ Helper.setLogLevel("WARN")),
bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-8.xml"))
-
.add("org/apache/camel/component/properties/cheese.properties",
OSGiBlueprintTestSupport.class.getResource("cheese.properties"))
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle8")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-19.xml"))
+
.add("org/apache/camel/itest/osgi/blueprint/example.xsl",
OSGiBlueprintTestSupport.class.getResource("example.xsl"))
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle19")
.build()).noStart(),
bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-9.xml"))
- .add(TestRouteBuilder.class)
- .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle9")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .add("OSGI-INF/blueprint/test.xml",
OSGiBlueprintTestSupport.class.getResource("blueprint-20.xml"))
+
.add("org/apache/camel/itest/osgi/blueprint/example.vm",
OSGiBlueprintTestSupport.class.getResource("example.vm"))
+ .set(Constants.BUNDLE_SYMBOLICNAME,
"CamelBlueprintTestBundle20")
.build()).noStart(),
// using the features to install the camel components
scanFeatures(getCamelKarafFeatureUrl(),
- "camel-core", "camel-blueprint", "camel-test",
"camel-ftp", "camel-jackson", "camel-jms"),
+ "camel-core", "camel-test", "camel-blueprint",
"camel-spring", "camel-velocity"),
workingDirectory("target/paxrunner/"),
Copied:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-19.xml
(from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml)
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-19.xml?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-19.xml&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml&r1=1129133&r2=1129232&rev=1129232&view=diff
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-6.xml
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-19.xml
Mon May 30 15:55:00 2011
@@ -17,13 +17,13 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
- <camelContext xmlns="http://camel.apache.org/schema/blueprint">
- <route>
- <from uri="seda:queue"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
-
- <bean id="seda" class="org.apache.camel.component.seda.SedaComponent"/>
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="direct:start"/>
+ <to uri="xslt:org/apache/camel/itest/osgi/blueprint/example.xsl"/>
+ <to uri="log:result"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
</blueprint>
Added:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-20.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-20.xml?rev=1129232&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-20.xml
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-20.xml
Mon May 30 15:55:00 2011
@@ -0,0 +1,27 @@
+<?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">
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+ <route>
+ <from uri="direct:a"/>
+ <to uri="velocity:org/apache/camel/itest/osgi/blueprint/example.vm"/>
+ </route>
+ </camelContext>
+
+</blueprint>
Copied:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/example.vm
(from r1129133,
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/velocity/example.vm)
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/example.vm?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/example.vm&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/velocity/example.vm&r1=1129133&r2=1129232&rev=1129232&view=diff
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/velocity/example.vm
(original)
+++
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/example.vm
Mon May 30 15:55:00 2011
@@ -14,5 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ------------------------------------------------------------------------
-#parse("org/apache/camel/itest/osgi/velocity/header.vm")
-<hello>${headers.cheese}</hello>
\ No newline at end of file
+<hello>${body}</hello>
\ No newline at end of file