By the maven settings, non-java resource files in the src/main/java or src/test/java folders are not copied. Adding the composite file to src/main/resources or src/test/resources fixes the problem as you have noticed.

Thanks,
Raymond

----- Original Message ----- From: "Simon Laws" <[EMAIL PROTECTED]>
To: <tuscany-dev@ws.apache.org>
Sent: Tuesday, September 04, 2007 6:14 AM
Subject: Re: problem with resource initialization


On 9/4/07, mayank sharma <[EMAIL PROTECTED]> wrote:

hi,

I am working on a few simple test cases.

In this test case I am trying to initialize a domain.I have two separate
directory one for the java source and other for test cases.

I have a very simple question where does SCADomain.newInstance() look for
the composite file. In my case if I have it only with my code it gives me
a
nullpointerexception() . If I create a resource folder in my tests it
executes successfully.

Though when I look into the other test cases available with tuscany I can
see they have used the composite files only once in the resources folder.

Can someone please explain me more on this..?

Regards
Mayank Sharma


Hi Mayank

I believe it looks on the current classpath. As we run our tests through
maven our resource directory (for samples this is main/resources) is copied,
by maven, to the classpath (target/classes) and hence is available for the
runtime to pickup. It maybe in you case that resources in the source
directory are not available on the classpath.

The domain also has to be told which composites are expected to be deployed.
You'll note that in a lot of our samples this is done using a single
parameter to the SCAomain. For exampl, if you look in the CalculatorTestCase
that comes with the Calculator sample [1] you can see the line that starts
the domain

scaDomain = SCADomain.newInstance("Calculator.composite");

There are other ways of specifying which composites are going to be
deployed. For example, the FAQ [2] talks about the sca-contribution.xml file
and the sca-deployables directory.

As an aside we are just, at this moment, tidying up our SCADomain support.
Do you think its useful to provide a constructor like this that takes no
parameters and by default tries to load the contribution from the classpath?
I've always felt that appears a bit mysterious/magic and would rather have
contribution be an explicit step. Would welcome your views.

Regards

Simon


[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/calculator/src/test/java/calculator/CalculatorTestCase.java
[2]
http://incubator.apache.org/tuscany/tuscany-sca-java-faq.html#TuscanySCAJava-FAQ-ContributionQuestions



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to