Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ranga Rao Bobbili
Is liferay support JSFUnit?
February 6, 2013 8:14 PM
Answer

Ranga Rao Bobbili

Rank: Regular Member

Posts: 152

Join Date: July 20, 2007

Recent Posts

Hi All,

I am trying to use JSFUnit functionality in JSF2.0 portlet, but JSFUnit is throwing below exception.


22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) 22:39:27,282 ERROR [http-localhost-127.0.0.1-8080-1][render_portlet_jsp:154] java.lang.ClassCastException: com.liferay.portlet.RenderRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at org.jboss.jsfunit.context.JSFUnitFacesContextFactory.getFacesContext(JSFUnitFacesContextFactory.java:56)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.sun.faces.context.InjectionFacesContextFactory.getFacesContext(InjectionFacesContextFactory.java:121)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.faces.bridge.BridgePhaseBaseImpl.getFacesContext(BridgePhaseBaseImpl.java:350)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.faces.bridge.BridgePhaseBaseImpl.init(BridgePhaseBaseImpl.java:187)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.faces.bridge.BridgePhaseCompatImpl.init(BridgePhaseCompatImpl.java:46)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:119)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:85)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:100)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:204)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)

22:39:27,298 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1) at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)

22:39:27,313 INFO (http-localhost-127.0.0.1-8080-1)

I knew how to get the FacesContext inside controllerbean or xhtml. But above exception is related to jboss-jsfunit-core-beta.jar.
I am not able to modify inside .jar file.

Could you please provide me the alternative solution to resolve the issue.

Thanks in advance.........

Best Regards,
Ranga Rao Bobbili
Adaequare INC
Neil Griffin
RE: Is liferay support JSFUnit?
February 14, 2013 2:39 PM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2189

Join Date: July 26, 2005

Recent Posts

Unfortunately, JSFUnit never supported portlets. From what I understand, the future of JSF in-container testing from JBoss is Arquillian Warp. But I don't know if that works with portlets yet.
Ranga Rao Bobbili
RE: Is liferay support JSFUnit?
February 18, 2013 7:28 AM
Answer

Ranga Rao Bobbili

Rank: Regular Member

Posts: 152

Join Date: July 20, 2007

Recent Posts

Thanks Neil Griffin for swift response.

Thanks & Regards,
Ranga Rao Bobbili
Adaequare INC
Roshan Qureshi
RE: Is liferay support JSFUnit?
February 24, 2014 11:54 PM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Hi

Had anyone tried Arquillian Warp with Liferay?
If so please share your experience.
I tried but it seems it will only work with GateIn portal.

I want to replace below code for Liferay.
1File[] libs = Maven.resolver() 
2                .loadPomFromFile("pom.xml") 
3                .resolve("org.jboss.portletbridge:portletbridge-impl") 
4                .withTransitivity() 
5                .asFile(); 


So instead of org.jboss.portletbridge:portletbridge-impl what we can use instead of this?

Thanks.
Roshan Qureshi
RE: Is liferay support JSFUnit?
February 25, 2014 11:50 PM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Dear Neil,

Can you please help me for below requirements?
I want to use integration testing for primefaces-portlet for Liferay 6.1 EE (liferay-portal-6.1.30-ee-ga3) with tomcat as a server.
As per your suggestion above, I studied Arquillian and also talked to the developer of Arquillian. Currently they are not having any extensions / bridge for Liferay. Can you please let me know if any bridge is available for primefaces plugin portlets to test integration testing on Liferay. If so please provide more information.
While searching for jsf unit test I came across code in github about this which is committed by you.
https://github.com/liferay/liferay-faces/tree/master/test/integration/demos/portal/primefaces3-users-portlet
Is it available for LR 6.1 EE?

Thanks.
Neil Griffin
RE: Is liferay support JSFUnit?
February 27, 2014 8:51 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2189

Join Date: July 26, 2005

Recent Posts

Hi Roshan,

We currently don't have CE and EE versions of Liferay Faces. In other words, Liferay Portal EE developers use the same Liferay Faces jars that Liferay Portal CE developers use. Support for Liferay Faces is included with the EE subscription.

We have Selenium integration tests for both of our PrimeFaces portlet demos:

1. primefaces3-portlet demo with corresponding Selenium Test
2. primefaces3-users-portet demo with corresponding Selenium Test

If you like, you can run these tests in your own environment by following these steps:

