[JBoss Seam] - NPE when using SeamTest (v2.0)
by IGx89
I have the following test class:
package com.fl.bpm_ui.scheduler;
|
| import org.jboss.seam.core.Manager;
| import org.jboss.seam.mock.SeamTest;
| import org.junit.*;
|
| public class InitialCallTest extends SeamTest
| {
| @Test
| public void testNumberGuessWin() throws Exception
| {
| String id = new NonFacesRequest("/scheduler/usher.seam?flow=initialCall")
| {
|
| @Override
| protected void renderResponse() throws Exception {
| CallManager cm = (CallManager) getInstance(CallManager.class);
| assert Manager.instance().isLongRunningConversation();
| }
|
| }.run();
| }
| }
And get the following error:
-------------------------------------------------------------------------------
| Test set: com.fl.bpm_ui.scheduler.InitialCallTest
| -------------------------------------------------------------------------------
| Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.047 sec <<< FAILURE!
| testNumberGuessWin(com.fl.bpm_ui.scheduler.InitialCallTest) Time elapsed: 0.016 sec <<< ERROR!
| java.lang.NullPointerException
| at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:504)
| at com.fl.bpm_ui.scheduler.InitialCallTest.testNumberGuessWin(InitialCallTest.java:24)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
| at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
| at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
| at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
| at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
| at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
| at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
| at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
| at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
| at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
| at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
| at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
| at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
| at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:314)
| at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:907)
Running through the debugger, it seems the NPE is happening on the "FacesLifecycle.endRequest(externalContext);" line in the finally block in the run() method.
Any ideas how I can fix this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080118#4080118
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080118
18Â years, 7Â months
[JBoss Seam] - Re: EntitySecurityListener and MDBs
by mtpettyp
I started hacking around with the source and I came up with the following solution:
Change Identity.isSecurityEnabled():
| public static boolean isSecurityEnabled()
| {
| return securityEnabled &&
| Contexts.isSessionContextActive()&&
| Identity.instance().isIdentitySecurityEnabled();
| }
|
Add the following methods to Identity:
| private boolean identitySecurityEnabled;
| <snip/>
|
| public boolean isIdentitySecurityEnabled()
| {
| return identitySecurityEnabled;
| }
|
| public void setIdentitySecurityEnabled(boolean enabled)
| {
| identitySecurityEnabled = enabled;
| }
|
This solves both my problem mentioned above.
If any of the Seam committers think this is a valid solution I can create a JIRA issue and attach the patch.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080108#4080108
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080108
18Â years, 7Â months
[JBoss Seam] - Re: Problems using ajax validation in seam-gen
by pete.muirï¼ jboss.org
I still can't reproduce this.
I made the getTotal() method this:
public Integer getTotal() {
| for (int i = 0; i < 100000000; i++)
| {
| int j = i / 10 + 10;
| }
| log.info("printing total");
| return this.first + this.second + this.third;
| }
to simulate very heavy load inside the getTotal method, entered some values and sat there with my finger on tab for a while. I get this printed out:
18:04:12,993 INFO [CalcBean] printing total
| 18:04:13,630 INFO [CalcBean] printing total
| 18:04:26,813 INFO [CalcBean] printing total
| 18:04:29,843 INFO [CalcBean] printing total
| 18:04:30,448 INFO [CalcBean] printing total
| 18:04:31,257 INFO [CalcBean] printing total
| 18:04:31,319 INFO [CalcBean] printing total
| 18:04:31,826 INFO [CalcBean] printing total
| 18:04:31,846 INFO [CalcBean] printing total
| 18:04:31,909 INFO [CalcBean] printing total
| 18:04:31,940 INFO [CalcBean] printing total
| 18:04:31,982 INFO [CalcBean] printing total
| 18:04:31,984 INFO [CalcBean] printing total
| 18:04:32,108 INFO [CalcBean] printing total
| 18:04:32,175 INFO [CalcBean] printing total
| 18:04:32,246 INFO [CalcBean] printing total
| 18:04:32,434 INFO [CalcBean] printing total
| 18:04:32,545 INFO [CalcBean] printing total
| 18:04:32,566 INFO [CalcBean] printing total
| 18:04:32,602 INFO [CalcBean] printing total
| 18:04:32,613 INFO [CalcBean] printing total
| 18:04:32,619 INFO [CalcBean] printing total
| 18:04:34,024 INFO [CalcBean] printing total
| 18:04:34,062 INFO [CalcBean] printing total
So, as you can see the function does take a non-trivial amount of time to process but a4j/seam does handle the load. What version of ajax4jsf? I'm using the one in Seam CVS (1.1.1)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080104#4080104
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080104
18Â years, 7Â months