For giggles, I cloned deltaspike 1.7.3-SNAPSHOT and added some debug info
to
deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/config/JsfModuleConfig.java

protected synchronized void init()
    {
        if (this.initialized == null)
        {
            System.out.println( "initialized is null" );
            this.jsf22Available =
ClassUtils.tryToLoadClassForName(CLIENT_WINDOW_CLASS_NAME) != null;

            if (!this.jsf22Available)
            {
                this.delegatedWindowHandlingEnabled = false;
            }
            else
            {
                FacesContext facesContext =
FacesContext.getCurrentInstance();

                // can happen in case of a very simple test-setup without a
mocked jsf container
                if (facesContext == null)
                {
                    System.out.println( "facesContext is null" );
                    this.delegatedWindowHandlingEnabled = false;
                }
                else
                {
                    System.out.println( "facesContext: " + facesContext );
                    System.out.println( "ectx: " +
facesContext.getExternalContext() );
                    System.out.println( "CLIENT_WINDOW_CONFIG_KEY: " +
CLIENT_WINDOW_CONFIG_KEY );
                    String initParam =
facesContext.getExternalContext().getInitParameter(CLIENT_WINDOW_CONFIG_KEY);
                    this.delegatedWindowHandlingEnabled =
                            !(initParam == null ||
"none".equalsIgnoreCase(initParam.trim()));
                }
            }

            this.initialized = true;
        }
    }


the first set of tests that passes 'mvn clean test' just fine outputs:
initialized is null
facesContext is null

but when I run all the test 'mvn clean test' outputs:
initialized is null
facesContext: Mock for FacesContext, hashCode: 1278864070
ectx: null
CLIENT_WINDOW_CONFIG_KEY: javax.faces.CLIENT_WINDOW_MODE


The first problem is that my mocked FacesContext does not provide for
getExternalContext()....but there is no good error message to that fact.

The second problem: it appears these tests not running as isolated as I
thought, because my ContextMocker is being used in a test that it is not
configured to utilize. Is this a problem with the way I have
written/configured my tests, or is something else leaking data from one
test to another ?






On Sat, Mar 18, 2017 at 6:27 PM, Gerhard Petracek <gpetra...@apache.org>
wrote:

