jmix
jmix copied to clipboard
Initial application add-on fails contextLoads test
Environment
Jmix version: 2.2.x
Bug Description
See RU support forum: topic.
The problem occurs in SecurityContextHolderAtmosphereInterceptor. The default test configuration with @SpringBootTest takes Vaadin configuration from FlowuiConfiugration. It leads to starting up Vaadin too, but add-on does not have flowui-test-assist dependency to correctly handle Vaadin.
There are a few solutions:
- Add
flowui-test-assistto add-on template - Rework code in
SecurityContextHolderAtmosphereInterceptorto handle NPE
Steps To Reproduce
- Create application add-on
- Create Data store
- Run default test
Current Behavior
Cannot invoke "org.atmosphere.cpr.AtmosphereFramework.interceptor(org.atmosphere.cpr.AtmosphereInterceptor)" because the return value of "org.atmosphere.cpr.Universe.framework()" is null
java.lang.NullPointerException: Cannot invoke "org.atmosphere.cpr.AtmosphereFramework.interceptor(org.atmosphere.cpr.AtmosphereInterceptor)" because the return value of "org.atmosphere.cpr.Universe.framework()" is null
at io.jmix.flowui.sys.vaadin.SecurityContextHolderAtmosphereInterceptor.onReady(SecurityContextHolderAtmosphereInterceptor.java:18)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:365)
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:237)
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:168)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384)
at org.springframework.boot.context.event.EventPublishingRunListener.ready(EventPublishingRunListener.java:109)
at org.springframework.boot.SpringApplicationRunListeners.lambda$ready$6(SpringApplicationRunListeners.java:80)