[JBoss Seam] - Re: Integration Testing with TestNG and embeddedEjb
by EagleEye
ok i see. But my Problem is that nothing is workin, even grabbin the component out of the JNDI. (nothing else the seam.core.Component is doing)
What can be the problem? That I can't get anything of the seems to be loaded Components?
| Object test = JndiUtil.lookup("mediportal/KomunikatyManagerBean/local", KomunikatyManagerBean.class);
|
| KomunikatyManager komunikatyManager = (KomunikatyManager)
| getInstance(KomunikatyManagerBean.class);
|
this 2 lines just test stuff. cuz the
| invokeMethod("#{komunikatyManager.nowy}");
|
Is not working for same reason...
Console output:
| FAILED: testNowyKomunikat
| org.jboss.seam.InstantiationException: Could not instantiate Seam component: komunikatyManager
| at org.jboss.seam.Component.newInstance(Component.java:1740)
| at org.jboss.seam.Component.getInstance(Component.java:1643)
| at org.jboss.seam.Component.getInstance(Component.java:1610)
| at org.jboss.seam.Component.getInstance(Component.java:1604)
| at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
| at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
| at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:73)
| at com.sun.el.parser.AstValue.getTarget(AstValue.java:67)
| at com.sun.el.parser.AstValue.invoke(AstValue.java:170)
| at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
| at org.jboss.seam.util.UnifiedELMethodBinding.invoke(UnifiedELMethodBinding.java:36)
| at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
| at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
| at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
| at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
| at org.jboss.seam.mock.SeamTest$Request.invokeMethod(SeamTest.java:401)
| at pl.alternativ.med.portal.test.komunikaty.KomunikatyTest$1.invokeApplication(KomunikatyTest.java:51)
| at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
| at pl.alternativ.med.portal.test.komunikaty.KomunikatyTest.testNowyKomunikat(KomunikatyTest.java:54)
| Caused by: javax.naming.NameNotFoundException: mediportal not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at org.jboss.seam.Component.instantiateSessionBean(Component.java:1107)
| at org.jboss.seam.Component.instantiate(Component.java:1093)
| at org.jboss.seam.Component.newInstance(Component.java:1736)
| ... 39 more
| ... Removed 21 stack frames
|
thx a lot for response!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073544#4073544
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073544
18Â years, 11Â months
[JBoss Seam] - A few issues.
by tzman
My apologies if these issues have already been fixed/mentioned.
1.) org.jboss.seam.mock.BaseSeamTest
|
| protected void startJbossEmbeddedIfNecessary() throws DeploymentException, IOException
| {
| if ( !started )
| {
| Bootstrap bootstrap = Bootstrap.getInstance();
| bootstrap.bootstrap();
| started = true;
| if ( resourceExists("seam.properties") )
| {
| bootstrap.deployResourceBase("seam.properties");
| }
| if ( resourceExists("META-INF/components.xml") )
| {
| bootstrap.deployResourceBase("META-INF/components.xml");
| }
| if ( resourceExists("META-INF/seam.properties") )
| {
| bootstrap.deployResourceBase("META-INF/seam.properties");
| }
| }
| }
|
The call to deployResourceBase will only locate the first resource?
or should this be:
|
|
| @Override
| protected void startJbossEmbeddedIfNecessary(
| ) throws DeploymentException, IOException
| {
| Bootstrap bootstrap;
| if ( !started )
| {
| bootstrap = Bootstrap.getInstance();
| bootstrap.bootstrap();
| started = true;
| if ( resourceExists( "seam.properties" ) )
| {
| bootstrap.deployResourceBases( "seam.properties" );
| }
| if ( resourceExists( "META-INF/components.xml" ) )
| {
| bootstrap.deployResourceBases("META-INF/components.xml" );
| }
| if ( resourceExists( "META-INF/seam.properties" ) )
| {
| bootstrap.deployResourceBases("META-INF/seam.properties" );
| }
| }
| }
|
|
|
2.) org.jboss.seam.framework.Identifier
The equals method checks for an instance of the derived type org.jboss.seam.framework.EntityIdentifier
3.) It doesn't appear as though we can use injection in base classes. Am I mistaken? Is this a design decision?
We have gotten around this by retrieving the components programatically, i.e. Component.getInstance( "entityManager" );
This means that for testing I have to load the container, when I only need hibernate; or I have to do a check in by base class before retrieving the component to ensure the application context is active.
Thanks for all the work.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4073542#4073542
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4073542
18Â years, 11Â months