Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 17 Jul 2009 19:53:06 -0000 Issue 8758

user-digest-help

2009-07-17


Author LoginPost Reply

user Digest 17 Jul 2009 19:53:06 -0000 Issue 8758

Topics (messages 200842 through 200868):

Re: in JSP: rounding values
 200842 by: mathias-ewald
 200844 by: Lukasz Lenart

Working with dynamic forms
 200843 by: mathias-ewald

[S1.3.10] Apache Tiles fail
 200845 by: Struts Two
 200846 by: Antonio Petrelli
 200852 by: Struts Two

Re: Plug-in creation and freemarker page location
 200847 by: stanlick

struts 2.1.5 type conversion error
 200848 by: Sandy.Verfaille.roularta.be

Help with a redirect
 200849 by: Security Management
 200855 by: Security Management

Re: Blocked trying to get lock: org.apache.log4j.spi.RootLogger
 200850 by: laredotornado

Re: struts 2 adoption/performance/scalability
 200851 by: Jim Kiley

Re: Setter in action triggers twice. Bug?
 200853 by: Musachy Barroso
 200856 by: Ritvars Rundzāns
 200857 by: Musachy Barroso
 200864 by: Dale Newfield
 200868 by: Musachy Barroso

Re: unit testing Struts2 application (with Spring and Hibernate)
 200854 by: Andy
 200858 by: Greg Lindholm
 200859 by: Wes Wannemacher
 200860 by: Dimitrios Christodoulakis
 200861 by: Wes Wannemacher

Re: Struts2 + JPA - Lazy Initialization During View Generation
 200862 by: Nathan Schulte
 200863 by: Jim Kiley
 200865 by: Nathan Schulte
 200866 by: Wes Wannemacher
 200867 by: Nathan Schulte

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------


Attachment: user_200842.ezm (zipped)

Okay, it was just my understanding of the whole thing. I will do as you
suggested.

cu


Lukasz Lenart wrote:
>
> 2009/7/17 mathias-ewald <nitehoaxxer@(protected)>:
>> I don't think so - I want the exact value to be shown, too, so it's more
>> a UI
>> thing.
>
> As you thing, but that's the business logic and even such simple
> operation shouldn't be performed in UI. Maybe it will be simpler to
> create TransferObject with original value and rounded value and put it
> on the list.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
> http://dailylog.lenart.org.pl/
>
> Pablo Picasso - "Computers are useless. They can only give you
> answers." - http://www.brainyquote.com/quotes/authors/p/pablo_picasso.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200844.ezm (zipped)
2009/7/17 mathias-ewald <nitehoaxxer@(protected)>:
> Okay, it was just my understanding of the whole thing. I will do as you
> suggested.

It even will be faster than searching for some strange solution with
Struts2 Tags ;-)


Regards
--
Lukasz
http://www.lenart.org.pl/
http://dailylog.lenart.org.pl/

Mike Ditka - "If God had wanted man to play soccer, he wouldn't have
given us arms." -
http://www.brainyquote.com/quotes/authors/m/mike_ditka.html


Attachment: user_200843.ezm (zipped)

Hi,

I have a Category business object looking like this:

------------------------------
public class Category {
    private Category parent;
    private Set<Category> children;
    //...
}
------------------------------

I have a form that allows me to edit in information about a different
object. This object is linked to zero, one or more Category objects. What's
a good way to display this? I though of check boxes. The check boxes must be
checked if the object is already attached to that Category.

To me this seems to be kinda impossible right now. Any suggestions?

cu
mathias
--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200845.ezm (zipped)

I have been trying to start a new project using struts 1.3.10 on Websphere V6.1. However, I have been unable to make tiles work with struts 1.3 . I get an exception as follows:

Stack Dump = java.io.FileNotFoundException: mainPage
......

I have downgraded to strtus 1.2.9 and everything is working as expected. My two cents are this can be one of those Websphere bugs [similar to the one I experienced sometime ago when I used Struts 2.1.x]. However, to be on the safe side, I am asking struts user group to see if anyone else has experienced the samething on Websphere [probably found a way around it] or not?


   __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/


Attachment: user_200846.ezm (zipped)
2009/7/17 Struts Two <strutstwo@(protected)>:
>
> I have been trying to start a new project using struts 1.3.10 on Websphere V6.1. However, I have been unable to make tiles work with struts 1.3 . I get an exception as follows:
>
> Stack Dump = java.io.FileNotFoundException: mainPage

See:
http://wiki.apache.org/struts/StrutsUpgradeNotes12to13
at the "4.3 Tiles" section.

Antonio


Attachment: user_200852.ezm (zipped)

Antonio:

Thank you for the url, I was missing the tiles config. It would be great if information related to struts 1.3 is put under user guide for struts 1.3 as I started with 1.3.10 blank.war.

