Not so fast :((
When I added this to ant script:
and then I get this exception:
[junit] ---- exception
report ----------------------------------------------
------------
[junit] Exception: org.apache.avalon.merlin.KernelException
[junit] Message: Install failure:
file:/C:/projekty/mrt-vend2/src/conf/block
-locationdao-test.xml
[junit] ----
cause ---------------------------------------------------------
------------
[junit] Exception: org.apache.avalon.composition.model.ModelException
[junit] Message: Unable to create a nested deployment model:
hibernate-servi
ce in the containment model /.
[junit] ----
cause ---------------------------------------------------------
------------
[junit] Exception:
org.apache.avalon.composition.model.TypeUnknownException
[junit] Message: Unable to locate a component type descriptor for the
compon
ent class [com.mrt.service.hibernate.HibernateServiceImpl] in the
classloader.
Please verify that the component classname is correct and that a component
type
descriptor is included in a jar file available within the container
classloader.
[junit] ---- stack
trace ---------------------------------------------------
------------
[junit] org.apache.avalon.composition.model.TypeUnknownException: Unable
to
locate a component type descriptor for the component class
[com.mrt.service.hibe
rnate.HibernateServiceImpl] in the classloader. Please verify that the
componen
t classname is correct and that a component type descriptor is included in a
jar
file available within the container classloader.
[junit]
org.apache.avalon.composition.model.impl.DefaultTypeRepository.getTy
pe(DefaultTypeRepository.java:277)
[junit]
org.apache.avalon.composition.model.impl.DefaultTypeRepository.getTy
pe(DefaultTypeRepository.java:242)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.cre
ateDeploymentModel(DefaultContainmentModel.java:544)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.add
Model(DefaultContainmentModel.java:397)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.<in
it>(DefaultContainmentModel.java:221)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.cre
ateContainmentModel(DefaultContainmentModel.java:651)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.cre
ateContainmentModel(DefaultContainmentModel.java:597)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.cre
ateContainmentModel(DefaultContainmentModel.java:844)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.add
ContainmentModel(DefaultContainmentModel.java:376)
[junit]
org.apache.avalon.composition.model.impl.DefaultContainmentModel.add
Model(DefaultContainmentModel.java:370)
[junit]
org.apache.avalon.merlin.impl.DefaultFactory.create(DefaultFactory.j
ava:488)
[junit]
org.apache.avalon.merlin.unit.AbstractMerlinTestCase.setUp(AbstractM
erlinTestCase.java:198)
[junit] junit.framework.TestCase.runBare(TestCase.java:125)
[junit] junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] junit.framework.TestResult.run(TestResult.java:109)
[junit] junit.framework.TestCase.run(TestCase.java:118)
[junit] junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] junit.framework.TestSuite.run(TestSuite.java:203)
[junit]
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUn
itTestRunner.java:325)
[junit]
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JU
nitTestRunner.java:536)
[junit] --------------------------------------------------------------------
------------
It looks like root container classloader can't find component type
description when itsn't in block.xml classloader.
----- Original Message -----
From: "Stephen McConnell" <[EMAIL PROTECTED]>
To: "Avalon framework users" <[EMAIL PROTECTED]>
Sent: Thursday, March 04, 2004 2:49 PM
Subject: Re: Ant,JUnit and AbstractMerlinTestCase
Jarosław Pałka wrote:
> It's me again :))
Hi! Guess what - I figured out your problem. You defining a
classloader using junit which contains a bunch of classes that are
dependent on resources you have registered in merlin. Here is the graph:
0. system classloader
1. ant classloader
2. junit classloader <------ contains your test classes which
are presumably dependent on your
build classes
3. merlin api classloader <- contains abstract log enabled
When the JVM loads you test class or a build class it looks for
dependent classes up the hierarchy. In the above scenario the classes
are actually in a classloader below the location of the test and build
classes. To resolve this you should add the resources that are declared
in the container classloader definition to the junit classpath.
> I'am almost at the end of the road. Here is my ant target:
>
> <target name="unittest">
> <junit showoutput="true" fork="true" printsummary="yes">
> <classpath>
> <pathelement path="${build.tests.dir}"/>
> <pathelement path="${libs.dir}/merlin-kernel-unit-3.2.5.jar"/>
> <pathelement
path="${libs.dir}/avalon-repository-main-1.2.jar"/>
> <pathelement path="${libs.dir}/junit-3.8.1.jar"/>
Add all of the resources referenced in the container classloader
definition here (and your build directory as well).
> </classpath>
Adding the following line is also a good idea:
<sysproperty key="basedir" value="${basedir}"/>
> <batchtest fork="true" todir="${build.tests.dir}">
> <formatter type="xml"/>
> <fileset dir="${build.tests.dir}">
> <include name="com/mrt/vend/impl/tests/**"/>
> </fileset>
> </batchtest>
> </junit>
> </target>
I'm keeping my fingers crossed but my guess is the above changes should
solve the problem.
Stephen.
--
|------------------------------------------------|
| Magic by Merlin |
| Production by Avalon |
| |
| http://avalon.apache.org/merlin |
| http://dpml.net/merlin/distributions/latest |
|------------------------------------------------|
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
Najwiekszy serwis aukcyjny w Internecie? Sprawdz!
>>> http://www.aukcje.interia.pl/ <<<
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]