struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Grobmeier <grobme...@gmail.com>
Subject Re: Support for Convention-Plugin through the Junit-Plugin
Date Mon, 18 Mar 2013 15:22:28 GMT
I debugged a good while and figured out how it can be done, basically.

The trick is, you give it a special config:

@Override
    protected String getConfigPath() {
        return "struts-convention.xml";
    }

This config above contains more or less everything which is also
contained in struts-plugin.xml of the convention plugin. Unfortunately
I didn't find a way to include the original file or how to use
"convention-default". It seems it isn't loaded and I need to push it
manually, which i did.

I could create an ViewAction which is then forwarded to
view-success.jsp, as desired.

One problem I face is now that it seems as view-success.jsp is not
rendered. When I read the output of this file its always "". I have no
idea why it's like that at the moment.
I looked into StrutsJUnit4TestCase (line 248) and it seems
struts-default.xml is always loaded. So I would expect there are all
components there to render it. I already tried ftl, which is used
often by teh other testcases, no success.

That said, besides the return value of executeAction is not useful,
this already works:

public class StrutsJUnit4ConventionTestCaseTest extends
StrutsJUnit4TestCase<ViewAction> {
...
ViewAction action = this.getAction();
// assert action members

Cheers
Christian






On Mon, Mar 18, 2013 at 2:25 PM, Christian Grobmeier
<grobmeier@gmail.com> wrote:
> Interesting. Thanks Martin and Lukasz, maybe i have more luck with
> these hints. I will let you know :-)
>
> Christian
>
> 2013/3/17 Martin Gainty <mgainty@hotmail.com>:
>> Christian
>>
>> check out MockStrutsTestCase
>> http://strutstestcase.sourceforge.net/api/servletunit/struts/MockStrutsTestCase.html#setConfigFile(java.lang.String)
>> Martin ______________________________________________
>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein,
so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer
Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und
entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails
koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.
>>
>>  > From: lukaszlenart@apache.org
>>> Date: Sun, 17 Mar 2013 20:21:39 +0100
>>> Subject: Re: Support for Convention-Plugin through the Junit-Plugin
>>> To: dev@struts.apache.org
>>>
>>> 2013/3/17 Christian Grobmeier <grobmeier@gmail.com>:
>>> > hm, ok. I have seen the plugin should automatically bring in these two
>>> > providers.
>>> > But when I call configurationManager.getContainerProviders() they are
>>> > not in. My guess is this is the problem. I will look a bit further
>>> > into it, more pointers are welcome :-)
>>>
>>> The StrutsJunitTestCase doesn't load struts-default.xml or any other
>>> .xml configuration file.
>>>
>>>
>>> Regards
>>> --
>>> Łukasz
>>> + 48 606 323 122 http://www.lenart.org.pl/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: dev-help@struts.apache.org
>>>
>>
>
>
>
> --
> http://www.grobmeier.de
> https://www.timeandbill.de



--
http://www.grobmeier.de
https://www.timeandbill.de

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


Mime
View raw message