camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: CamelBlueprintTestSupport Issues
Date Tue, 08 Oct 2013 06:13:29 GMT
Hi Andre,

I dug the code few hours ago, I think we should provide a option to include the test bundle
or not.
Here is the JIRA[1] for it.

[1]https://issues.apache.org/jira/browse/CAMEL-6835  

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, October 8, 2013 at 1:53 PM, Andre Piwoni wrote:

> Willem, thank you for reply. My point is that with CamelBlueprintTestSupport
> that utilizes CamelBlueprintHelper I don't have much control over which
> bundles are included.
>  
> Here's sample Maven project structure that creates bundle (not test bundle)
> and contains test case that extends CamelBlueprintTestSupport:
>  
> ProjectA (bundle)
> - /src/main/resources/OSGI-INF/blueprint/camel-context.xml
> - /src/test/java/TestClassThatExtendsCamelBluePrintTestSupport.java
>  
> public class TestClassThatExtendsCamelBluePrintTestSupport extends
> CamelBlueprintTestSupport {
> ...
> protected String getBlueprintDescriptor() {
> return "OSGI-INF/blueprint/camel-context.xml";
> }
> ...
> }
> When TestClassThatExtendsCamelBluePrintTestSupport is executed
> CamelBlueprintTestSupport calls CamelBlueprintHelper which includes test
> bundle and ProjectA bundle.
>  
> public static BundleContext createBundleContext(String name, String
> descriptors, boolean includeTestBundle,String bundleFilter, String
> testBundleVersion, String testBundleDirectives) throws Exception {
> TinyBundle bundle = null;
>  
> if (includeTestBundle) { // ALWAYS SET TO TRUE BY
> CamelBlueprintTestSupport  
> // add ourselves as a bundle
> bundle = createTestBundle(testBundleDirectives == null ? name :
> name + ';' + testBundleDirectives, testBundleVersion, descriptors);
> }
>  
> return createBundleContext(name, bundleFilter, bundle);
> }
>  
> Here's test bundle inclusion code from createTestBundle():
>  
> TinyBundle bundle = TinyBundles.newBundle();
> for (URL url : getBlueprintDescriptors(descriptors)) {
> LOG.info (http://LOG.info)("Using Blueprint XML file: " + url.getFile());
> bundle.add("OSGI-INF/blueprint/blueprint-" +
> url.getFile().replace("/", "-"), url);
> }
> bundle.set("Manifest-Version", "2")
> .set("Bundle-ManifestVersion", "2")
> .set("Bundle-SymbolicName", name)
> .set("Bundle-Version", version);
> return bundle;
>  
> Here's ProjectA bundle inclusion that comes from scan within
> createBundleContext():
>  
> for (Enumeration<URL> e =
> getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");e.hasMoreElements();)
> {
> URL manifestURL = e.nextElement();
> ...
> bundles.add(new BundleDescriptor(getClass().getClassLoader(),
> getParentURL(manifestURL), headers));
> }
>  
> Above results in two bundles with OSGI-INF/blueprint/camel-context.xml and
> I'm not sure how your suggestion would solve this problem? I want to run
> test case but exclude ProjectA bundle.
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/CamelBlueprintTestSupport-Issues-tp5741066p5741074.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Mime
View raw message