You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ovidiu EFTIMIE <oe...@assemblee-nat.fr> on 2003/12/18 18:05:28 UTC

Struts test cases

Hi,
Has anyone used WSAD 5.0 with StrutsTestCase 2.0 ?
I've only succeded to make it work after several operation which don't inspire
me much confidence, or maybe is just me  taking  the hard way.
Is there anyone there who used this and can give me some hints?

Thanx,
Ovidiu

PS: For anyone interested here are the steps I took to make it work the way it
does

[1]. in setUp() add
setContextDirectory(new File("D:\\workspace\\strutsJunit\\jsp"));
setConfigFile("/WEB-INF/struts-config.xml");
[2.]Replace the  servletunit.ServletContextSimulator getRessource() method
content with
try {
   return this.getClass().getResource(path);
 } catch (Exception e) {
      return null;
 }
[3.]execute ant to build a new strutstest-2.0.0.jar (the new one has 42K)
[4.]replace in the /WEB-INF/lib/ strutstest-2.0.0.jar (38K) with the new one
[5.]In your /WEB-INF/classes/ create a directory called /WEB-INF/ and copy
struts-config.xml and web.xml there
Run your tests


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Access ResourceBundle

Posted by Peter Sloots <pe...@xs4all.nl>.
Here you go?

<%
      org.apache.struts.util.MessageResources mr = org.apache.struts.validator.Resources.getMessageResources(request);	
      if (loginForm.getUsername.equalsIgnoreCase( mr.getMessage("key.value") )
      {
            ....
      }
%>


*********** REPLY SEPARATOR  ***********

On 19-12-2003 at 13:34 Manuel Lenz wrote:

>Hi to all,
>it is simple to get Data from the strutsRessourceBundle with the jspTag.
>But I need to get ResourceData inside a java-Part of the jsp-page and
>inside an ActionClass.
>
>For example
>
><%
>      if (loginForm.getUsername.equalsIgnoreCase( ----ResourceData ----)
>      {
>            ....
>      }%>
>
>Does anybody know how to get the Data?
>
>Cheers,
>Manuel
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Access ResourceBundle

Posted by Manuel Lenz <Lz...@viessmann.com>.




Hi to all,
it is simple to get Data from the strutsRessourceBundle with the jspTag.
But I need to get ResourceData inside a java-Part of the jsp-page and
inside an ActionClass.

For example

<%
      if (loginForm.getUsername.equalsIgnoreCase( ----ResourceData ----)
      {
            ....
      }%>

Does anybody know how to get the Data?

Cheers,
Manuel


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Struts test cases

Posted by Tim Lucia <ti...@yahoo.com>.
I am using it with Eclipse...  I had to do some things in setUp() to
make it work:

    /*
     * @see TestCase#setUp()
     */
    public void setUp() throws Exception {
        super.setUp();
        // STC2.0 requires the file context to be set, at least from
        // Eclipse.  STC2.1.0 is supposed to fix this.
        setContextDirectory(new File("ILT/"));
        // Set the module to "ilt"; load ilt's config file
        this.setConfigFile("ilt", "/WEB-INF/ilt/struts-config-ilt.xml");
        setRequestPathInfo("ilt", "/Welcome"); // login
        actionPerform();
    }

Tim Lucia

> -----Original Message-----
> From: Ovidiu EFTIMIE [mailto:oeftimie.teamlog@assemblee-nat.fr] 
> Sent: Thursday, December 18, 2003 12:05 PM
> To: Struts Users Mailing List
> Subject: Struts test cases
> 
> 
> Hi,
> Has anyone used WSAD 5.0 with StrutsTestCase 2.0 ?
> I've only succeded to make it work after several operation 
> which don't inspire me much confidence, or maybe is just me  
> taking  the hard way. Is there anyone there who used this and 
> can give me some hints?
> 
> Thanx,
> Ovidiu
> 
> PS: For anyone interested here are the steps I took to make 
> it work the way it does
> 
> [1]. in setUp() add
> setContextDirectory(new File("D:\\workspace\\strutsJunit\\jsp"));
> setConfigFile("/WEB-INF/struts-config.xml");
> [2.]Replace the  servletunit.ServletContextSimulator 
> getRessource() method content with try {
>    return this.getClass().getResource(path);
>  } catch (Exception e) {
>       return null;
>  }
> [3.]execute ant to build a new strutstest-2.0.0.jar (the new 
> one has 42K) [4.]replace in the /WEB-INF/lib/ 
> strutstest-2.0.0.jar (38K) with the new one [5.]In your 
> /WEB-INF/classes/ create a directory called /WEB-INF/ and 
> copy struts-config.xml and web.xml there Run your tests
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org