Tuscany
  1. Tuscany
  2. TUSCANY-2843

NPE occurs when verifying conformance item ASM60016

    Details

    • Patch Info:
      Patch Available

      Description

      Conformance item ASM60016 says that
      " the operations on the target interface of a wire MUST be the same as or be a superset of the operations in the interface specified on the source "

      In order to verify it with negative way, I wrote the following test case.

      composite file
      --------------------------------------------------------------------------------------
      <component name="FComponent">
      <implementation.java class="org.apache.tuscany.sca.vtest.assembly.composite.impl.FServiceImpl"/>
      <reference name="d">
      <interface.java interface="org.apache.tuscany.sca.vtest.assembly.composite.DService" />
      </reference>
      <reference name="c">
      <interface.java interface="org.apache.tuscany.sca.vtest.assembly.composite.CService" />
      </reference>
      </component>
      <component name="CComponent">
      <implementation.java class="org.apache.tuscany.sca.vtest.assembly.composite.impl.CSubServiceImpl"/>
      <service name="CSubService">
      <interface.java interface="org.apache.tuscany.sca.vtest.assembly.composite.CSubService"/>
      </service>
      </component>
      <component name="DComponent">
      <implementation.java class="org.apache.tuscany.sca.vtest.assembly.composite.impl.DSubServiceImpl"/>
      <service name="DSubService">
      <interface.java interface="org.apache.tuscany.sca.vtest.assembly.composite.DSubService" />
      </service>
      </component>

      <wire source="FComponent/d" target="DComponent" />
      <wire source="FComponent/c" target="CComponent" />
      ------------------------------------------------------

      Here, CSubService is a subset of CService and DSubService is a subset of DService

      TestCase
      ------------------------------------------------------
      public void ASM60016_n() throws Exception

      { initDomain("subinterfacewire.composite"); FService fservice = ServiceFinder.getService(FService.class, "FComponent"); Assert.assertEquals("DProperty", fservice.getGreetings("")); Assert.assertEquals("Some State", fservice.getString("")); cleanupDomain(); }

      ---------------------------------------------------------

      And I got NullPointerException here instead of expected ServiceRuntimeException.
      -----------------------------------------------------------
      java.lang.NullPointerException
      at org.apache.tuscany.sca.vtest.assembly.composite.impl.FServiceImpl.getGreetings(FServiceImpl.java:42)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:162)
      at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:112)
      at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
      at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:112)
      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:310)
      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:163)
      at $Proxy9.getGreetings(Unknown Source)
      at org.apache.tuscany.sca.vtest.assembly.composite.MyCompositeTestCase.ASM60016_n(MyCompositeTestCase.java:416)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
      at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      ----------------------------------------------------------------------

        Activity

        Hide
        Shu Chao Wan added a comment -

        Please apply the patch at dir sca-java-1.x\vtest\assembly\composite, and the related testcase is method ASM60016_n in file org.apache.tuscany.sca.vtest.assembly.composite.CompositeTestCase.

        Show
        Shu Chao Wan added a comment - Please apply the patch at dir sca-java-1.x\vtest\assembly\composite, and the related testcase is method ASM60016_n in file org.apache.tuscany.sca.vtest.assembly.composite.CompositeTestCase.
        Hide
        Simon Laws added a comment -

        The reported error is still valid but the patch here can be ignored as the patch for TUSCANY-2884 committed all the test cases together at revision: 752817

        Show
        Simon Laws added a comment - The reported error is still valid but the patch here can be ignored as the patch for TUSCANY-2884 committed all the test cases together at revision: 752817

          People

          • Assignee:
            Unassigned
            Reporter:
            Shu Chao Wan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development