jmix icon indicating copy to clipboard operation
jmix copied to clipboard

Initial application add-on fails contextLoads test

Open Flaurite opened this issue 1 year ago • 0 comments

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:

  1. Add flowui-test-assist to add-on template
  2. Rework code in SecurityContextHolderAtmosphereInterceptor to handle NPE

Steps To Reproduce

  1. Create application add-on
  2. Create Data store
  3. 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)

Flaurite avatar Mar 29 '24 13:03 Flaurite