hi rafael, please file a jira-ticket for such an improvement.
regards, gerhard http://www.irian.at Your JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces, DeltaSpike and OpenWebBeans 2015-04-04 17:56 GMT+02:00 Rafael Pestano <[email protected]>: > Hi Gerhard, > > can't we 'mock' JNDI tree? something like [1]? > > I've tried to do it in BeforeClass but the exception occurs before it, > maybe it could work at (TestControl) runner level: > > @BeforeClass > public static void setUpJNDI() throws NamingException { > // Create initial context > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, > "org.apache.naming.java.javaURLContextFactory"); > System.setProperty(Context.URL_PKG_PREFIXES, > "org.apache.naming"); > InitialContext ic = new InitialContext(); > > ic.createSubcontext("java:"); > ic.createSubcontext("java:/comp"); > /*ic.createSubcontext("java:/comp/BeanManager");*/ > > ic.bind("java:/comp/BeanManager", > BeanManagerProvider.getInstance().getBeanManager()); > > } > > > > > [1] > > https://blogs.oracle.com/randystuph/entry/injecting_jndi_datasources_for_junit > > 2015-04-04 10:51 GMT-03:00 Gerhard Petracek <[email protected]>: > > > hi rafael, > > > > once you enable myfaces-test as external-container, omnifaces gets loaded > > as well (if it's on the test-classpath). > > it looks like that not everything (which is required by omnifaces) is on > > your test-classpath. > > however, even after adding the missing part/s you will get issues due to > > the implementation of org.omnifaces.config.BeanManager > > (since it just works once you have a proper jndi-setup). > > > > regards, > > gerhard > > > > http://www.irian.at > > > > Your JavaEE powerhouse - > > JavaEE Consulting, Development and > > Courses in English and German > > > > Professional Support for Apache > > MyFaces, DeltaSpike and OpenWebBeans > > > > > > > > 2015-04-04 4:12 GMT+02:00 Rafael Pestano <[email protected]>: > > > > > Hi guys, > > > > > > I'm facing an issue with myfaces test and omnifaces, as soon i add > > > omnifaces 2.0 dependency I got the error when running tests (driven by > ds > > > test control): > > > > > > java.lang.NoClassDefFoundError: Could not initialize class > > > org.omnifaces.config.BeanManager > > > at > > > > org.omnifaces.application.OmniApplication.<init>(OmniApplication.java:69) > > > at > > > > > > > > > org.omnifaces.application.OmniApplicationFactory.createOmniApplication(OmniApplicationFactory.java:88) > > > at > > > > > > > > > org.omnifaces.application.OmniApplicationFactory.getApplication(OmniApplicationFactory.java:54) > > > at > > > > > > > > > org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:172) > > > at > > > > > > > > > org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:329) > > > at > > > > > > > > > org.apache.myfaces.webapp.AbstractFacesInitializer.destroyFaces(AbstractFacesInitializer.java:364) > > > > > > > > > I've cloned Gerhard ee6-ds-demo to show the issue: > > > > > > https://github.com/rmpestano/ee6-ds-demo > > > > > > just run any test to reproduce. > > > > > > > > > *If i comment > > > > > > > > > src/test/resources/META-INF/services/org.apache.deltaspike.testcontrol.spi.ExternalContainer* > > > the tests passes, it also work with omnifaces 1.x and myfaces test > > enabled. > > > > > > this is the code which throws the exception: > > > > > > > > > https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/application/OmniApplication.java#L69 > > > > > > and here is how BeanManager is obtained: > > > > > > > > > > > > https://github.com/omnifaces/omnifaces/blob/master/src/main/java/org/omnifaces/config/BeanManager.java#L79 > > > > > > > > > Do you think there is a problem in Omnifaces code? > > > > > > > > > > > > -- > > > <http://www.advancedit.com.br/>Att, > > > > > > Rafael M. Pestano > > > > > > Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul > > > http://rpestano.wordpress.com/ > > > @realpestano <https://twitter.com/realpestano> > > > > > > > > > -- > <http://www.advancedit.com.br/>Att, > > Rafael M. Pestano > > Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul > http://rpestano.wordpress.com/ > @realpestano <https://twitter.com/realpestano> >
