You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Jon Lewis <wi...@gmail.com> on 2006/09/05 23:18:34 UTC
sample junit test case
hi All,
Is there a sample app that uses junit and a test case. I've looked at
the code in the repository and it looks like all the samples build on the
SCATestCase and that's testing the code base.
thanks in advance
Re: sample junit test case
Posted by Jon Lewis <wi...@gmail.com>.
can anyone provide some help on this? I would like to get a composite with
an associated junit test case up and running if possible. I've looked at
the source and it looks like all tests inherit from SCATestCase. I have
tried to mimic the SCATestCase, but things are failing.
thanks johnny!
On 9/7/06, Jon Lewis <wi...@gmail.com> wrote:
>
> hi everyone,
>
> here's some more information that may help out. I would really like
> to get this working, so any/all help is welcome. Right now it's failing on
> launcher.bootApplication(...). No stack is thrown...
>
> from my TestCase
>
>
> protected void setUp() throws Exception {
>
> ClassLoader cl = getClass().getClassLoader();
>
> String applicationSCDL = "META-INF/tuscany/system.scdl";
>
>
> URL applicationScdlURL = cl.getResource(applicationSCDL);
> if (applicationScdlURL == null) {
> throw new RuntimeException("application SCDL not found: " +
> applicationSCDL);
> }
>
> LauncherImpl launcher = new LauncherImpl();
> launcher.setApplicationLoader(cl);
>
> component = launcher.bootApplication("application",
> applicationScdlURL);
> component.start();
>
> context = new CompositeContextImpl(component);
> context.start();
>
> personnelService = context.locateService(PersonnelService.class,
> "PersonnelServiceComponent");
> }
>
> my system.scdl in META-INF/tuscany/
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <composite xmlns=" http://www.osoa.org/xmlns/sca/1.0"
> name="personnelsystem">
>
> <component name="PersonnelComponent">
> <implementation.composite name="personnelcomposite"/>
> </component>
>
> </composite>
>
>
> my default.scdl in META-INF/sca/
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> name="personnelcomposite">
>
> <service name="PersonnelService" >
> <interface.java interface="
> org.myCompany.personnel.composite.PersonnelService"/>
> <reference>PersonnelServiceComponent</reference>
> </service>
>
> <component name="PersonnelServiceComponent">
> <implementation.java class="
> org.myCompany.personnel.composite.PersonnelServiceImpl"/>
> </component>
>
> </composite>
>
> thx in advance!
>
>
>
>
>
> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
> >
> > hi all,
> >
> > I tried a different approach in my setUp for my testCase. It's
> > failing on the call to launcher.bootApplication(...)
> >
> > protected void setUp() throws Exception {
> >
> > ClassLoader cl = getClass().getClassLoader();
> >
> > String applicationSCDL = "META-INF/sca/default.scdl";
> >
> > URL applicationScdlURL = cl.getResource(applicationSCDL);
> >
> > if (applicationScdlURL == null) {
> > throw new RuntimeException("application SCDL not found: " +
> > applicationSCDL);
> > }
> >
> > LauncherImpl launcher = new LauncherImpl();
> > launcher.setApplicationLoader(cl);
> >
> > component = launcher.bootApplication("application",
> > applicationScdlURL);
> > component.start();
> >
> > context = new CompositeContextImpl(component);
> > context.start ();
> >
> > any and all help would be great, johnny
> >
> >
> >
> >
> > On 9/5/06, Jon Lewis < wise29@gmail.com> wrote:
> > >
> > > hi Jeremy (and all)...
> > >
> > > thanks for the feedback. I tried just using JUnit, but when I make
> > > the call to:
> > >
> > > CompositeContext context = CurrentCompositeContext.getContext();
> > >
> > > the context is coming back null. So, I'm assuming I need to do some
> > > setup, but don't know everything I need to setup I guess...
> > >
> > > thanks Johnny
> > >
> > >
> > >
> > >
> > > On 9/5/06, Jeremy Boynes < jboynes@apache.org> wrote:
> > > >
> > > > Jon,
> > > >
> > > > For unit testing application code you can use JUnit as normal (or
> > > > any
> > > > other framework such as TestNG) - perhaps using easymock or an
> > > > alternative to mock out the services the code is using.
> > > >
> > > > If you want to do integration testing you could deploy the
> > > > application to the runtime host and use an external framework such
> > > > as
> > > > httpunit.
> > > >
> > > > Or are you trying to do something else?
> > > > --
> > > > Jeremy
> > > >
> > > > On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
> > > >
> > > > > hi All,
> > > > >
> > > > > Is there a sample app that uses junit and a test case. I've
> > > > > looked at
> > > > > the code in the repository and it looks like all the samples build
> > > > > on the
> > > > > SCATestCase and that's testing the code base.
> > > > >
> > > > > thanks in advance
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > > >
> > > >
> > >
> >
>
Re: sample junit test case
Posted by Jon Lewis <wi...@gmail.com>.
Thanks Jeremy. I got a sample I created working using the command line
working. I would like to get it working in a test case, but for now I can
at least come up to speed on things without creating a full blown app...
thanks again...and yeah, I'll get on the IRC chat sometime with questions.
On 9/13/06, Jeremy Boynes <jb...@apache.org> wrote:
>
> Raymond, folk should not normally need to mess with system scdl, with
> the known defect that SCATestCase needs you to mess with this stuff
> to start adding in extensions.
>
> Jon, have you had a look at the calculator sample? The test case in
> there at
> https://svn.apache.org/repos/asf/incubator/tuscany/java/samples/sca/
> calculator/src/test/java/calculator/CalculatorTestCase.java
>
> shows how to get a simple composite loaded and running - we look for
> a default SCDL file at META-INF/sca/default.scdl
> https://svn.apache.org/repos/asf/incubator/tuscany/java/samples/sca/
> calculator/src/main/resources/META-INF/sca/default.scdl
>
> For the calculator, this is a single composite with the application
> components in it. If you have a more complex structure (includes,
> composite implementations for example) that should work but I would
> suggest getting something simple to work first.
>
> I hope this works for you - please don't give up on us quite yet :)
> If you can jump on IRC we can help you debug any environment stuff.
> --
> Jeremy
>
> On Sep 13, 2006, at 2:47 PM, Raymond Feng wrote:
>
> > Hi,
> >
> > It seems that you're using a wrong "system.scdl". The system.scdl
> > is meant to be the one declaring all the runtime components for the
> > Tuscany runtime (we use SCA components to build the container). You
> > can get a copy from the "test/src/main/resources/META-INF/tuscany/
> > system.scdl".
> >
> > Thanks,
> > Raymond
> >
> > ----- Original Message ----- From: "Jon Lewis" <wi...@gmail.com>
> > To: <tu...@ws.apache.org>
> > Sent: Thursday, September 07, 2006 2:21 PM
> > Subject: Re: sample junit test case
> >
> >
> >> hi everyone,
> >>
> >> here's some more information that may help out. I would really
> >> like to
> >> get this working, so any/all help is welcome. Right now it's
> >> failing on
> >> launcher.bootApplication(...). No stack is thrown...
> >>
> >> from my TestCase
> >>
> >> protected void setUp() throws Exception {
> >>
> >> ClassLoader cl = getClass().getClassLoader();
> >>
> >> String applicationSCDL = "META-INF/tuscany/system.scdl";
> >>
> >> URL applicationScdlURL = cl.getResource(applicationSCDL);
> >> if (applicationScdlURL == null) {
> >> throw new RuntimeException("application SCDL not found:
> >> " +
> >> applicationSCDL);
> >> }
> >>
> >> LauncherImpl launcher = new LauncherImpl();
> >> launcher.setApplicationLoader(cl);
> >>
> >> component = launcher.bootApplication("application",
> >> applicationScdlURL);
> >> component.start();
> >>
> >> context = new CompositeContextImpl(component);
> >> context.start();
> >>
> >> personnelService = context.locateService
> >> (PersonnelService.class,
> >> "PersonnelServiceComponent");
> >> }
> >>
> >> my system.scdl in META-INF/tuscany/
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >>
> >> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> >> name="personnelsystem">
> >>
> >> <component name="PersonnelComponent">
> >> <implementation.composite name="personnelcomposite"/>
> >> </component>
> >>
> >> </composite>
> >>
> >>
> >> my default.scdl in META-INF/sca/
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >>
> >> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> >> name="personnelcomposite">
> >>
> >> <service name="PersonnelService" >
> >> <interface.java interface="
> >> org.myCompany.personnel.composite.PersonnelService"/>
> >> <reference>PersonnelServiceComponent</reference>
> >> </service>
> >>
> >> <component name="PersonnelServiceComponent">
> >> <implementation.java class="
> >> org.myCompany.personnel.composite.PersonnelServiceImpl"/>
> >> </component>
> >>
> >> </composite>
> >>
> >> thx in advance!
> >>
> >>
> >>
> >>
> >> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
> >>>
> >>> hi all,
> >>>
> >>> I tried a different approach in my setUp for my testCase.
> >>> It's failing
> >>> on the call to launcher.bootApplication(...)
> >>>
> >>> protected void setUp() throws Exception {
> >>>
> >>> ClassLoader cl = getClass().getClassLoader();
> >>>
> >>> String applicationSCDL = "META-INF/sca/default.scdl";
> >>>
> >>> URL applicationScdlURL = cl.getResource(applicationSCDL);
> >>>
> >>> if (applicationScdlURL == null) {
> >>> throw new RuntimeException("application SCDL not
> >>> found: " +
> >>> applicationSCDL);
> >>> }
> >>>
> >>> LauncherImpl launcher = new LauncherImpl();
> >>> launcher.setApplicationLoader(cl);
> >>>
> >>> component = launcher.bootApplication("application",
> >>> applicationScdlURL);
> >>> component.start();
> >>>
> >>> context = new CompositeContextImpl(component);
> >>> context.start ();
> >>>
> >>> any and all help would be great, johnny
> >>>
> >>>
> >>>
> >>>
> >>> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
> >>> >
> >>> > hi Jeremy (and all)...
> >>> >
> >>> > thanks for the feedback. I tried just using JUnit, but when I
> >>> make the
> >>> > call to:
> >>> >
> >>> > CompositeContext context = CurrentCompositeContext.getContext();
> >>> >
> >>> > the context is coming back null. So, I'm assuming I need to do
> >>> some
> >>> > setup, but don't know everything I need to setup I guess...
> >>> >
> >>> > thanks Johnny
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > On 9/5/06, Jeremy Boynes < jboynes@apache.org> wrote:
> >>> > >
> >>> > > Jon,
> >>> > >
> >>> > > For unit testing application code you can use JUnit as normal
> >>> (or any
> >>> > > other framework such as TestNG) - perhaps using easymock or an
> >>> > > alternative to mock out the services the code is using.
> >>> > >
> >>> > > If you want to do integration testing you could deploy the
> >>> > > application to the runtime host and use an external framework
> >>> such as
> >>> > > httpunit.
> >>> > >
> >>> > > Or are you trying to do something else?
> >>> > > --
> >>> > > Jeremy
> >>> > >
> >>> > > On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
> >>> > >
> >>> > > > hi All,
> >>> > > >
> >>> > > > Is there a sample app that uses junit and a test case.
> >>> I've
> >>> > > > looked at
> >>> > > > the code in the repository and it looks like all the
> >>> samples build
> >>> > > > on the
> >>> > > > SCATestCase and that's testing the code base.
> >>> > > >
> >>> > > > thanks in advance
> >>> > >
> >>> > >
> >>> > >
> >>> --------------------------------------------------------------------
> >>> -
> >>> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> >>> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >>> > >
> >>> > >
> >>> >
> >>>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
Re: sample junit test case
Posted by Jeremy Boynes <jb...@apache.org>.
Raymond, folk should not normally need to mess with system scdl, with
the known defect that SCATestCase needs you to mess with this stuff
to start adding in extensions.
Jon, have you had a look at the calculator sample? The test case in
there at
https://svn.apache.org/repos/asf/incubator/tuscany/java/samples/sca/
calculator/src/test/java/calculator/CalculatorTestCase.java
shows how to get a simple composite loaded and running - we look for
a default SCDL file at META-INF/sca/default.scdl
https://svn.apache.org/repos/asf/incubator/tuscany/java/samples/sca/
calculator/src/main/resources/META-INF/sca/default.scdl
For the calculator, this is a single composite with the application
components in it. If you have a more complex structure (includes,
composite implementations for example) that should work but I would
suggest getting something simple to work first.
I hope this works for you - please don't give up on us quite yet :)
If you can jump on IRC we can help you debug any environment stuff.
--
Jeremy
On Sep 13, 2006, at 2:47 PM, Raymond Feng wrote:
> Hi,
>
> It seems that you're using a wrong "system.scdl". The system.scdl
> is meant to be the one declaring all the runtime components for the
> Tuscany runtime (we use SCA components to build the container). You
> can get a copy from the "test/src/main/resources/META-INF/tuscany/
> system.scdl".
>
> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Jon Lewis" <wi...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, September 07, 2006 2:21 PM
> Subject: Re: sample junit test case
>
>
>> hi everyone,
>>
>> here's some more information that may help out. I would really
>> like to
>> get this working, so any/all help is welcome. Right now it's
>> failing on
>> launcher.bootApplication(...). No stack is thrown...
>>
>> from my TestCase
>>
>> protected void setUp() throws Exception {
>>
>> ClassLoader cl = getClass().getClassLoader();
>>
>> String applicationSCDL = "META-INF/tuscany/system.scdl";
>>
>> URL applicationScdlURL = cl.getResource(applicationSCDL);
>> if (applicationScdlURL == null) {
>> throw new RuntimeException("application SCDL not found:
>> " +
>> applicationSCDL);
>> }
>>
>> LauncherImpl launcher = new LauncherImpl();
>> launcher.setApplicationLoader(cl);
>>
>> component = launcher.bootApplication("application",
>> applicationScdlURL);
>> component.start();
>>
>> context = new CompositeContextImpl(component);
>> context.start();
>>
>> personnelService = context.locateService
>> (PersonnelService.class,
>> "PersonnelServiceComponent");
>> }
>>
>> my system.scdl in META-INF/tuscany/
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
>> name="personnelsystem">
>>
>> <component name="PersonnelComponent">
>> <implementation.composite name="personnelcomposite"/>
>> </component>
>>
>> </composite>
>>
>>
>> my default.scdl in META-INF/sca/
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
>> name="personnelcomposite">
>>
>> <service name="PersonnelService" >
>> <interface.java interface="
>> org.myCompany.personnel.composite.PersonnelService"/>
>> <reference>PersonnelServiceComponent</reference>
>> </service>
>>
>> <component name="PersonnelServiceComponent">
>> <implementation.java class="
>> org.myCompany.personnel.composite.PersonnelServiceImpl"/>
>> </component>
>>
>> </composite>
>>
>> thx in advance!
>>
>>
>>
>>
>> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
>>>
>>> hi all,
>>>
>>> I tried a different approach in my setUp for my testCase.
>>> It's failing
>>> on the call to launcher.bootApplication(...)
>>>
>>> protected void setUp() throws Exception {
>>>
>>> ClassLoader cl = getClass().getClassLoader();
>>>
>>> String applicationSCDL = "META-INF/sca/default.scdl";
>>>
>>> URL applicationScdlURL = cl.getResource(applicationSCDL);
>>>
>>> if (applicationScdlURL == null) {
>>> throw new RuntimeException("application SCDL not
>>> found: " +
>>> applicationSCDL);
>>> }
>>>
>>> LauncherImpl launcher = new LauncherImpl();
>>> launcher.setApplicationLoader(cl);
>>>
>>> component = launcher.bootApplication("application",
>>> applicationScdlURL);
>>> component.start();
>>>
>>> context = new CompositeContextImpl(component);
>>> context.start ();
>>>
>>> any and all help would be great, johnny
>>>
>>>
>>>
>>>
>>> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
>>> >
>>> > hi Jeremy (and all)...
>>> >
>>> > thanks for the feedback. I tried just using JUnit, but when I
>>> make the
>>> > call to:
>>> >
>>> > CompositeContext context = CurrentCompositeContext.getContext();
>>> >
>>> > the context is coming back null. So, I'm assuming I need to do
>>> some
>>> > setup, but don't know everything I need to setup I guess...
>>> >
>>> > thanks Johnny
>>> >
>>> >
>>> >
>>> >
>>> > On 9/5/06, Jeremy Boynes < jboynes@apache.org> wrote:
>>> > >
>>> > > Jon,
>>> > >
>>> > > For unit testing application code you can use JUnit as normal
>>> (or any
>>> > > other framework such as TestNG) - perhaps using easymock or an
>>> > > alternative to mock out the services the code is using.
>>> > >
>>> > > If you want to do integration testing you could deploy the
>>> > > application to the runtime host and use an external framework
>>> such as
>>> > > httpunit.
>>> > >
>>> > > Or are you trying to do something else?
>>> > > --
>>> > > Jeremy
>>> > >
>>> > > On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
>>> > >
>>> > > > hi All,
>>> > > >
>>> > > > Is there a sample app that uses junit and a test case.
>>> I've
>>> > > > looked at
>>> > > > the code in the repository and it looks like all the
>>> samples build
>>> > > > on the
>>> > > > SCATestCase and that's testing the code base.
>>> > > >
>>> > > > thanks in advance
>>> > >
>>> > >
>>> > >
>>> --------------------------------------------------------------------
>>> -
>>> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
>>> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
>>> > >
>>> > >
>>> >
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: sample junit test case
Posted by Raymond Feng <en...@gmail.com>.
Hi,
It seems that you're using a wrong "system.scdl". The system.scdl is meant
to be the one declaring all the runtime components for the Tuscany runtime
(we use SCA components to build the container). You can get a copy from the
"test/src/main/resources/META-INF/tuscany/system.scdl".
Thanks,
Raymond
----- Original Message -----
From: "Jon Lewis" <wi...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Thursday, September 07, 2006 2:21 PM
Subject: Re: sample junit test case
> hi everyone,
>
> here's some more information that may help out. I would really like to
> get this working, so any/all help is welcome. Right now it's failing on
> launcher.bootApplication(...). No stack is thrown...
>
> from my TestCase
>
> protected void setUp() throws Exception {
>
> ClassLoader cl = getClass().getClassLoader();
>
> String applicationSCDL = "META-INF/tuscany/system.scdl";
>
> URL applicationScdlURL = cl.getResource(applicationSCDL);
> if (applicationScdlURL == null) {
> throw new RuntimeException("application SCDL not found: " +
> applicationSCDL);
> }
>
> LauncherImpl launcher = new LauncherImpl();
> launcher.setApplicationLoader(cl);
>
> component = launcher.bootApplication("application",
> applicationScdlURL);
> component.start();
>
> context = new CompositeContextImpl(component);
> context.start();
>
> personnelService = context.locateService(PersonnelService.class,
> "PersonnelServiceComponent");
> }
>
> my system.scdl in META-INF/tuscany/
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> name="personnelsystem">
>
> <component name="PersonnelComponent">
> <implementation.composite name="personnelcomposite"/>
> </component>
>
> </composite>
>
>
> my default.scdl in META-INF/sca/
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> name="personnelcomposite">
>
> <service name="PersonnelService" >
> <interface.java interface="
> org.myCompany.personnel.composite.PersonnelService"/>
> <reference>PersonnelServiceComponent</reference>
> </service>
>
> <component name="PersonnelServiceComponent">
> <implementation.java class="
> org.myCompany.personnel.composite.PersonnelServiceImpl"/>
> </component>
>
> </composite>
>
> thx in advance!
>
>
>
>
> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
>>
>> hi all,
>>
>> I tried a different approach in my setUp for my testCase. It's
>> failing
>> on the call to launcher.bootApplication(...)
>>
>> protected void setUp() throws Exception {
>>
>> ClassLoader cl = getClass().getClassLoader();
>>
>> String applicationSCDL = "META-INF/sca/default.scdl";
>>
>> URL applicationScdlURL = cl.getResource(applicationSCDL);
>>
>> if (applicationScdlURL == null) {
>> throw new RuntimeException("application SCDL not found: " +
>> applicationSCDL);
>> }
>>
>> LauncherImpl launcher = new LauncherImpl();
>> launcher.setApplicationLoader(cl);
>>
>> component = launcher.bootApplication("application",
>> applicationScdlURL);
>> component.start();
>>
>> context = new CompositeContextImpl(component);
>> context.start ();
>>
>> any and all help would be great, johnny
>>
>>
>>
>>
>> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
>> >
>> > hi Jeremy (and all)...
>> >
>> > thanks for the feedback. I tried just using JUnit, but when I make the
>> > call to:
>> >
>> > CompositeContext context = CurrentCompositeContext.getContext();
>> >
>> > the context is coming back null. So, I'm assuming I need to do some
>> > setup, but don't know everything I need to setup I guess...
>> >
>> > thanks Johnny
>> >
>> >
>> >
>> >
>> > On 9/5/06, Jeremy Boynes < jboynes@apache.org> wrote:
>> > >
>> > > Jon,
>> > >
>> > > For unit testing application code you can use JUnit as normal (or any
>> > > other framework such as TestNG) - perhaps using easymock or an
>> > > alternative to mock out the services the code is using.
>> > >
>> > > If you want to do integration testing you could deploy the
>> > > application to the runtime host and use an external framework such as
>> > > httpunit.
>> > >
>> > > Or are you trying to do something else?
>> > > --
>> > > Jeremy
>> > >
>> > > On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
>> > >
>> > > > hi All,
>> > > >
>> > > > Is there a sample app that uses junit and a test case. I've
>> > > > looked at
>> > > > the code in the repository and it looks like all the samples build
>> > > > on the
>> > > > SCATestCase and that's testing the code base.
>> > > >
>> > > > thanks in advance
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
>> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
>> > >
>> > >
>> >
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: sample junit test case
Posted by Jon Lewis <wi...@gmail.com>.
hi everyone,
here's some more information that may help out. I would really like to
get this working, so any/all help is welcome. Right now it's failing on
launcher.bootApplication(...). No stack is thrown...
from my TestCase
protected void setUp() throws Exception {
ClassLoader cl = getClass().getClassLoader();
String applicationSCDL = "META-INF/tuscany/system.scdl";
URL applicationScdlURL = cl.getResource(applicationSCDL);
if (applicationScdlURL == null) {
throw new RuntimeException("application SCDL not found: " +
applicationSCDL);
}
LauncherImpl launcher = new LauncherImpl();
launcher.setApplicationLoader(cl);
component = launcher.bootApplication("application",
applicationScdlURL);
component.start();
context = new CompositeContextImpl(component);
context.start();
personnelService = context.locateService(PersonnelService.class,
"PersonnelServiceComponent");
}
my system.scdl in META-INF/tuscany/
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="personnelsystem">
<component name="PersonnelComponent">
<implementation.composite name="personnelcomposite"/>
</component>
</composite>
my default.scdl in META-INF/sca/
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="personnelcomposite">
<service name="PersonnelService" >
<interface.java interface="
org.myCompany.personnel.composite.PersonnelService"/>
<reference>PersonnelServiceComponent</reference>
</service>
<component name="PersonnelServiceComponent">
<implementation.java class="
org.myCompany.personnel.composite.PersonnelServiceImpl"/>
</component>
</composite>
thx in advance!
On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
>
> hi all,
>
> I tried a different approach in my setUp for my testCase. It's failing
> on the call to launcher.bootApplication(...)
>
> protected void setUp() throws Exception {
>
> ClassLoader cl = getClass().getClassLoader();
>
> String applicationSCDL = "META-INF/sca/default.scdl";
>
> URL applicationScdlURL = cl.getResource(applicationSCDL);
>
> if (applicationScdlURL == null) {
> throw new RuntimeException("application SCDL not found: " +
> applicationSCDL);
> }
>
> LauncherImpl launcher = new LauncherImpl();
> launcher.setApplicationLoader(cl);
>
> component = launcher.bootApplication("application",
> applicationScdlURL);
> component.start();
>
> context = new CompositeContextImpl(component);
> context.start ();
>
> any and all help would be great, johnny
>
>
>
>
> On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
> >
> > hi Jeremy (and all)...
> >
> > thanks for the feedback. I tried just using JUnit, but when I make the
> > call to:
> >
> > CompositeContext context = CurrentCompositeContext.getContext();
> >
> > the context is coming back null. So, I'm assuming I need to do some
> > setup, but don't know everything I need to setup I guess...
> >
> > thanks Johnny
> >
> >
> >
> >
> > On 9/5/06, Jeremy Boynes < jboynes@apache.org> wrote:
> > >
> > > Jon,
> > >
> > > For unit testing application code you can use JUnit as normal (or any
> > > other framework such as TestNG) - perhaps using easymock or an
> > > alternative to mock out the services the code is using.
> > >
> > > If you want to do integration testing you could deploy the
> > > application to the runtime host and use an external framework such as
> > > httpunit.
> > >
> > > Or are you trying to do something else?
> > > --
> > > Jeremy
> > >
> > > On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
> > >
> > > > hi All,
> > > >
> > > > Is there a sample app that uses junit and a test case. I've
> > > > looked at
> > > > the code in the repository and it looks like all the samples build
> > > > on the
> > > > SCATestCase and that's testing the code base.
> > > >
> > > > thanks in advance
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > >
> > >
> >
>
Re: sample junit test case
Posted by Jon Lewis <wi...@gmail.com>.
hi all,
I tried a different approach in my setUp for my testCase. It's failing
on the call to launcher.bootApplication(...)
protected void setUp() throws Exception {
ClassLoader cl = getClass().getClassLoader();
String applicationSCDL = "META-INF/sca/default.scdl";
URL applicationScdlURL = cl.getResource(applicationSCDL);
if (applicationScdlURL == null) {
throw new RuntimeException("application SCDL not found: " +
applicationSCDL);
}
LauncherImpl launcher = new LauncherImpl();
launcher.setApplicationLoader(cl);
component = launcher.bootApplication("application",
applicationScdlURL);
component.start();
context = new CompositeContextImpl(component);
context.start();
any and all help would be great, johnny
On 9/5/06, Jon Lewis <wi...@gmail.com> wrote:
>
> hi Jeremy (and all)...
>
> thanks for the feedback. I tried just using JUnit, but when I make the
> call to:
>
> CompositeContext context = CurrentCompositeContext.getContext();
>
> the context is coming back null. So, I'm assuming I need to do some
> setup, but don't know everything I need to setup I guess...
>
> thanks Johnny
>
>
>
>
> On 9/5/06, Jeremy Boynes <jb...@apache.org> wrote:
> >
> > Jon,
> >
> > For unit testing application code you can use JUnit as normal (or any
> > other framework such as TestNG) - perhaps using easymock or an
> > alternative to mock out the services the code is using.
> >
> > If you want to do integration testing you could deploy the
> > application to the runtime host and use an external framework such as
> > httpunit.
> >
> > Or are you trying to do something else?
> > --
> > Jeremy
> >
> > On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
> >
> > > hi All,
> > >
> > > Is there a sample app that uses junit and a test case. I've
> > > looked at
> > > the code in the repository and it looks like all the samples build
> > > on the
> > > SCATestCase and that's testing the code base.
> > >
> > > thanks in advance
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
Re: sample junit test case
Posted by Jon Lewis <wi...@gmail.com>.
hi Jeremy (and all)...
thanks for the feedback. I tried just using JUnit, but when I make the call
to:
CompositeContext context = CurrentCompositeContext.getContext();
the context is coming back null. So, I'm assuming I need to do some setup,
but don't know everything I need to setup I guess...
thanks Johnny
On 9/5/06, Jeremy Boynes <jb...@apache.org> wrote:
>
> Jon,
>
> For unit testing application code you can use JUnit as normal (or any
> other framework such as TestNG) - perhaps using easymock or an
> alternative to mock out the services the code is using.
>
> If you want to do integration testing you could deploy the
> application to the runtime host and use an external framework such as
> httpunit.
>
> Or are you trying to do something else?
> --
> Jeremy
>
> On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
>
> > hi All,
> >
> > Is there a sample app that uses junit and a test case. I've
> > looked at
> > the code in the repository and it looks like all the samples build
> > on the
> > SCATestCase and that's testing the code base.
> >
> > thanks in advance
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>
Re: sample junit test case
Posted by Jeremy Boynes <jb...@apache.org>.
Jon,
For unit testing application code you can use JUnit as normal (or any
other framework such as TestNG) - perhaps using easymock or an
alternative to mock out the services the code is using.
If you want to do integration testing you could deploy the
application to the runtime host and use an external framework such as
httpunit.
Or are you trying to do something else?
--
Jeremy
On Sep 5, 2006, at 2:18 PM, Jon Lewis wrote:
> hi All,
>
> Is there a sample app that uses junit and a test case. I've
> looked at
> the code in the repository and it looks like all the samples build
> on the
> SCATestCase and that's testing the code base.
>
> thanks in advance
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org