felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Felix > Using the OSGi Compliance Tests
Date Thu, 19 Aug 2010 20:48:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=FELIX&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/FELIX/Using+the+OSGi+Compliance+Tests">Using
the OSGi Compliance Tests</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~heavy@ungoverned.org">Richard
S. Hall</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Gaining Access to OSGi CTs <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >The general process is to send
a request to the jcp-open@apache.org mailing requesting access. Since redistributing the OSGi
CTs is not allowed, you will need to submit an [NDA|http://www.apache.org/jcp/ApacheNDA.pdf]
to be granted <span class="diff-changed-words">access<span class="diff-added-chars"style="background-color:
#dfd;"> to the [SVN repo|https://svn</span>.<span class="diff-added-chars"style="background-color:
#dfd;">apache.org/repos/tck/osgi-cts] containing the binaries.</span></span>
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. OSGi CT Overview <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="UsingtheOSGiComplianceTests-UsingtheOSGiComplainceTests"></a>Using
the OSGi Complaince Tests</h1>

<p>The OSGi Alliance now provides Apache committers access to its Compliance Tests (CT).
This page describes how to get access to the CTs and how to use them with Felix subprojects.</p>

<h2><a name="UsingtheOSGiComplianceTests-GainingAccesstoOSGiCTs"></a>Gaining
Access to OSGi CTs</h2>

<p>The general process is to send a request to the jcp-open@apache.org mailing requesting
access. Since redistributing the OSGi CTs is not allowed, you will need to submit an <a
href="http://www.apache.org/jcp/ApacheNDA.pdf" class="external-link" rel="nofollow">NDA</a>
to be granted access to the <a href="https://svn.apache.org/repos/tck/osgi-cts" class="external-link"
rel="nofollow">SVN repo</a> containing the binaries.</p>

<h2><a name="UsingtheOSGiComplianceTests-OSGiCTOverview"></a>OSGi CT Overview</h2>

<p>The CT is delivered as two JAR files, one for the core CT and one for the compendium
CT. Each JAR file is composed of several other JAR files, which are the actual compliance
tests. Typically, there is one JAR per specification, except for the OSGi framework. The CT
uses BND as its testing harness, which in turn uses the OSGi R4.2 framework launching and
embedding API to configure, launch, and install test bundles. Each test JAR file has an associated
BND file which supplies the configuration BND needs to run the associated tests.</p>

<h2><a name="UsingtheOSGiComplianceTests-ModifyingtheBNDfiles"></a>Modifying
the BND files</h2>

<p>Modifying the BND files is fairly straightforward. A typical BND file looks like
this:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre># bnd pack for project org.osgi.test.cases.startlevel
# Mon Aug 31 18:50:18 EDT 2009
build=.

-target = \
    jar/org.osgi.test.cases.startlevel-4.2.0.jar;version=file,

-runpath = \
    jar/org.eclipse.osgi-3.5.1.jar;version=file, \
    jar/com.springsource.junit-3.8.2.jar;version=file;export="junit.framework;version=3.8"

-runbundles

-runproperties = \
report="true", \
osgi.compatibility.bootdelegation="false", \
osgi.resolverMode="strict"
</pre>
</div></div>

<p>The important parts are the following settings:</p>

<ul>
	<li><tt>-target</tt> specifies the bundles containing the tests.</li>
	<li><tt>-runpath</tt> specifies the class path used to run the tests.</li>
	<li><tt>-runbundles</tt> specifies the bundles to install for the tests.</li>
	<li><tt>-runproperties</tt> specifies configuration properties to pass
into the framework.</li>
</ul>


<p>The following two examples show how to edit these files for the Felix framework and
Felix bundle subprojects.</p>

<h2><a name="UsingtheOSGiComplianceTests-TestingtheFelixframework"></a>Testing
the Felix framework</h2>

<p>The Felix framework is tested against the core CT. The first thing to do is extract
the core CT JAR file, which includes test suites for:</p>

<ul>
	<li>Framework core (mandatory)</li>
	<li>Framework security (optional)</li>
	<li>Framework launching (mandatory)</li>
	<li>Framework launching security (optional)</li>
	<li>Package Admin (optional)</li>
	<li>Start Level (optional)</li>
	<li>URL Handlers (optional)</li>
	<li>Permission Admin (optional)</li>
	<li>Conditional Permission Admin (optional)</li>
</ul>


<p>For each of the associated BND files, the <tt>-runpath</tt> needs to
be edited to refer to the Felix framework; each one should look something like this after
editing:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>-runpath = \
    /path/to/felix/framework/org.apache.felix.framework-2.0.2.jar;version=file, \
    jar/com.springsource.junit-3.8.2.jar;version=file;export="junit.framework;version=3.8"
</pre>
</div></div>

<p>Typically, it is not necessary to change anything else in the BND files and it is
normal that the <tt>-runbundles</tt> setting is empty, since there are no additional
bundles associated with testing the framework. The exception to this is for the framework
test suites for security. To test with security enabled, you will need to add the framework
security provider in <tt>-runbundles</tt> like this:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>-runbundles = \
    /path/to/felix/framework.security/org.apache.felix.framework.security-1.0.0.jar.jar;version=file
</pre>
</div></div>

<p>After editing the BND files, run the tests using:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>source runtests
</pre>
</div></div>

<p>This will run all test suites for all BND files. To run a specific test suite, do
the following:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>java -jar jar/bnd.jar runtests -title osgi.ct &lt;bnd-file&gt;
</pre>
</div></div>

<p>Where <tt>&lt;bnd-file&gt;</tt> specifies one or more BND files
associated with the desired test suites.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Be Aware</b><br
/>Tests for native code loading will fail on Java 6, so do not use this JDK for testing
the framework.</td></tr></table></div>

<p>Reports for the tests suites are generated in the <tt>reports/</tt> subdirectory
and are named after the appropriate test suite.</p>

<h2><a name="UsingtheOSGiComplianceTests-TestingaFelixbundle"></a>Testing
a Felix bundle</h2>

<p>The core CT tests the framework implementation and its related services. The compendium
CT tests the various non-framework-related specifications, which are implemented as bundles.
For the most part, testing a bundle is similar to testing the framework.</p>

<p>Extract the compendium CT JAR file to access the individual test suites. Since most
compendium service specification test suites require security, it is necessary to use a framework
implementation that supports security. For the Felix framework, you will have to add the security
provider to the <tt>-runbundles</tt> to enable security. </p>

<p>For example, to test Felix' Event Admin bundle, edit the <tt>-runbundles</tt>
setting in <tt>org.osgi.test.cases.event.bnd</tt> to look something like this:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>-runbundles = \
    /path/to/felix/eventadmin/org.apache.felix.eventadmin-1.0.0.jar;version=file,\
    /path/to/felix/framework.security/org.apache.felix.framework.security-1.0.0.jar.jar;version=file
</pre>
</div></div>

<p>After editing the BND files to refer to the appropriate bundles, run the tests using:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>source runtests
</pre>
</div></div>

<p>This will run all test suites for all BND files. To run a specific test suite, do
the following:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>java -jar jar/bnd.jar runtests -title osgi.ct &lt;bnd-file&gt;
</pre>
</div></div>

<p>Where <tt>&lt;bnd-file&gt;</tt> specifies one or more BND files
associated with the desired test suites. Reports for the tests suites are generated in the
<tt>reports/</tt> subdirectory and are named after the appropriate test suite.</p>

<h2><a name="UsingtheOSGiComplianceTests-Feedback"></a>Feedback</h2>

<p>For any questions or feedback, subscribe to the Felix developers mailing list by
sending a message to <a href="mailto:dev-subscribe@felix.apache.org" class="external-link"
rel="nofollow">dev-subscribe@felix.apache.org</a>; after subscribing, email questions
or feedback to <a href="mailto:dev@felix.apache.org" class="external-link" rel="nofollow">dev@felix.apache.org</a>.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/FELIX/Using+the+OSGi+Compliance+Tests">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=9012133&revisedVersion=26&originalVersion=25">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/FELIX/Using+the+OSGi+Compliance+Tests?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message