Once again, thanks for the url.

--- On Fri, 7/17/09, Antonio Petrelli <antonio.petrelli@(protected):

> From: Antonio Petrelli <antonio.petrelli@(protected)>
> Subject: Re: [S1.3.10] Apache Tiles fail
> To: "Struts Users Mailing List" <user@(protected)>
> Received: Friday, July 17, 2009, 1:03 PM
> 2009/7/17 Struts Two <strutstwo@(protected)>:
> >
> > I have been trying to start a new project using struts
> 1.3.10 on Websphere V6.1. However, I have been unable to
> make tiles work with struts 1.3 . I get an exception as
> follows:
> >
> > Stack Dump = java.io.FileNotFoundException: mainPage
>
> See:
> http://wiki.apache.org/struts/StrutsUpgradeNotes12to13
> at the "4.3 Tiles" section.
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


   __________________________________________________________________
The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/


Attachment: user_200847.ezm (zipped)

I am using the leading "/" and it still seems to be using the namespace! I
renamed the ftl folder pages to be config to match the namespace, and it
works fine. Is there another way? I originally tried with and without the
leading slash and ultimately had to make this change to get it to work. I
was a little puzzled by this. Since it is a plug-in, I'd hate to require
additional configuration settings on the part of the developer. It should
be plug-n-play man!

P.S. By the way... which one's Pink?

Peace,
Scott



Musachy Barroso wrote:
>
> Well, actually I am wrong about that and yes, if there is no "/", it
> will use the namespace name:
>
>  if (!locationArg.startsWith("/")) {
>         ActionContext ctx = invocation.getInvocationContext();
>         HttpServletRequest req = (HttpServletRequest)
> ctx.get(ServletActionContext.HTTP_REQUEST);
>         String base = ResourceUtil.getResourceBase(req);
>         locationArg = base + "/" + locationArg;
>      }
>
> musachy
>
> On Thu, Jul 16, 2009 at 3:36 PM, Musachy Barroso<musachy@(protected):
>> there is no magic there, remove the first "/" and give it a try.
>>
>> musachy
>>
>> On Thu, Jul 16, 2009 at 12:29 PM, stanlick<stanlick@(protected):
>>>
>>> I am working on a plug-in and having trouble getting the runtime to find
>>> my
>>> freemarker pages.  I have a folder named pages in my plugin.jar where my
>>> freemarker pages reside.  My struts-plugin.xml is referring to the pages
>>> as
>>> follows:
>>>
>>> <result type="freemarker">/pages/config.ftl</result>
>>>
>>> However, I am receiving a runtime
>>>
>>> java.io.FileNotFoundException: Template /config/pages/config.ftl not
>>> found.
>>>        at
>>> freemarker.template.Configuration.getTemplate (Configuration.java:489)
>>>
>>> I have studied the struts2-config-browser-plugin and I'm now starting to
>>> wonder if there is some magic with respect to the freemarker folder
>>> being
>>> called config-browser which happens to be the same namespace of the
>>> plugin.
>>>
>>> Does anyone know the mechanics of these names?
>>>
>>> Peace,
>>> Scott
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Plug-in-creation-and-freemarker-page-location-tp24522925p24522925.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200848.ezm (zipped)
Hi,

I have made a simple struts form

<s:form action="addProduct" method="post" validate="true" >
Name nl<s:textfield name="nameNl" />
price<s:textfield name="price" value=""/>
</s:form>

And an action class with getters and setters for nameNl and price.
When I submit my form, with a price > 0, for example 3, everything goes
well.
When I enter 0 or a negative number, I get the following error:

java.lang.NoSuchMethodException: setPrice([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.j
ava:75)
at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectA
ccessor.java:28)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
...

I know this has been posted a few times, but I can't find an answer
anywhere..
Is this a bug? And how can I resolve it?
I found something at:
https://issues.apache.org/struts/browse/WW-2971?page=com.atlassian.jira.
plugin.system.issuetabpanels%3Aall-tabpanel
<https://issues.apache.org/struts/browse/WW-2971?page=com.atlassian.jira
.plugin.system.issuetabpanels%3Aall-tabpanelbut>
but I have no idea what I should do with that article, or with the zip
in attchement on that article.
Can anyone help me pls?



Thx,
Sandy




Attachment: user_200849.ezm (zipped)
When my index page loads, ajax requests are posted to the statusAjax page
with a parameter of door.id equal to x for the doors.

That works fine, and is a POST.

When I click on an icon, it posts to the identical action, to either lock or
unlock. When the action is done, I redirect to the status action (just like
when the index loads, except with a GET this time). I get an exception
setting the door.id, but the url shows that the get value and property name
are right for the redirect action. Can someone explain what I am doing
wrong? The action works on the index ajax calls, but future clicks give me:

