Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

Thank you very much, but they also seem not to find the solution.

Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>>
>> How can I initialize tiles in this context?
> 
> In some ways, you have to manage to put StrutsTilesListener, or at
> least its code, but I don't really know how to do it.
> I suggest to ask the BaseStrutsTestCase developers.
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18134225.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

How can I initialize tiles in this context? 

Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>> If you look at the link, you can understand the problem. Whose
>> initialization is the one that you can't understand?
> 
> I see, but I am sorry, without initialization Tiles won't work.
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18133946.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

This is the action class:
public class HelloWorldTest extends BaseStrutsTestCase {

HelloWorld  hello;
Map testSession;
@Before
public void setUp() throws Exception {
super.setUp();
   hello = createAction( HelloWorld.class, "/","HelloWorld" );
testSession = new HashMap();
testSession.put("username", "admin");
testSession.put("password", "sifre");

proxy.getInvocation().getInvocationContext().setParameters(testSession);

}

@Test
public void testHelloWorldAction() throws Exception {


assertTrue("SUCCESS".equals(proxy.execute())); 

}

If you look at the link, you can understand the problem. Whose
initialization is the one that you can't understand?

Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>>
>> In my action, I have a reference to Http request and it requires to
>> access
>> the HttpServletRequest object, so I can not easily test the action with
>> just
>> calling the execute method and comparing the result. So, I have found out
>> a
>> solution from the link that I refere before, I did not write the
>> BaseStrutsTestCase, I modified the class. It creates mock objects and
>> helps
>> to test my action outside of the server environment. It takes the
>> advantage
>> of the  ActionProxy. All I did was to simulate some user input, and
>> remaining part is handled by this helper class.
> 
> And the initialization? I still cannot understand.
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18133751.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

In my action, I have a reference to Http request and it requires to access
the HttpServletRequest object, so I can not easily test the action with just
calling the execute method and comparing the result. So, I have found out a
solution from the link that I refere before, I did not write the
BaseStrutsTestCase, I modified the class. It creates mock objects and helps
to test my action outside of the server environment. It takes the advantage
of the  ActionProxy. All I did was to simulate some user input, and
remaining part is handled by this helper class.


Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>> If I add the location of web.xml or any other thing to here
>> private static final String CONFIG_LOCATIONS = "file:src/struts.xml" ;
>> I got a parsing error. I am not very experienced with tiles, I just test
>> the
>> code in a big project. The problem is , if I do not include tiles, my
>> unit
>> test works perfectly. If you did not look at the BaseStrutsTEstCase
>> class,
>> it is a helper class to create an artificial environment for requests and
>> interceptors. May be my problem is related to the jUnit part, but why I
>> can't test with tiles?
> 
> Just one question: how are you configuring the "artificial environment"?
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18133546.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

If I add the location of web.xml or any other thing to here  
private static final String CONFIG_LOCATIONS = "file:src/struts.xml" ;
I got a parsing error. I am not very experienced with tiles, I just test the
code in a big project. The problem is , if I do not include tiles, my unit
test works perfectly. If you did not look at the BaseStrutsTEstCase class,
it is a helper class to create an artificial environment for requests and
interceptors. May be my problem is related to the jUnit part, but why I
can't test with tiles?


Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>> I have just replaced the code with the new one, isn't it the one you
>> suggested?
> 
> Yes, but you had to adapt it to your needs.
> By the way, do you still receive a parsing error, at startup?
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18133212.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

I have loaded the Tiles listener and run the jUnit test and it gave the same
NullPointer Exception. Moreover, the trace is same as before.
Then, I tried to load tiles servlet, and it gave the same error. Lastly, I
loaded the tiles filter and it gave ther same NPE. 
I have already tried three of them so I can't figure out what the problem
is. Did I load them wrongly?

I have just replaced the code with the new one, isn't it the one you
suggested? 

Modified web.xml:


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
TVQ



struts2

org.apache.struts2.dispatcher.FilterDispatcher




struts2
/*




org.springframework.web.context.ContextLoaderListener






org.apache.tiles.web.startup.TilesListener






org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG



/WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml




index.html
index.htm
index.jsp
default.html
default.htm
default.jsp




Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>> I tried three of them seperatley, but it did not work.
> 
> Please clarify, what do you mean with "it did not work"? Do you
> receive an exception at startup?
> 
>> Should I modify the configuration variable in the BaseStrutsTestCase? I
>> did not add there
>> web.xml and tiles-defs.xml.
> 
> Sincerely I am not into BaseStrutsTestCase, so I cannot help in this case
> 
>>
>>   
>> /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
>>
> 
> Have you got a "classpath-defs.xml" anywhere in your code? If not, remove
> it.
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18132968.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

I tried three of them seperatley, but it did not work. Should I modify the
configuration variable in the BaseStrutsTestCase? I did not add there
web.xml and tiles-defs.xml.
As you suggested, I add this code into web.xml.



org.apache.tiles.web.startup.TilesListener






org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG



/WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml




Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>>
>> This is the tiles.defs.xml :
>>
>>
>>org.apache.struts2.tiles.StrutsTilesListener
>>
>>
>>
>>
>>tiles
>>
>>org.apache.tiles.web.startup.TilesServlet
>>
>>
>>
>>   
>> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
>>
>>
>>/WEB-INF/tiles-defs.xml
>>
>>
>>2
>>
>>
>>
>>
>>Tiles_Filter
>>
>>org.apache.tiles.web.startup.TilesFilter
>>
>>
>>
>>   
>> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
>>
>>
>>/WEB-INF/tiles-defs.xml
>>
>>
>>
>>
>>
>>Tiles_Filter
>>/*
>>REQUEST
>>
> 
> The problem is that you are using StrutsTilesListener (that loads
> /WEB-INF/tiles.xml by default), TilesServlet and TilesFilter at the
> same time.
> Choose one and configure it. I suggest to use StrutsTilesListener
> only. Configuring it means putting a context parameter. See:
> http://tiles.apache.org/tutorial/configuration.html
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18132646.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi

This is the tiles.defs.xml :



http://tiles.apache.org/dtds/tiles-config_2_0.dtd";>

























and this is the web.xml :


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
TVQ


struts2

org.apache.struts2.dispatcher.FilterDispatcher




struts2
/*




org.springframework.web.context.ContextLoaderListener








org.apache.struts2.tiles.StrutsTilesListener




tiles

org.apache.tiles.web.startup.TilesServlet




org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG


/WEB-INF/tiles-defs.xml


2




Tiles_Filter

org.apache.tiles.web.startup.TilesFilter




org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG


/WEB-INF/tiles-defs.xml





Tiles_Filter
/*
REQUEST




index.html
index.htm
index.jsp
default.html
default.htm
default.jsp




Antonio Petrelli-3 wrote:
> 
> 2008/6/26 ezgi <[EMAIL PROTECTED]>:
>> If you look at the tutorial I refer, you can understand that I am not the
>> only one who have this problem. I try to set the configuration file to
>> tiles.defs.xml  as suggested, but it gave an XML parse exception.
> 
> Can we see the Tiles definition files that you are using?
> 
> Antonio
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18132170.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



jUnit Testing Problem with Tiles

2008-06-26 Thread ezgi
terceptor.java:164)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:130)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:230)
at
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:229)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:456)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:227)
at
com.opensymphony.xwork2.DefaultActionProxy.execute(DefaultActionProxy.java:130)
at pack.HelloWorldTest.testHelloWorldAction(HelloWorldTest.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

If you look at the tutorial I refer, you can understand that I am not the
only one who have this problem. I try to set the configuration file to
tiles.defs.xml  as suggested, but it gave an XML parse exception. What can
be the solution;?

Thanks
jUnit newbie Ezgi :)

-- 
View this message in context: 
http://www.nabble.com/jUnit-Testing-Problem-with-Tiles-tp18131822p18131822.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]