You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jean-Sebastien Delfino <js...@apache.org> on 2007/03/01 08:52:50 UTC

Re: Running Java SCA Calculators sample?

[snip]
Simon Laws wrote:
> By way of light relief I thought I would try the same on the integration
> branch.
>
> * I was able to build and run the sample in the integration branch in mvn
> but the standalone runtime doesn't seem to be supported here either. 
> Is that
> correct?

Correct. You can do the following.

To build the branch:
cd branches/sca-java-integration
mvn

Then cd branches/sca-java-integration/samples/sca/calculator
mvn dependency:copy-dependencies <-- this is temporary until we get a 
good Tuscany distribution, it copies all the required jars to a single 
./target/dependencies folder so that you don't have to point to them in 
your Maven repos.
java -Djava.ext.dirs=target/dependency -jar 
target/tuscany-sample-calculator-0.1-integration-incubating-SNAPSHOT.jar
You should see:
3 + 2=5.0
3 - 2=1.0
3 * 2=6.0
3 / 2=1.5

> * Anyhow I took the next step and pulled the project into eclipse and 
> it was
> happy to let me debug the test as a JUnit test so I'm set for a bit of
> experimentation.
>

Cool, if others are interested here are the complete steps for an 
Eclipse user:
cd branches/sca-java-integration
mvn -Peclipse eclipse:eclipse
In your Eclipse Workbench configure an M2_REPO variable pointing to your 
Maven2 repository directory
 From the Eclipse Workbench menu bar select File / Import / Existing 
Projects into Workspace
Click Next
Select root directory: .../branches/sca-java-integration
Projects for all the modules in the branch will be selected, press Finish
You now have an Eclipse Workspace loaded with all the source code in the 
branch, including the samples.

Then it's very simple, you run the calculator sample like any other 
normal Java application.
 From the Package Explorer view, right click on Project 
tuscany-sample-calculator - class  src/main/java/calculator.CalculatorClient
Select Run As / Java Application
You should see:
3 + 2=5.0
3 - 2=1.0
3 * 2=6.0
3 / 2=1.5

To run the calculator test case:
 From the Package Explorer view, right click on Project 
tuscany-sample-calculator - class  src/test/java/calculator.CalculatorClient
Select Run As / JUnit Test (or Debug As / JUnit Test)

> I'm assuming that this mode of debugging will also work for Head but I
> haven't tried it yet. I'd be interested to know if there is a general 
> mode
> of operation for debugging samples that people have adopted, e.g. 
> debug from
>
>  standalone runtime
>  JUnit tests
>  With some clever mvn settings(?) and attach remotely
>  System.out :-)
>  Something else...
>

I'm usually following the steps I described above to debug in Eclipse.

> Regards
>
> Simon
>

-- 
Jean-Sebastien


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org