Caused by: ognl.NoSuchPropertyException:
org.apache.struts2.dispatcher.ServletActionRedirectResult.door

Here is the struts.xml

<action name="index"
class="com.secmgmt.struts2.actions.door_control.DoorControlIndexAction">
   <result
name="success">/pages/door-control/jsps/index-ajax.jsp</result>
</action>
<action name="lock"
class="com.secmgmt.struts2.actions.door_control.DoorControlLockDoor">
 <result name="success" type="redirectAction">
   <param name="actionName">statusAjax</param>
 <param name="door.id">${door.id}</param>
</result>
</action>
   
<action name="unlock"
class="com.secmgmt.struts2.actions.door_control.DoorControlUnlockDoor">
 <result name="success" type="redirectAction">
   <param name="actionName">statusAjax</param>
     <param name="door.id">${door.id}</param>
 </result>
</action>

<action name="statusAjax"
class="com.secmgmt.struts2.actions.door_control.AjaxDoorStatus">
 <result
name="success">/pages/door-control/jsps/single-door-ajax.jsp</result>
</action>



Attachment: user_200855.ezm (zipped)
OK, tried adding the "parse" param, and still no luck...

<action name="unlock"
class="com.secmgmt.struts2.actions.door_control.DoorControlUnlockDoor">
     <result name="success" type="redirectAction">
       <param name="actionName">statusAjax</param>
       <param name="door.id">${door.id}</param>
       <param name="parse">true</param>
     </result>
</action>

-----Original Message-----
From: Security Management [mailto:list-subscriptions@(protected)]
Sent: Friday, July 17, 2009 9:56 AM
To: 'Struts Users Mailing List'
Subject: Help with a redirect

When my index page loads, ajax requests are posted to the statusAjax page
with a parameter of door.id equal to x for the doors.

That works fine, and is a POST.

When I click on an icon, it posts to the identical action, to either lock or
unlock. When the action is done, I redirect to the status action (just like
when the index loads, except with a GET this time). I get an exception
setting the door.id, but the url shows that the get value and property name
are right for the redirect action. Can someone explain what I am doing
wrong? The action works on the index ajax calls, but future clicks give me:

Caused by: ognl.NoSuchPropertyException:
org.apache.struts2.dispatcher.ServletActionRedirectResult.door

Here is the struts.xml

<action name="index"
class="com.secmgmt.struts2.actions.door_control.DoorControlIndexAction">
   <result
name="success">/pages/door-control/jsps/index-ajax.jsp</result>
</action>
<action name="lock"
class="com.secmgmt.struts2.actions.door_control.DoorControlLockDoor">
 <result name="success" type="redirectAction">
   <param name="actionName">statusAjax</param>
 <param name="door.id">${door.id}</param>
</result>
</action>
   
<action name="unlock"
class="com.secmgmt.struts2.actions.door_control.DoorControlUnlockDoor">
 <result name="success" type="redirectAction">
   <param name="actionName">statusAjax</param>
     <param name="door.id">${door.id}</param>
 </result>
</action>

<action name="statusAjax"
class="com.secmgmt.struts2.actions.door_control.AjaxDoorStatus">
 <result
name="success">/pages/door-control/jsps/single-door-ajax.jsp</result>
</action>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



Attachment: user_200850.ezm (zipped)

Here is my contribution to the good of humanity. The below problem went away
when we increased the number of file descriptors available to our WebLogic
managic server process from 1024 to 65K. - Dave


laredotornado wrote:
>
> Hi, We are using WebLogic 9.2.2 with Java 1.5. The application is written
> using Struts 1.3 and log4j 1.2.15. We found a number of errors that
> looked like below in our managed server's .out file. Any ideas what might
> be a cause or how to troubleshoot further? Our sys admin sadly did not
> preserve a thread dump:
>
> <Jun 30, 2009 3:00:11 PM UTC> <Error> <WebLogicServer> <BEA-000337>
> <[STUCK] ExecuteThread: '148' for queue: 'weblogic.kernel.Default
> (self-tuning)' has been busy for "604" seconds working on the request
> "Http Request: /myapp/hhFlow.do", which is more than the configured time
> (StuckThreadMaxTime) of "600" seconds. Stack trace:
> Thread-135888 "[STUCK] ExecuteThread: '148' for queue:
> 'weblogic.kernel.Default (self-tuning)'" <alive, in native, suspended,
> blocked, priority=1, DAEMON> {
>   -- Blocked trying to get lock:
> org.apache.log4j.spi.RootLogger@(protected)]
>   org.apache.log4j.Category.callAppenders (Category.java:188)
>   org.apache.log4j.Category.forcedLog (Category.java:379)
>   org.apache.log4j.Category.log (Category.java:840)
>  
> org.apache.commons.logging.impl.Log4JLogger.debug (Log4JLogger.java:109)
>  
> org.apache.struts.chain.commands.ActionCommandBase.execute (ActionCommandBase.java:48)
>   org.apache.commons.chain.impl.ChainBase.execute (ChainBase.java:176)
>  
> org.apache.commons.chain.generic.LookupCommand.execute (LookupCommand.java:303)
>   org.apache.commons.chain.impl.ChainBase.execute (ChainBase.java:176)
>  
> org.apache.struts.chain.ComposableRequestProcessor.process (ComposableRequestProcessor.java:272)
>  
> org.apache.struts.action.ActionServlet.process (ActionServlet.java:1903)
>   org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:462)
>   javax.servlet.http.HttpServlet.service (HttpServlet.java:736)
>   javax.servlet.http.HttpServlet.service (HttpServlet.java:851)
>  
> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:224)
>  
> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:108)
>  
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:198)
>   weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
>  
> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
>  
> com.myco.regui.servlets.filters.TransactionFilter.doFilter(TransactionFilter.java:23)
>  
> weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:41)
>  
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3201)
>  
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:308)
>  
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:117)
>  
> weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1938)
>  
> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1860)
>  
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1327)
>   weblogic.work.ExecuteThread.execute(ExecuteThread.java:206)
>   weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
> Thanks for any feedback, - Dave
>

