Author: thomas.diesler(a)jboss.com
Date: 2009-06-03 12:27:45 -0400 (Wed, 03 Jun 2009)
New Revision: 89750
Added:
projects/jboss-osgi/trunk/docbook/en/images/husky-design.png
projects/jboss-osgi/trunk/docbook/en/images/husky-problem.png
projects/jboss-osgi/trunk/docbook/src/main/graphics/jbossosgi-testing.odp
Removed:
projects/jboss-osgi/trunk/docbook/src/main/graphics/osgi-remote-logging.odp
Modified:
projects/jboss-osgi/trunk/docbook/en/modules/ch050-developer-guide.xml
projects/jboss-osgi/trunk/docbook/en/modules/ch060-husky-testing.xml
projects/jboss-osgi/trunk/docbook/en/modules/ch070-provided-bundles.xml
projects/jboss-osgi/trunk/docbook/en/modules/ch080-provided-examples.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
Log:
husky testing - WIP
Added: projects/jboss-osgi/trunk/docbook/en/images/husky-design.png
===================================================================
(Binary files differ)
Property changes on: projects/jboss-osgi/trunk/docbook/en/images/husky-design.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/jboss-osgi/trunk/docbook/en/images/husky-problem.png
===================================================================
(Binary files differ)
Property changes on: projects/jboss-osgi/trunk/docbook/en/images/husky-problem.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch050-developer-guide.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch050-developer-guide.xml 2009-06-03
15:54:29 UTC (rev 89749)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch050-developer-guide.xml 2009-06-03
16:27:45 UTC (rev 89750)
@@ -316,9 +316,7 @@
{
@ProvideContext
public BundleContext context;
-
...
-
@Test
public void testSimpleBundle() throws Exception
{
Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch060-husky-testing.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch060-husky-testing.xml 2009-06-03
15:54:29 UTC (rev 89749)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch060-husky-testing.xml 2009-06-03
16:27:45 UTC (rev 89750)
@@ -8,10 +8,58 @@
<sect1 xml:id="SecHuskyOverview">
<title>Overview</title>
- <para>[TODO]</para>
+ <para>For JBoss OSGi I was looking for ways to test bundles that are deployed
to a remote instance of the
+ <link linkend="ChapRuntime">JBoss OSGi Runtime</link>. I wanted
the solution to also work with an OSGi Framework
+ that is bootstrapped from within a JUnit test case.</para>
+
+ <para>The basic problem is of course that you cannot access the artefacts that
you deploy in a bundle directly from your test case,
+ because they are loaded from different classloaders.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/husky-problem.png"/>
+ </imageobject>
+ </mediaobject>
+
+ <para>Former releases of JBoss OSGi used an approach which is documented in
+ <ulink
url="http://jbossosgi.blogspot.com/2009/04/non-intrusive-osgi-bundle...
intrusive OSGi Bundle Testing</ulink> and
+ is still available. Although the remote logging approach worked for simple scenarios,
it does not allow for fine grained interaction with
+ the OSGi Framework (i.e. access to the registry). An additional problem was the
asynchronous nature of LogEntry delivery.</para>
+
+ <para>For this release however, I revisited the problem and added a few more
requirements.</para>
+
+ <itemizedlist>
+ <listitem>Test cases SHOULD be plain JUnit4 POJOs</listitem>
+ <listitem>There SHOULD be no requirement to extend a specific test base
class</listitem>
+ <listitem>There MUST be no requirement on a specific test runner (i.e. MUST
run with Maven)</listitem>
+ <listitem>There SHOULD be a minimum test framework leakage into the test
case</listitem>
+ <listitem>The test framework MUST support embedded and remote OSGi runtimes
with no change required to the test</listitem>
+ <listitem>The same test case MUST be executable from outside as well as from
within the OSGi Framework</listitem>
+ <listitem>There SHOULD be a pluggable communication layer from the test
runner to the OSGi Framework</listitem>
+ <listitem>The test framework MUST NOT depend on OSGi Framework specific
features</listitem>
+ <listitem>There MUST be no automated creation of test bundles required by the
test framework</listitem>
+ </itemizedlist>
+
+ <para>The next section explains the solution that now comes as JBoss OSGi
Husky</para>
+
</sect1>
+ <sect1 xml:id="SecHuskyArchitecture">
+ <title>Architecture</title>
+
+ <para>JBoss OSGi Husky is a OSGi test framework that can be installed in any
OSGi Runtime. It comes with pluggable a
+ test invocation layer suitable for in process and remote test method
invocations.</para>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/husky-design.png"/>
+ </imageobject>
+ </mediaobject>
+
+ <para>Here is how it works </para>
+
+ </sect1>
+
<sect1 xml:id="SecHuskyConfiguration">
<title>Configuration</title>
Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch070-provided-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch070-provided-bundles.xml 2009-06-03
15:54:29 UTC (rev 89749)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch070-provided-bundles.xml 2009-06-03
16:27:45 UTC (rev 89750)
@@ -172,10 +172,6 @@
<programlisting role="JAVA">
public class SomeService
{
- private BundleContext context;
-
- ...
-
public String callSomeBean(String msg)
{
ServiceReference sref =
context.getServiceReference(MicrocontainerService.class.getName());
Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch080-provided-examples.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch080-provided-examples.xml 2009-06-03
15:54:29 UTC (rev 89749)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch080-provided-examples.xml 2009-06-03
16:27:45 UTC (rev 89750)
@@ -69,7 +69,7 @@
<sect1 xml:id="SecSimpleExample">
<title>Simple Example</title>
- <para>The simple example is covered in: <link
linked="SecWritingTests">Writing Test Cases</link></para>
+ <para>The simple example is covered in: <link
linkend="SecWritingTests">Writing Test Cases</link></para>
</sect1>
<sect1 xml:id="SecJMXServiceExample">
@@ -124,9 +124,11 @@
}
</programlisting>
- <para>Please note that access to the MBeanServer from the test case is part of
the
- <ulink
url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/testing/OSGiRuntime.html">
- OSGiRuntime</ulink>abstraction.</para>
+ <note>
+ <para>Please note that access to the MBeanServer from the test case is part
of the
+ <ulink
url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/testing/OSGiRuntime.html">
+ OSGiRuntime</ulink> abstraction.</para>
+ </note>
</sect1>
@@ -168,9 +170,11 @@
}
</programlisting>
- <para>Please note that access to the InitialContext from the test case is part
of the
- <ulink
url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/testing/OSGiRuntime.html">
- OSGiRuntime</ulink>abstraction.</para>
+ <note>
+ <para>Please note that access to the InitialContext from the test case is
part of the
+ <ulink
url="http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/javadoc/org/jboss/osgi/spi/testing/OSGiRuntime.html">
+ OSGiRuntime</ulink> abstraction.</para>
+ </note>
</sect1>
Added: projects/jboss-osgi/trunk/docbook/src/main/graphics/jbossosgi-testing.odp
===================================================================
(Binary files differ)
Property changes on:
projects/jboss-osgi/trunk/docbook/src/main/graphics/jbossosgi-testing.odp
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: projects/jboss-osgi/trunk/docbook/src/main/graphics/osgi-remote-logging.odp
===================================================================
(Binary files differ)
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
===================================================================
---
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-06-03
15:54:29 UTC (rev 89749)
+++
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-06-03
16:27:45 UTC (rev 89750)
@@ -36,7 +36,6 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.osgi.framework.Bundle;
/**
* A test that deployes a bundle that binds a String to JNDI