You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2016/05/16 07:19:51 UTC

svn commit: r988352 - in /websites/production/camel/content: blueprint-testing.html cache/main.pageCache

Author: buildbot
Date: Mon May 16 07:19:51 2016
New Revision: 988352

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/blueprint-testing.html
    websites/production/camel/content/cache/main.pageCache

Modified: websites/production/camel/content/blueprint-testing.html
==============================================================================
--- websites/production/camel/content/blueprint-testing.html (original)
+++ websites/production/camel/content/blueprint-testing.html Mon May 16 07:19:51 2016
@@ -86,7 +86,7 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="BlueprintTesting-BlueprintTesting">Blueprint Testing</h2><p><strong>Available as of Camel 2.10</strong></p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p><strong>camel-test-blueprint</strong> does only support testing one CamelContext. So if you have 2 or more CamelContexts in your blueprint XML files, then first found CamelContext is used during testing.</p></div></div><p><a shape="rect" href="testing.html">Testing</a><span style="line-height: 1.4285715;"> is a crucial part of any development or integration work. Camel supports the definition of </span><a shape="rect" href="using-osgi-blueprint-with-camel.html">Blueprint routes</a><span style="line-height: 1.4285715;">, but given Blueprint is an OSGi specific technology, writing unit tests is quite difficul
 t. This library leverages </span><a shape="rect" class="external-link" href="http://code.google.com/p/pojosr/" style="line-height: 1.4285715;" rel="nofollow">PojoSR</a><span style="line-height: 1.4285715;"> which provides a service registry without using a fully compliant OSGi container. This allows defining real unit tests (as opposed to integration tests using </span><a shape="rect" class="external-link" href="http://team.ops4j.org/wiki/display/paxexam/Pax+Exam" style="line-height: 1.4285715;" rel="nofollow">Pax Exam</a><span style="line-height: 1.4285715;">. Please make sure all test jars in you class path are OSGi bundle.</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="BlueprintTesting-BlueprintTesting">Blueprint Testing</h2><p><strong>Available as of Camel 2.10</strong></p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p><strong>camel-test-blueprint</strong> does only support testing <em>one</em> CamelContext. So if you have two or more CamelContexts in your blueprint XML files, then only the CamelContext first found is used during testing.</p></div></div><p><a shape="rect" href="testing.html">Testing</a><span style="line-height: 1.4285715;"> is a crucial part of any development or integration work. Camel supports the definition of </span><a shape="rect" href="using-osgi-blueprint-with-camel.html">Blueprint routes</a><span style="line-height: 1.4285715;">, but given that Blueprint is an OSGi specific technology, writing uni
 t tests is quite difficult. This library leverages </span><a shape="rect" class="external-link" href="http://code.google.com/p/pojosr/" style="line-height: 1.4285715;" rel="nofollow">PojoSR</a><span style="line-height: 1.4285715;">&#160;(now Felix Connect) which provides a service registry without using a fully compliant OSGi container. This allows defining real unit tests (as opposed to integration tests using </span><a shape="rect" class="external-link" href="http://team.ops4j.org/wiki/display/paxexam/Pax+Exam" style="line-height: 1.4285715;" rel="nofollow">Pax Exam</a><span style="line-height: 1.4285715;">. Please make sure all test jars in your classpath are OSGi bundles.</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 // tag::example[]
 // to use camel-test-blueprint, then extend the CamelBlueprintTestSupport class,
@@ -140,7 +140,7 @@ public class DebugBlueprintTest extends
 }
 // end::example[]
 ]]></script>
-</div></div><p>Also notice the use of <strong><code>getBlueprintDescriptor</code></strong> to specify the location of the OSGi Blueprint XML file.<br clear="none"> If you have multiple OSGi Blueprint XML files, then you can specify them with a comma-separated list in the <strong><code>getBlueprintDescriptor</code></strong> method.</p><p>Here's the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml?view=markup">Blueprint XML file</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Also notice the use of <strong><code>getBlueprintDescriptor</code></strong> to specify the location of the OSGi Blueprint XML file.<br clear="none"> If you have multiple OSGi Blueprint XML files, then you can specify them with a comma-separated list in the <strong><code>getBlueprintDescriptor</code></strong> method.<p>Here's the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml?view=markup">Blueprint XML file</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
 &lt;!-- tag::example[] --&gt;
 &lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot;
@@ -163,7 +163,7 @@ public class DebugBlueprintTest extends
 &lt;/blueprint&gt;
 &lt;!-- end::example[] --&gt;
 ]]></script>
-</div></div><p>In order to define blueprint tests, add the following dependency in your pom:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>In order to define blueprint tests, add the following dependency to your pom:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-test-blueprint&lt;/artifactId&gt;
@@ -171,14 +171,14 @@ public class DebugBlueprintTest extends
   &lt;scope&gt;test&lt;/scope&gt;
 &lt;/dependency&gt;
 ]]></script>