--
Sent from the Struts - User mailing list archive at Nabble.com.



Attachment: user_200851.ezm (zipped)
I don't have any benchmark numbers, but we're using it in production at my
current client, running a b2b ecommerce site with about 3,000 active
customers that pushed through about 4,000 orders in the last month.
jk

On Thu, Jul 16, 2009 at 7:12 PM, Musachy Barroso <musachy@(protected):

> I am trying to "sell" the idea of using Struts 2 to my employer, and I
> know these questions will come up:
>
> 1. Who is using it?
> 2. How does it perform, compared to plain servlets and jsps?
> 3. How well does it scale?
> 4. Has anyone benchmark it under load? numbers?
>
> 2-4 are somewhat related. I am sure many of you have gone through this
> before, so if you can share some info with me I would appreciate it
> (believe it or not I haven't built a production application with
> struts 2 yet)
>
> thanks
> musachy
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Attachment: user_200853.ezm (zipped)
you are confusing static parameters with request parameters. You *do
not* need to add "param" to your action mapping to get the parameters
bound the class fields. You add "param" to your action mapping to
"inject" things into your action, IoC style, but is is not needed for
request parameters. So if you have something like:

<param name="cmd">bbbb</param>

and you call the action like /action?cmd=aaa, then setCmd(...) will be
called 2 times, one for the static param("bbb"), and another time for
the request param ("aaa").

musachy

