You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Kevin Williams <kj...@gmail.com> on 2007/05/04 22:35:38 UTC
Re: svn commit: r535374 - in /incubator/tuscany/java/sca: itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java
The new SCARuntimeActivator.locateService API was throwing an NPE when the
provided componentName was not found in the Domain. I changed this to throw
IllegalArgumentException with an explanatory message. I can easily back
this out or change it if some other behavior is preferable.
Thanks,
--Kevin
On 5/4/07, kwilliams@apache.org <kw...@apache.org> wrote:
>
> Author: kwilliams
> Date: Fri May 4 13:29:35 2007
> New Revision: 535374
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=535374
> Log:
> Fix for NPE on bad componentName and new test
>
> Modified:
>
> incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
>
> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java
>
> Modified:
> incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java?view=diff&rev=535374&r1=535373&r2=535374
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
> (original)
> +++
> incubator/tuscany/java/sca/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
> Fri May 4 13:29:35 2007
> @@ -36,7 +36,7 @@
> assertEquals(-99, service.negate(99));
>
> }
> -
> +
> @Test
> public void managedLocateService() {
>
> @@ -46,20 +46,13 @@
>
> }
>
> - @Ignore
> - @Test
> + @Test(expected = IllegalArgumentException.class)
> public void badComponentName() {
>
> - BasicService service = SCARuntimeActivator.locateService(
> BasicService.class, "IvalidComponentName");
> -
> - assertEquals(-99, service.delegateNegate(99));
> + SCARuntimeActivator.locateService(BasicService.class,
> "IvalidComponentName");
>
> }
>
> -
> -
> -
> -
> @Before
> public void init() throws Exception {
>
>
> Modified:
> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java?view=diff&rev=535374&r1=535373&r2=535374
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java
> Fri May 4 13:29:35 2007
> @@ -272,7 +272,7 @@
> return (ComponentContext)component;
> }
> }
> - return null;
> + throw new IllegalArgumentException("ComponentContext for
> component named: " + componentName + " not found in this domain");
> }
>
> public void start(Contribution contribution) throws
> ActivationException {
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>
>