-</div></div><h3 id="BlueprintTesting-Classpathscanning">Classpath scanning</h3><p>By default PojoSR test container scans the test classpath for all the OSGi bundles available there. All the bundles with Blueprint descriptor files will be automatically started by the test container. If you would like to prevent particular bundles from being started by the test container, override the <code><strong>getBundleFilter</strong></code> method, just as demonstrated on the snippet below.&#160;</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="BlueprintTesting-Classpathscanning">Classpath scanning</h3><p>By default PojoSR test container scans the test classpath for all the OSGi bundles available there. All the bundles with Blueprint descriptor files will be automatically started by the test container. If you would like to prevent particular bundles from being started by the test container, override the <code><strong>getBundleFilter</strong></code> method, just as demonstrated in the snippet below.&#160;</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@Override
 protected String getBundleFilter() {
   // I don&#39;t want test container to scan and load Logback bundle during the test
   return &quot;(!(Bundle-SymbolicName=ch.qos.logback.core))&quot;;
 }
 ]]></script>
-</div></div><p class="caseCommentStyle privateComment"><br clear="none">Keep in mind that not specifying the Blueprint descriptor in the <strong><code>getBlueprintDescriptor</code></strong> method will not prevent the test container from loading given descriptor. Bundle filter method is the proper way of filtering out bundles you don't want to start during the test.</p><h3 id="BlueprintTesting-SettingtimeoutwhengettingCamelContext">Setting timeout when getting CamelContext</h3><p><strong>Available as of Camel 2.13.0/2.12.1/2.11.2</strong></p><p><code>CamelBlueprintTestSupport</code> waits 30 sec for Camel Context to be ready by default, now you can override this value in two ways:</p><ul><li>Globally, by setting <code>org.apache.camel.test.blueprint.camelContextCreationTimeout</code> system property.</li><li>Locally for each test, by overriding <em>getCamelContextCreationTimeout</em> method.</li></ul><h3 id="BlueprintTesting-Addingservicesonstartup">Adding services on startup</h3><p
 ><strong>Available as of Camel 2.11.2/2.12.0</strong></p><p>When using <code>camel-test-blueprint</code> you may do unit tests which requires using shared services which is not available during unit testing, but only in the real OSGi container, for example a shared <code>DataSource</code>.</p><p>To make it easier to register services on startup, such as a standalone <code>DataSource</code> or any other service, you can override the method <code>addServicesOnStartup</code> when your unit test class extends <code>CamelBlueprintTestSupport</code>.</p><p>In the example below we register a service <code>org.apache.camel.test.blueprint.MyService</code> using the name <code>myService</code> having a property <code>beer=Carlsberg</code>, as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p class="caseCommentStyle privateComment"><br clear="none">Keep in mind that not specifying the Blueprint descriptor in the getBlueprintDescriptor method will not prevent the test container from loading a given descriptor. The <code>getBundleFilter</code> method is the proper way of filtering out bundles you don't want to start during the test.</p><h3 id="BlueprintTesting-SettingtimeoutwhengettingCamelContext">Setting timeout when getting CamelContext</h3><p><strong>Available as of Camel 2.13.0/2.12.1/2.11.2</strong></p><p><code>CamelBlueprintTestSupport</code> waits 30 seconds for Camel Context to be ready by default, now you can override this value in two ways:</p><ul><li>Globally, by setting <code>org.apache.camel.test.blueprint.camelContextCreationTimeout</code> system property.</li><li>Locally for each test, by overriding <em>getCamelContextCreationTimeout</em> method.</li></ul><h3 id="BlueprintTesting-Addingservicesonstartup">Adding services on startup</h3><p><str
 ong>Available as of Camel 2.11.2/2.12.0</strong></p><p>When using <code>camel-test-blueprint</code> you may do unit tests which requires using shared services which are not available during unit testing, but only in the real OSGi container, for example a shared <code>DataSource</code>.</p><p>To make it easier to register services on startup, such as a standalone <code>DataSource</code> or any other service, you can override the method <code>addServicesOnStartup</code> when your unit test class extends <code>CamelBlueprintTestSupport</code>.</p><p>In the example below we register a service <code>org.apache.camel.test.blueprint.MyService</code> using the name <code>myService</code> having a property <code>beer=Carlsberg</code>, as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    @Override
     protected void addServicesOnStartup(Map&lt;String, KeyValueHolder&lt;Object, Dictionary&gt;&gt; services) {
         services.put(&quot;myService&quot;, asService(myService, &quot;beer&quot;, &quot;Carlsberg&quot;));

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.