[jboss-cvs] JBossAS SVN: r96582 - in projects/jboss-osgi/trunk/reactor/framework/src: main/java/org/jboss/osgi/framework/resolver/internal and 8 other directories.

Adrian Brock abrock at redhat.com
Thu Nov 19 11:33:44 EST 2009


You're still wasting your time.
You can't say I haven't given you enough warnings. :-)

I'd understand it if the tests were written properly
and tested the requirements. 
But these tests are written against implementation details:

On Thu, 2009-11-19 at 10:59 -0500, jboss-cvs-commits at lists.jboss.org
wrote:
> Author: thomas.diesler at jboss.com
> Date: 2009-11-19 10:59:11 -0500 (Thu, 19 Nov 2009)
> New Revision: 96582

>           Resolver resolver = getTestResolver();
>           assertEquals(1, resolver.getBundles().size());
>           
> -         ResolverBundle resolvableA = resolver.getBundle(bundleA.getSymbolicName(), null);
> -         assertNotNull("Resolvable not null", resolvableA);
> +         ResolverBundle resBundleA = resolver.getBundle(bundleA.getSymbolicName(), null);
> +         assertNotNull("Resolvable not null", resBundleA);
>           
> -         resolvableA = resolver.getBundle(bundleA.getSymbolicName(), bundleA.getVersion());
> -         assertNotNull("Resolvable not null", resolvableA);
> +         resBundleA = resolver.getBundle(bundleA.getSymbolicName(), bundleA.getVersion());
> +         assertNotNull("Resolvable not null", resBundleA);
>           
> -         resolvableA = resolver.getBundle(bundleA);
> -         assertNotNull("Resolvable not null", resolvableA);
> +         resBundleA = resolver.getBundle(bundleA);
> +         assertNotNull("Resolvable not null", resBundleA);

So I can't use them when I do this properly using jboss-cl.

That's why its never a good idea to write regression tests
against implementation details, you should write to the 
exposed public interface.

i.e. which bundle did it load that class from?
See for example ExportImportPackageUnitTestCase

P.S. I also recently added a 

deployBundle(String name, OSGiMetaData metaData, Class<?>... packages)

so you don't need to create a MANIFEST.MF for each test. You
just populate the OSGiMetaData programmatically in your test code.
It still needs a builder to make this easier.

See for example testAssembledDeployment() in the smoke tests.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Adrian Brock
Chief Scientist
JBoss by Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx




More information about the jboss-cvs-commits mailing list