[1.x] NPE occurs when doing negative test about conformace item 60008
---------------------------------------------------------------------
Key: TUSCANY-2883
URL: https://issues.apache.org/jira/browse/TUSCANY-2883
Project: Tuscany
Issue Type: Task
Components: Java SCA Assembly Model
Affects Versions: Java-SCA-1.4
Reporter: Shu Chao Wan
In ASM60008, it says that "The interfaces of the component references promoted
by a composite reference MUST be the same, or if the composite reference itself
declares an interface then all the component reference interfaces must be
compatible with the composite reference interface. Compatible means that the
component reference interface is the same or is a strict subset of the
composite reference interface."
In order to verify this statement in negative way, I wrote a composite file
whose promoted component interface is incompatible with the composite
reference's interface, one is CService, and the other is BService, and then a
ServiceRuntimeException is expected as the result. But actually I got a
NullPointerException.
--------------------------------
TestCase
--------------------------------
@Test
public void ASM60008_n() throws Exception {
initDomain("differentreferenceinterface_outer.composite");
AService service = ServiceFinder.getService(AService.class,
"DifferentInterfaceComponent/AService");
System.out.println(service.getState());
cleanupDomain();
}
------------------------------------------------------------
differentreferenceinterface_outer.composite
------------------------------------------------------------
<composite ..>
<component name="DifferentInterfaceComponent">
<implementation.composite
name="assembly-tests:Assembly-different-reference-interface-inner-Composite"/>
<reference name="c" target="CComponent"/>
</component>
<component name="CComponent">
<implementation.java
class="org.apache.tuscany.sca.vtest.assembly.composite.impl.CServiceImpl"/>
</component>
</composite>
------------------------------------------------------------
differentreferenceinterface_inner.composite
------------------------------------------------------------
<composite ..>
<service name="AService" promote="AComponent"/>
<component name="AComponent">
<implementation.java
class="org.apache.tuscany.sca.vtest.assembly.composite.impl.AServiceImpl" />
<reference name="b">
<interface.java
interface="org.apache.tuscany.sca.vtest.assembly.composite.BService" />
</reference>
</component>
<reference name="c" promote="AComponent/b">
<interface.java
interface="org.apache.tuscany.sca.vtest.assembly.composite.CService" />
</reference>
</composite>
--------------------------------
NullPointerException
--------------------------------
java.lang.NullPointerException
at
org.apache.tuscany.sca.vtest.assembly.composite.impl.AServiceImpl.getState(AServiceImpl.java:39)
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.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
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.getState(Unknown Source)
at
org.apache.tuscany.sca.vtest.assembly.composite.CompositeTestCase.ASM60008_n(CompositeTestCase.java:330)
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)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.