On Fri, Jul 17, 2009 at 1:23 AM, Ritvars Rundzāns<rrundzans@(protected):
> Ok, this is all great, but problem still is not solved.
> You can see configs provided @ war.
>
> I will put this simple:
> My app`s config is taken from struts-blank, so its minimal, and there are no
> explicit changes in interceptor stack for any of actions. Why this crap
> happens then? I really dont care what calls who - what matters here - why
> this even happens on such minimalistic configuration?
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Attachment: user_200856.ezm (zipped)
    <action name="person-*-*" class="example.Person">
       <param name="cmd">{1}</param>
       <param name="id">{2}</param>

       <result>jsp/abc.jsp</result>
    </action>

>> You *do
>> not* need to add "param" to your action mapping to get the parameters
>> bound the class fields.

I understand that. As you can see, example request (/person-aaa-bbb?dum=ccc)
gives 1 request param (classical meaning, bound automaticaly) , and extracts
2 params from URI part before *?* (THIS, I GUESS, *CANT BE BINDED*
AUTOMATICALY).

I DO NOT pass cmd and id as request params (classical meaning: ?param=val)
in this example. But they are passed, thats true.

Ok, write me then action mapping , that urls like /person-aaa-bbb?dum=ccc
maps to action PersonAction, and sets 3 params - cmd, id and dum.

Attachment: user_200857.ezm (zipped)
Ok I see it now. The staticparams interceptor adds the params to the
request params map, so that would explain why it is called again. We
could add a setting to the result to prevent this if needed.

musachy

On Fri, Jul 17, 2009 at 10:18 AM, Ritvars Rundzāns<rrundzans@(protected):
>        <action name="person-*-*" class="example.Person">
>            <param name="cmd">{1}</param>
>            <param name="id">{2}</param>
>
>            <result>jsp/abc.jsp</result>
>        </action>
>
>>> You *do
>>> not* need to add "param" to your action mapping to get the parameters
>>> bound the class fields.
>
> I understand that. As you can see, example request (/person-aaa-bbb?dum=ccc)
> gives 1 request param (classical meaning, bound automaticaly) , and extracts
> 2 params from URI part before *?* (THIS, I GUESS, *CANT BE BINDED*
> AUTOMATICALY).
>
> I DO NOT pass cmd and id as request params (classical meaning: ?param=val)
> in this example. But they are passed, thats true.
>
> Ok, write me then action mapping , that urls like /person-aaa-bbb?dum=ccc
> maps to action PersonAction, and sets 3 params - cmd, id and dum.
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Attachment: user_200864.ezm (zipped)
Musachy Barroso wrote:
> Ok I see it now. The staticparams interceptor adds the params to the
> request params map, so that would explain why it is called again. We
> could add a setting to the result to prevent this if needed.

I would argue that each of {staticP,actionMappingP,p}arams should both
set the discovered and acceptable params on the action and add the
discovered and acceptable params to the map so that ParameterAware
actions can be handed the full set of parameters detected by the
interceptors. It sounds like params is setting both those discovered by
it and those that already managed to get into that map before it runs.
This shouldn't be a big deal as setting a parameter should be
idempotent, but I would agree that this is a bug.

-Dale


Attachment: user_200868.ezm (zipped)
We cant change it because it would break backward compatibility. I
added a "merge" parameter to the static parameters
interceptor(defaults to true):

http://jira.opensymphony.com/browse/XW-709

fixed in xwork trunk. Thanks for reporting!

musachy

On Fri, Jul 17, 2009 at 12:02 PM, Dale Newfield<dale@(protected):
> Musachy Barroso wrote:
>>
>> Ok I see it now. The staticparams interceptor adds the params to the
>> request params map, so that would explain why it is called again. We
>> could add a setting to the result to prevent this if needed.
>
> I would argue that each of {staticP,actionMappingP,p}arams should both set
> the discovered and acceptable params on the action and add the discovered
> and acceptable params to the map so that ParameterAware actions can be
> handed the full set of parameters detected by the interceptors.  It sounds
> like params is setting both those discovered by it and those that already
> managed to get into that map before it runs. This shouldn't be a big deal as
> setting a parameter should be idempotent, but I would agree that this is a
> bug.
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Attachment: user_200854.ezm (zipped)

Couldn't agree more.


> From: wesw@(protected)
> To: user@(protected)
> Subject: Re: unit testing Struts2 application (with Spring and Hibernate)
> Date: Thu, 16 Jul 2009 21:59:35 -0400
>
> On Thursday 16 July 2009 07:14:30 pm Dave Newton wrote:
> >
> > IMO that's outside the purview of unit testing, though--by definition
> > this describes integration testing: the testing of an action along with
> > the framework.
> >
> > There's nothing *wrong* with doing that testing, I just don't think it's
> > the same thing as unit testing: independently testing the smallest bits
> > of functionality.
> >
> > JUnit can be used for that kind of testing too (and I do, sometimes),
> > but once I'm at that point I generally figure I might as well just be
> > doing client-focused testing and testing the output of my results. I
> > also use Selenium, although I may switch back to using a layer I wrote
> > on top of Watir.
> >
> > Dave
> >
>
> Not to throw weight around, but it is sort of curious to me that the three
> struts committers who chimed in all agreed that tip-to-tail integration
> testing in JUnit is not worth the effort. I only bring it up because, IMO,
> struts 2 is one of the best-unit-tested products I've ever worked on. I think
> Dave, Musachy and myself are biased against tip-to-tail in JUnit because in
> Struts 2, we have a guideline to unit test all bugfixes and new functionality.
> That being so, all three of us have probably come across situations where
> writing the unit test is 500x harder than writing the fix :)
>
> Dave does a good job of making the point I tried to make earlier, tip-to-tail
> testing is better looked at as an integration test and it becomes much easier
> to deal with as an integration test. If you are unfamiliar with selenium, it
> is worth learning. One of the posters earlier mentioned that he didn't want to
> learn another testing framework when he already knows JUnit. Selenium is nice
> because it runs right in the browser (IE and Firefox) and runs though a set of
> VB-like instructions... Things like - open this url, look for this text, click
> this link and then make sure this text exists. IMO, if you want to make sure
> that your action renders the appropriate result, this is way better than
> trying to coax the framework by bootstrapping it with mocks then figuring out a
> way to retrieve the rendered result. As an added bonus, it is possible to get
> maven to launch selenium tests, so you can get full unit and integration
> testing out of your CI if you are willing to put forth the effort.
>
> To drive the point home further, I would add that the Dojo plugin probably
> would have been more stable if we had taken the selenium approach (that is
> being employed with the slowly moving jquery plugin).
>
> -Wes
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Attachment: user_200858.ezm (zipped)
>
> > >
> > > IMO that's outside the purview of unit testing, though--by definition
> > > this describes integration testing: the testing of an action along with
> > > the framework.
> > >
> > > There's nothing *wrong* with doing that testing, I just don't think
> it's
> > > the same thing as unit testing: independently testing the smallest bits
> > > of functionality.
> > >
> > > JUnit can be used for that kind of testing too (and I do, sometimes),
> > > but once I'm at that point I generally figure I might as well just be
> > > doing client-focused testing and testing the output of my results. I
> > > also use Selenium, although I may switch back to using a layer I wrote
> > > on top of Watir.
> > >
> > > Dave
> > >
> >
> > Not to throw weight around, but it is sort of curious to me that the
> three
> > struts committers who chimed in all agreed that tip-to-tail integration
> > testing in JUnit is not worth the effort. I only bring it up because,
> IMO,
> > struts 2 is one of the best-unit-tested products I've ever worked on. I
> think
> > Dave, Musachy and myself are biased against tip-to-tail in JUnit because
> in
> > Struts 2, we have a guideline to unit test all bugfixes and new
> functionality.
> > That being so, all three of us have probably come across situations where
> > writing the unit test is 500x harder than writing the fix :)
> >
> > Dave does a good job of making the point I tried to make earlier,
> tip-to-tail
> > testing is better looked at as an integration test and it becomes much
> easier
> > to deal with as an integration test. If you are unfamiliar with selenium,
> it
> > is worth learning. One of the posters earlier mentioned that he didn't
> want to
> > learn another testing framework when he already knows JUnit. Selenium is
> nice
> > because it runs right in the browser (IE and Firefox) and runs though a
> set of
> > VB-like instructions... Things like - open this url, look for this text,
> click
> > this link and then make sure this text exists. IMO, if you want to make
> sure
> > that your action renders the appropriate result, this is way better than
> > trying to coax the framework by bootstrapping it with mocks then figuring
> out a
> > way to retrieve the rendered result. As an added bonus, it is possible to
> get
> > maven to launch selenium tests, so you can get full unit and integration
> > testing out of your CI if you are willing to put forth the effort.
> >
> > To drive the point home further, I would add that the Dojo plugin
> probably
> > would have been more stable if we had taken the selenium approach (that
> is
> > being employed with the slowly moving jquery plugin).
> >
> > -Wes
> >
>

Not to pick on anyone but this isn't really a popularity contest. Different
situations have different needs and there is no reason to suggest that one
solution will work best for everyone.

At a large shop naming something "unit testing" vs "integration testing"
maybe important as it can determined who's job it is to do the work. But at
a small shop, like I'm at, it makes no difference, it's all just testing and
it's the developers job. So for me, whatever way is easiest, quickest and
gets the job done wins.

It took some work at first to figure out how to tests actions with the full
stack with junit but now that I have the plumbing figured out it's very easy
to add tests as actions are added. With junit I can easily set the database
to a know state before each test, or use mocks to simulate hard to setup
edge conditions (how easy is that to do with selenium?) Plus it's easy to
jun junit with code coverage so I can see code isn't being covered. And, as
another already pointed out, junit is fast and convienent, 2 clicks from
inside Eclipse.

I do think it is great to see that the industry (at least those on this
list) recognizes the importance of automated testing and that with Struts
you have ability to test at the isolated pojo detail level all the way
through full blow integration testing.

Attachment: user_200859.ezm (zipped)
On Fri, Jul 17, 2009 at 2:00 PM, Greg Lindholm<greg.lindholm@(protected):
>
> Not to pick on anyone but this isn't really a popularity contest. Different
> situations have different needs and there is no reason to suggest that one
> solution will work best for everyone.

Greg, I didn't want it to come off as a popularity thing, my point was
that a lot of us might be against excessive JUnit testing because of
how much of a PITA it can be within the Struts codebase.

>
> At a large shop naming something "unit testing" vs "integration testing"
> maybe important as it can determined who's job it is to do the work.  But at
> a small shop, like I'm at, it makes no difference, it's all just testing and
> it's the developers job.  So for me, whatever way is easiest, quickest and
> gets the job done wins.

I agree that whatever is quickest and easiest wins, and I would add
that you also have to try to consider the best tool for the job.

>
> It took some work at first to figure out how to tests actions with the full
> stack with junit but now that I have the plumbing figured out it's very easy
> to add tests as actions are added. With junit I can easily set the database
> to a know state before each test, or use mocks to simulate hard to setup
> edge conditions (how easy is that to do with selenium?)  Plus it's easy to
> jun junit with code coverage so I can see code isn't being covered. And, as
> another already pointed out, junit is fast and convienent, 2 clicks from
> inside Eclipse.

See, this is where I think you are missing my point. I am trying to
indicate that with a tool like Selenium, you don't *need* to setup
mock objects, you are dealing with a real, live deployment (hopefully
on a dev-testing system). You simply deploy your app, then tell
selenium to run your tests. Here's my issue with setting up mocks and
trying to learn how to push actions all the way through the framework
from a unit test. How do you know that we won't introduce changes that
break your whole setup? I haven't read the article you have, but what
I am trying to say is that if you want to test the whole flow of the
framework... Why not use a tool that lets you script an interaction so
that you can just replay the script? There's no need to setup mocks,
etc. You are likely developing your apps by having the code in one
window and a browser in another. So, why not take the spots that have
been known to cause trouble, and script an interaction with it so that
each time you run your tests, you can make sure that it is still
operational.

If you aren't familiar with Selenium, you may be completely
misunderstanding why I think it's a better approach. You might install
the selenium IDE and then run the selenium tests that are setup in
sandbox/s2-jquery-showcase, just to see what I'm talking about. And,
if you're curious, with m2eclipse and the Selenium Maven Plugin, you
are likely to have it two clicks away as well.

>
> I do think it is great to see that the industry (at least those on this
> list) recognizes the importance of automated testing and that with Struts
> you have ability to test at the isolated pojo detail level all the way
> through full blow integration testing.
>



--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


Attachment: user_200860.ezm (zipped)
Of course you're right Greg, it's not a contest... no right or wrong
here. I am glad to hear all the views coming from everyone and
commiters too.

Well, my original motivation was to learn how to do this kind of
tip-to-tail, all inclusive testing, with the interceptor stack
involved.

For example if I want to unit test an action within a secure package,
that action requires the authentication interceptor to execute first,
so, to do my testing I thought that the full fledged testing was
necessary, to include my required interceptors. But from what I have
been researching and hearing in this conversation, I believe there is
a way to provide a "mock" object acting like my authentication
interceptor and thus not need to include the interceptor stack.

Also, I am not sure about testing a class which implements other
struts interfaces like preparable, sessionaware, etc. Would that make
a special case?

Just a quick question to Wes: In your upcoming book, which is in the
MEAP phase, there is an appendix titled Unit testing with JUnit and
TestNG . Is there any plan to include some examples describing the
different kinds of unit testing that can be done? I am looking forward
to taking a look at it.

On Fri, Jul 17, 2009 at 1:00 PM, Greg Lindholm<greg.lindholm@(protected):
>>
>> > >
>> > > IMO that's outside the purview of unit testing, though--by definition
>> > > this describes integration testing: the testing of an action along with
>> > > the framework.
>> > >
>> > > There's nothing *wrong* with doing that testing, I just don't think
>> it's
>> > > the same thing as unit testing: independently testing the smallest bits
>> > > of functionality.
>> > >
>> > > JUnit can be used for that kind of testing too (and I do, sometimes),
>> > > but once I'm at that point I generally figure I might as well just be
>> > > doing client-focused testing and testing the output of my results. I
>> > > also use Selenium, although I may switch back to using a layer I wrote
>> > > on top of Watir.
>> > >
>> > > Dave
>> > >
>> >
>> > Not to throw weight around, but it is sort of curious to me that the
>> three
>> > struts committers who chimed in all agreed that tip-to-tail integration
>> > testing in JUnit is not worth the effort. I only bring it up because,
>> IMO,
>> > struts 2 is one of the best-unit-tested products I've ever worked on. I
>> think
>> > Dave, Musachy and myself are biased against tip-to-tail in JUnit because
>> in
>> > Struts 2, we have a guideline to unit test all bugfixes and new
>> functionality.
>> > That being so, all three of us have probably come across situations where
>> > writing the unit test is 500x harder than writing the fix :)
>> >
>> > Dave does a good job of making the point I tried to make earlier,
>> tip-to-tail
>> > testing is better looked at as an integration test and it becomes much
>> easier
>> > to deal with as an integration test. If you are unfamiliar with selenium,
>> it
>> > is worth learning. One of the posters earlier mentioned that he didn't
>> want to
>> > learn another testing framework when he already knows JUnit. Selenium is
>> nice
>> > because it runs right in the browser (IE and Firefox) and runs though a
>> set of
>> > VB-like instructions... Things like - open this url, look for this text,
>> click
>> > this link and then make sure this text exists. IMO, if you want to make
>> sure
>> > that your action renders the appropriate result, this is way better than
>> > trying to coax the framework by bootstrapping it with mocks then figuring
>> out a
>> > way to retrieve the rendered result. As an added bonus, it is possible to
>> get
>> > maven to launch selenium tests, so you can get full unit and integration
>> > testing out of your CI if you are willing to put forth the effort.
>> >
>> > To drive the point home further, I would add that the Dojo plugin
>> probably
>> > would have been more stable if we had taken the selenium approach (that
>> is
>> > being employed with the slowly moving jquery plugin).
>> >
>> > -Wes
>> >
>>
>
> Not to pick on anyone but this isn't really a popularity contest. Different
> situations have different needs and there is no reason to suggest that one
> solution will work best for everyone.
>
> At a large shop naming something "unit testing" vs "integration testing"
> maybe important as it can determined who's job it is to do the work.  But at
> a small shop, like I'm at, it makes no difference, it's all just testing and
> it's the developers job.  So for me, whatever way is easiest, quickest and
> gets the job done wins.
>
> It took some work at first to figure out how to tests actions with the full
> stack with junit but now that I have the plumbing figured out it's very easy
> to add tests as actions are added. With junit I can easily set the database
> to a know state before each test, or use mocks to simulate hard to setup
> edge conditions (how easy is that to do with selenium?)  Plus it's easy to
> jun junit with code coverage so I can see code isn't being covered. And, as
> another already pointed out, junit is fast and convienent, 2 clicks from
> inside Eclipse.
>
> I do think it is great to see that the industry (at least those on this
> list) recognizes the importance of automated testing and that with Struts
> you have ability to test at the isolated pojo detail level all the way
> through full blow integration testing.
>


Attachment: user_200861.ezm (zipped)
On Fri, Jul 17, 2009 at 2:28 PM, Dimitrios
Christodoulakis<dimi.chr@(protected):
[snip]
>
> Just a quick question to Wes: In your upcoming book, which is in the
> MEAP phase, there is an appendix titled Unit testing with JUnit and
> TestNG . Is there any plan to include some examples describing the
> different kinds of unit testing that can be done? I am looking forward
> to taking a look at it.
>


Yes, it will be very high-level, meant to demonstrate how easy testing
is meant to be. IMO, a lot of the people that are still shying away
from unit testing do so because (they believe) testing is difficult to
setup and a hassle to maintain. There will be examples for junit,
testNG, and how to inject with spring as well as using maven to
automate the running of tests. I'll also discuss the various testing
strategies (integration vs. unit) and basically evangelize the same
position I'm arguing for on this thread :-D

-Wes
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


Attachment: user_200862.ezm (zipped)
So is this the only resolution out there? To lazily initialize the contents I
know I'll need before the container decides to trash the persistence context?
There is no way to extend the context such that the lazy initialization will
work when rendering the view?






Attachment: user_200863.ezm (zipped)
I think I missed the early part of the discussion -- I assume that the
OpenEntityManagerInViewFilter is not the solution for you?
jk

On Fri, Jul 17, 2009 at 2:53 PM, Nathan Schulte <nathan.schulte@(protected):

> So is this the only resolution out there? To lazily initialize the
> contents I
> know I'll need before the container decides to trash the persistence
> context?
> There is no way to extend the context such that the lazy initialization
> will
> work when rendering the view?
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com

Attachment: user_200865.ezm (zipped)
Jim Kiley <jhkiley <at> summa-tech.com> writes:
> I assume that the OpenEntityManagerInViewFilter is not the solution for you?

I'm not using Spring. As such, I'm not familiar with this filter, but from the
description, yes, that is what is needed. However, the app server manages the
transactions, and injects the EntityManager when needed. I can do a JDNI lookup
and receive an EntityManager, but I'm unsure of where this would actually need
to be placed (an interceptor? in the action, to be placed on the stack
somewhere(so a reference is held?)).





Attachment: user_200866.ezm (zipped)
http://struts.apache.org/2.x/docs/non-ioc-version-of-opensessioninviewinterceptor.html

This is not exactly what you want, and it's based on Hibernate and a
hibernate session, but if you think of hibernate sessions as jpa EMs,
then you can just make the appropriate changes to this and at least be
further than you are now.

-Wes

On Fri, Jul 17, 2009 at 3:09 PM, Nathan Schulte<nathan.schulte@(protected):
> Jim Kiley <jhkiley <at> summa-tech.com> writes:
>> I assume that the OpenEntityManagerInViewFilter is not the solution for you?
>
> I'm not using Spring.  As such, I'm not familiar with this filter, but from the
> description, yes, that is what is needed.  However, the app server manages the
> transactions, and injects the EntityManager when needed.  I can do a JDNI lookup
> and receive an EntityManager, but I'm unsure of where this would actually need
> to be placed (an interceptor? in the action, to be placed on the stack
> somewhere(so a reference is held?)).
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


Attachment: user_200867.ezm (zipped)
Wes Wannemacher <wesw <at> wantii.com> writes:
> This is not exactly what you want, and it's based on Hibernate and a
> hibernate session, but if you think of hibernate sessions as jpa EMs,
> then you can just make the appropriate changes to this and at least be
> further than you are now.

Thanks Wes, I don't know how I didn't catch that page when browsing the docs.
That's actually very similar to the interceptor I just started working on. I'll
let you know what I come up with.


©2008 gg3721.com - Jax Systems, LLC, U.S.A.