> hi stephen,
>
> it looks more like an issue in weld.
> ds just provides a "simple" test-runner which starts the cdi-container of
> your choice as well as some scopes,...
> (the rest is up to the cdi-container you are using.)
>
> regards,
> gerhard
>
>
>
> 2017-03-16 21:14 GMT+01:00 Stephen More <stephen.m...@gmail.com>:
>
> > Here is some additional info:
> > weld: 2.4.2.Final
> > deltaspike: 1.7.2
> >
> > Why does everything magically work with 3 threads ????
> >
> > with maven-surefire-plugin forkCount == 3 - Tests run: 52, Failures: 0,
> > Errors: 0, Skipped: 0
> > with maven-surefire-plugin forkCount == 1, 2, 4, 5: Tests run: 52,
> > Failures: 0, Errors: 2, Skipped: 0
> >
> > org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke
> > protected void
> > org.apache.deltaspike.jsf.impl.scope.window.
> JsfWindowContextQuotaHandler.
> > init()
> > on
> > org.apache.deltaspike.jsf.impl.scope.window.
> JsfWindowContextQuotaHandler@
> > fd5c7f6
> >         at
> > org.apache.deltaspike.jsf.api.config.JsfModuleConfig.init(
> > JsfModuleConfig.java:179)
> >         at
> > org.apache.deltaspike.jsf.api.config.JsfModuleConfig.
> > lazyInit(JsfModuleConfig.java:153)
> >         at
> > org.apache.deltaspike.jsf.api.config.JsfModuleConfig.
> getDefaultWindowMode(
> > JsfModuleConfig.java:116)
> >         at
> > org.apache.deltaspike.jsf.api.config.JsfModuleConfig$Proxy$_
> > $$_WeldClientProxy.getDefaultWindowMode(Unknown
> > Source)
> >         at
> > org.apache.deltaspike.jsf.spi.scope.window.DefaultClientWindowConfig.
> init(
> > DefaultClientWindowConfig.java:78)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:
> > 62)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:43)
> >         at java.lang.reflect.Method.invoke(Method.java:497)
> >         at
> > org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoke
> > r.invokeMethods(DefaultLifecycleCallbackInvoker.java:97)
> >         at
> > org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoke
> > r.postConstruct(DefaultLifecycleCallbackInvoker.java:80)
> >         at
> > org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(
> > BasicInjectionTarget.java:122)
> >         at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:162)
> >         at
> > org.jboss.weld.util.bean.IsolatedForwardingBean.create(
> > IsolatedForwardingBean.java:45)
> >         at
> > org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
> >         at
> > org.jboss.weld.context.PassivatingContextWrapper$
> > AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:76)
> >         at
> > org.jboss.weld.bean.ContextualInstanceStrategy$
> > DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.
> java:100)
> >         at
> > org.jboss.weld.bean.ContextualInstanceStrategy$
> > CachingContextualInstanceStrategy.get(ContextualInstanceStrategy.
> java:177)
> >         at
> > org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> >         at
> > org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(
> > ContextBeanInstance.java:99)
> >         at
> > org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(
> > ProxyMethodHandler.java:125)
> >         at
> > org.apache.deltaspike.jsf.spi.scope.window.DefaultClientWindowConfig$
> > Proxy$_$$_WeldClientProxy.getMaxWindowContextCount(Unknown
> > Source)
> >         at
> > org.apache.deltaspike.jsf.impl.scope.window.
> JsfWindowContextQuotaHandler.
> > init(JsfWindowContextQuotaHandler.java:38)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:
> > 62)
> >         at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:43)
> >         at java.lang.reflect.Method.invoke(Method.java:497)
> >         at
> > org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoke
> > r.invokeMethods(DefaultLifecycleCallbackInvoker.java:97)
> >         at
> > org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoke
> > r.postConstruct(DefaultLifecycleCallbackInvoker.java:80)
> >         at
> > org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(
> > BasicInjectionTarget.java:122)
> >         at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:162)
> >         at
> > org.jboss.weld.util.bean.IsolatedForwardingBean.create(
> > IsolatedForwardingBean.java:45)
> >         at
> > org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
> >         at
> > org.jboss.weld.context.PassivatingContextWrapper$
> > AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:76)
> >         at
> > org.jboss.weld.bean.ContextualInstanceStrategy$
> > DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.
> java:100)
> >         at
> > org.jboss.weld.bean.ContextualInstanceStrategy$
> > CachingContextualInstanceStrategy.get(ContextualInstanceStrategy.
> java:177)
> >         at
> > org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> >         at
> > org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(
> > ContextBeanInstance.java:99)
> >         at
> > org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(
> > ProxyMethodHandler.java:125)
> >         at
> > org.apache.deltaspike.jsf.impl.scope.window.
> JsfWindowContextQuotaHandler$
> > Proxy$_$$_WeldClientProxy.checkWindowContextQuota(Unknown
> > Source)
> >         at
> > org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder.
> > getContextualStorage(WindowBeanHolder.java:64)
> >         at
> > org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder$Proxy$_$$_
> > WeldClientProxy.getContextualStorage(Unknown
> > Source)
> >         at
> > org.apache.deltaspike.core.impl.scope.window.WindowContextImpl.
> > getContextualStorage(WindowContextImpl.java:119)
> >         at
> > org.apache.deltaspike.core.util.context.AbstractContext.
> > get(AbstractContext.java:78)
> >         at
> > org.jboss.weld.context.PassivatingContextWrapper$
> > AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:70)
> >         at
> > org.jboss.weld.bean.ContextualInstanceStrategy$
> > DefaultContextualInstanceStrategy.getIfExists(
> ContextualInstanceStrategy.
> > java:89)
> >         at
> > org.jboss.weld.bean.ContextualInstance.getIfExists(
> > ContextualInstance.java:63)
> >         at
> > org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(
> > ContextBeanInstance.java:83)
> >         at
> > org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(
> > ProxyMethodHandler.java:125)
> >
> >
> > Should I file a bug report for this issue ?
> >
> >
> > On Thu, Mar 16, 2017 at 3:20 PM, Stephen More <stephen.m...@gmail.com>
> > wrote:
> >
> > > I am running into a strange problem....
> > >
> > > I have 1 set of CdiTestRunner classes that passes 'mvn clean test' just
> > > fine.
> > > I have another set of CdiTestRunner class that passes 'mvn clean test'
> > > just fine.
> > >
> > > But when I try to run all CdiTestRunner classes at once I get:
> > > org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke
> > > protected void org.apache.deltaspike.jsf.impl.scope.window.
> > > JsfWindowContextQuotaHandler.init() on org.apache.deltaspike.jsf.
> > > impl.scope.window.JsfWindowContextQuotaHandler@65ff1e6d
> > >
> >
>

Reply via email to