1. Build Liferay Faces From Source (Checkout either the 3.1.4-ga5 tag or the 3.1.x branch)

2. Deploy the test-setup-hook
1cd test/test-setup-hook
2mvn clean install
3cp target/*.war $LIFERAY_HOME/deploy


3. Deploy the primefaces3-portlet
1cd ../demos/bridge/primefaces3-portlet
2mvn clean install
3cp target/*.war $LIFERAY_HOME/deploy


4. Deploy the primefaces3-users-portlet
1cd ../portal/primefaces3-users-portlet
2mvn clean install
3cp target/*.war $LIFERAY_HOME/deploy


4a. Build the liferay-faces-test-integration-util.jar artifact manually, since that is not an artifact that gets officially released to Maven Central
1cd ../../../test/integration/util
2mvn clean install


5. Run the Selenium test for the primefaces3-portlet
1cd ../demos/bridge/primefaces3-portlet
2mvn -P integration test


6. Run the Selenium test for the primefaces3-users-portlet
1cd ../../portal/primefaces3-users-portlet/
2mvn -P integration test


Kind Regards,

Neil
Roshan Qureshi
RE: Is liferay support JSFUnit?
February 26, 2014 8:12 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Thank you very much Neil.
Appreciate your detailed step by step answer.
I am following your steps.
Is there any documentation or any wiki link to create the same Selenium tests for my own primefaces plugin portlets?

Thanks,
Roshan Qureshi
Neil Griffin
RE: Is liferay support JSFUnit?
February 26, 2014 8:32 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2189

Join Date: July 26, 2005

Recent Posts

Hi Roshan,

Some developers find that Selenium IDE is a good way of generating Selenium-based Java code that uses the Selenium Java API. For various reasons, chose to simply write Java code manually.

Kind Regards,

Neil
Roshan Qureshi
RE: Is liferay support JSFUnit?
February 27, 2014 2:03 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Thanks Neil for your support.
Roshan Qureshi
RE: Is liferay support JSFUnit?
February 27, 2014 8:43 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Hi Neil,

I was able to execute successfully steps 1 to 4 but getting following exception while executing 5th step of integration testing.

Failed to execute goal on project test-primefaces4-portlet: Could not resolve dependencies f
or project com.liferay.faces.test:test-primefaces4-portlet:jar:3.1.4-ga5: Could not find artifact co
m.liferay.faces.test:liferay-faces-test-integration-util:jar:3.1.4-ga5

The jar path is not resolving. I tried to access directly from liferay public repository as well but did not find any jar for this.
https://repository.liferay.com/nexus/content/groups/public/com/liferay/faces/liferay-faces for test integration.

Any pointers will be helpful.
Thanks for continuous support.
Neil Griffin
RE: Is liferay support JSFUnit?
February 27, 2014 8:51 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2189

Join Date: July 26, 2005

Recent Posts

It's my pleasure -- I just added Step 4a in order to get past this problem.
Roshan Qureshi
RE: Is liferay support JSFUnit?
March 2, 2014 5:19 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Hi Neil,

After following updated steps, I am able to deploy successfully.
When I run the test using mvn -P integration test, getting following exception.


-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.liferay.faces.test.Primefaces4PortletTest
Mar 2, 2014 4:13:48 PM org.jboss.arquillian.drone.webdriver.factory.remote.reusable.ReusedSessionPernamentFileStorage readStore
INFO: Reused session store is not available at C:\Users\rabdulkadar\.drone-webdriver-session-store, a new one will be created.
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
*** LOG addons.manager: Application has been upgraded
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\RABDUL~1\AppData\Local\Temp\anonymous1743140796010290731webdrive
r-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi-utils: Opening XPI database C:\Users\RABDUL~1\AppData\Local\Temp\anonymous1743140796010290731webdriver-profile\extensions.json
*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
*** LOG addons.xpi-utils: Make addon app-profile:fxdriver@googlecode.com visible
*** LOG DeferredSave/extensions.json: Save changes
*** LOG DeferredSave/extensions.json: Save changes
*** LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
*** LOG addons.xpi-utils: Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
*** LOG DeferredSave/extensions.json: Save changes
*** LOG DeferredSave/extensions.json: Save changes
*** LOG addons.xpi: New add-on {BBDA0591-3099-440a-AA10-41764D9DB4DB} installed in winreg-app-global
*** LOG addons.xpi-utils: Make addon winreg-app-global:{BBDA0591-3099-440a-AA10-41764D9DB4DB} visible
*** LOG DeferredSave/extensions.json: Save changes
*** LOG DeferredSave/extensions.json: Save changes
*** LOG addons.xpi: Updating database with changes to installed add-ons
*** LOG addons.xpi-utils: Updating add-on states
*** LOG addons.xpi-utils: Writing add-ons list
*** LOG DeferredSave/extensions.json: Starting timer
*** LOG DeferredSave/extensions.json: Starting write
*** LOG DeferredSave/extensions.json: Write succeeded
*** LOG addons.xpi-utils: XPI Database saved, setting schema version preference to 15
*** LOG addons.manager: shutdown
*** LOG addons.xpi: shutdown
*** LOG addons.xpi-utils: shutdown
*** LOG addons.xpi: Notifying XPI shutdown observers
*** LOG addons.manager: Async provider shutdown done
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\RABDUL~1\AppData\Local\Temp\anonymous1743140796010290731webdrive
r-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
JavaScript error: chrome://browser/content/urlbarBindings.xml, line 654: aUrl is undefined

at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:251)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:195)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:107)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jboss.arquillian.drone.webdriver.factory.SecurityActions.newInstance(SecurityActions.java:142)
at org.jboss.arquillian.drone.webdriver.factory.FirefoxDriverFactory.createInstance(FirefoxDriverFactory.java:127)
at org.jboss.arquillian.drone.webdriver.factory.FirefoxDriverFactory.createInstance(FirefoxDriverFactory.java:41)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:130)
at org.jboss.arquillian.drone.webdriver.factory.WebDriverFactory.createInstance(WebDriverFactory.java:41)
at org.jboss.arquillian.drone.impl.DroneCallableCreator$1.call(DroneCallableCreator.java:89)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)


One LATE question : when should one use Arquillian and when should one use Selenium. If I am not wrong, Arquillian is internally using selenium.
For my requirement, we have already portlets developed and also portal is up and running and we want to do integration testing. In this case which is better Arquillian or Selenium?

Thanks,
Roshan Qureshi
Vernon Singleton
RE: Is liferay support JSFUnit?
March 3, 2014 12:14 PM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Regular Member

Posts: 198

Join Date: January 14, 2013

Recent Posts

Hi Roshan,

Roshan Qureshi:
One LATE question : when should one use Arquillian and when should one use Selenium. If I am not wrong, Arquillian is internally using selenium. For my requirement, we have already portlets developed and also portal is up and running and we want to do integration testing. In this case which is better Arquillian or Selenium?

If you use Arquillian, you are using selenium by default. You may not derive much benefit from Arquillian yet, so you should just be able to use selenium WebDriver.

Hope that helps,
Vernon
Vernon Singleton
RE: Is liferay support JSFUnit?
March 3, 2014 12:19 PM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Regular Member

Posts: 198

Join Date: January 14, 2013

Recent Posts

Also,
When I run the test using mvn -P integration test
just now I got no errors on liferay-portal-6.1.2:

Results :
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0

What version of firefox are you running?
Roshan Qureshi
RE: Is liferay support JSFUnit?
March 4, 2014 6:40 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Hi Vernon,

Thanks for your reply.
I am using Firefox 27.0.1 (latest one)

Please correct me about when to use Arquillian. What I understood is that Arquillian should be used when the environment is not setup and still we want to test integration test. (As it provides @deploy and other setup)
If portal is already set up and running, one can start with Selenium directly (one should go with Silenium).

Can you tell me what will be the best scenario in which Arquillian should be used and one in which Selenium?

Thanks,
Roshan Qureshi
Vernon Singleton
RE: Is liferay support JSFUnit?
March 5, 2014 8:13 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Regular Member

Posts: 198

Join Date: January 14, 2013

Recent Posts

Hi Roshan,
Roshan Qureshi:
Can you tell me what will be the best scenario in which Arquillian should be used and one in which Selenium?

Supposedly arquillian provides the more benefit when you are using micro-deployments. Our deployment requirements for Liferay do NOT allow us to easily see that benefit.
Roshan Qureshi
RE: Is liferay support JSFUnit?
March 23, 2014 12:33 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 144

Join Date: August 24, 2010

Recent Posts

Hi Vernon,

I had started using Selenium as I have environment already set up.

Thanks for your valuable guidance.

Regards,
Roshan Qureshi