matethurzo/liferay-plugins — pull request #18 by riccardo-ferrari (2013-01-21 10:09:19+00:00)
Title: LPS-29551 - test case

This test case aim to verify the proper model unwrapping of models when hooking services.
As discovered and fixed in LPS-29551 there are some scenarios when hooking services that may lead to a org.hibernate.NonUniqueObjectException Exception because models are not unwrapped before being stored/updated.

An important note is that this behavior is not reproducible since we introduced the LPS-30598 because it changes and deprecates the BatchSession logic that was responsible of the exception.

The test case does the following:
-Adds a (User) model listener since it gets called exactly after we unwrap the model.
-Added testWrappedModel() method to the TestHookUtil class. This method is responsible to replicate the very same behavior described in the LPS-29551 by adding and removing a user. This method can return true if everything is fine, false is the model listener find that the user model is not unwrapped or crash (on purpose) the portlet if something out of the scope of the test is happening (like the inability to add the user).
-The view.jsp page is responsible to check that the model listener is properly configured and the return of the method call is true.

Thanks,
Riccardo