You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Eric Le Lay (JIRA)" <ji...@apache.org> on 2012/10/09 17:32:02 UTC

[jira] [Created] (WICKET-4810) CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference

Eric Le Lay created WICKET-4810:
-----------------------------------

             Summary: CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference
                 Key: WICKET-4810
                 URL: https://issues.apache.org/jira/browse/WICKET-4810
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.4
            Reporter: Eric Le Lay
            Assignee: Martin Grigorov
            Priority: Minor
             Fix For: 1.5.6, 6.0.0-beta1


When using BaseWicketTester.clickLink() with ResourceLink, it does not work. Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.

	@Test
	public void clickingLink() {
              // doesn't work
		tester.clickLink("download");
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}
	
	@Test
	public void usingListener() {
                // works
		tester.executeListener(tester.getComponentFromLastRenderedPage("download"), IResourceListener.INTERFACE);
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (WICKET-4810) CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4810.
-------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.5.6)
                       (was: 6.0.0-beta1)
                   1.5.9
                   6.2.0

Improved the code for clicking a ResourceLink. Now it uses Link#getURL() to get the real url for both IResource and ResourceReference. #clickLink() test now works fine

The second test (tester.executeListener(Component, IResourceListener.INTERFACE);) still fails because it tries to use ResourceLink with IResource while in your case it actually uses ResourceReference and this is a bug in the application.
                
> CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference
> ---------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4810
>                 URL: https://issues.apache.org/jira/browse/WICKET-4810
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Eric Le Lay
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 6.2.0, 1.5.9
>
>         Attachments: sharedresourcelink.zip
>
>
> When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work.
> Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.
> When the ResourceLink is created with the Resource directly,  BaseWicketTester.clickLink() works.
> 	@Test
> 	public void clickingLink() {
>               // doesn't work
> 		tester.clickLink("shared");
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}
> 	
> 	@Test
> 	public void usingListener() {
>                 // doesn't work either
> 		tester.executeListener(tester.getComponentFromLastRenderedPage("shared"), IResourceListener.INTERFACE);
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-4810) CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference

Posted by "Eric Le Lay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Le Lay updated WICKET-4810:
--------------------------------

    Attachment: sharedresourcelink.zip

the quickstart (2 tests fail)

                
> CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference
> ---------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4810
>                 URL: https://issues.apache.org/jira/browse/WICKET-4810
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Eric Le Lay
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 1.5.6, 6.0.0-beta1
>
>         Attachments: sharedresourcelink.zip
>
>
> When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work.
> Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.
> When the ResourceLink is created with the Resource directly,  BaseWicketTester.clickLink() works.
> 	@Test
> 	public void clickingLink() {
>               // doesn't work
> 		tester.clickLink("shared");
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}
> 	
> 	@Test
> 	public void usingListener() {
>                 // doesn't work either
> 		tester.executeListener(tester.getComponentFromLastRenderedPage("shared"), IResourceListener.INTERFACE);
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WICKET-4810) CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference

Posted by "Eric Le Lay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13473036#comment-13473036 ] 

Eric Le Lay commented on WICKET-4810:
-------------------------------------

OK, it is fine like this.
Using executeListener() in the 2nd test was only to show that the work-around provided in WICKET-4437 was not working in this case.

Thank you very much !

For somebody not wanting to wait for 6.2.0, it can be done outside BaseWicketTester :
                WicketTester tester;
		ResourceLink<?> lnk = (ResourceLink<?>)tester.getComponentFromLastRenderedPage("myresourcelink");
		try
		{
			Method getUrlMethod = ResourceLink.class.getDeclaredMethod(
				"getURL", (Class<?>[])null);
			getUrlMethod.setAccessible(true);

			String url = (String)getUrlMethod.invoke(
					lnk, (Object[])null);
			tester.executeUrl(url.toString());
		}
		catch (Exception e)
		{
			fail("this shouldn't fail!!");
		}

                
> CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference
> ---------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4810
>                 URL: https://issues.apache.org/jira/browse/WICKET-4810
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Eric Le Lay
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 6.2.0, 1.5.9
>
>         Attachments: sharedresourcelink.zip
>
>
> When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work.
> Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.
> When the ResourceLink is created with the Resource directly,  BaseWicketTester.clickLink() works.
> 	@Test
> 	public void clickingLink() {
>               // doesn't work
> 		tester.clickLink("shared");
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}
> 	
> 	@Test
> 	public void usingListener() {
>                 // doesn't work either
> 		tester.executeListener(tester.getComponentFromLastRenderedPage("shared"), IResourceListener.INTERFACE);
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-4810) CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference

Posted by "Eric Le Lay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Le Lay updated WICKET-4810:
--------------------------------

    Description: 
When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work. Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.

	@Test
	public void clickingLink() {
              // doesn't work
		tester.clickLink("download");
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}
	
	@Test
	public void usingListener() {
                // works
		tester.executeListener(tester.getComponentFromLastRenderedPage("download"), IResourceListener.INTERFACE);
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}

  was:
When using BaseWicketTester.clickLink() with ResourceLink, it does not work. Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.

	@Test
	public void clickingLink() {
              // doesn't work
		tester.clickLink("download");
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}
	
	@Test
	public void usingListener() {
                // works
		tester.executeListener(tester.getComponentFromLastRenderedPage("download"), IResourceListener.INTERFACE);
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}

    
> CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference
> ---------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4810
>                 URL: https://issues.apache.org/jira/browse/WICKET-4810
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Eric Le Lay
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 1.5.6, 6.0.0-beta1
>
>
> When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work. Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.
> 	@Test
> 	public void clickingLink() {
>               // doesn't work
> 		tester.clickLink("download");
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}
> 	
> 	@Test
> 	public void usingListener() {
>                 // works
> 		tester.executeListener(tester.getComponentFromLastRenderedPage("download"), IResourceListener.INTERFACE);
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (WICKET-4810) CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference

Posted by "Eric Le Lay (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4810?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Le Lay updated WICKET-4810:
--------------------------------

    Description: 
When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work.
Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.

When the ResourceLink is created with the Resource directly,  BaseWicketTester.clickLink() works.


	@Test
	public void clickingLink() {
              // doesn't work
		tester.clickLink("shared");
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}
	
	@Test
	public void usingListener() {
                // doesn't work either
		tester.executeListener(tester.getComponentFromLastRenderedPage("shared"), IResourceListener.INTERFACE);
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}

  was:
When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work. Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.

	@Test
	public void clickingLink() {
              // doesn't work
		tester.clickLink("download");
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}
	
	@Test
	public void usingListener() {
                // works
		tester.executeListener(tester.getComponentFromLastRenderedPage("download"), IResourceListener.INTERFACE);
		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
	}

    
> CLONE - BaseWicketTester.clickLink() does not work with a ResourceLink with ResourceReference
> ---------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4810
>                 URL: https://issues.apache.org/jira/browse/WICKET-4810
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.4
>            Reporter: Eric Le Lay
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 1.5.6, 6.0.0-beta1
>
>
> When using BaseWicketTester.clickLink() with a ResourceLink with a ResourceReference, it does not work.
> Clicking link in server (Jetty) it works and opens the resource. See attached quickstart.
> When the ResourceLink is created with the Resource directly,  BaseWicketTester.clickLink() works.
> 	@Test
> 	public void clickingLink() {
>               // doesn't work
> 		tester.clickLink("shared");
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}
> 	
> 	@Test
> 	public void usingListener() {
>                 // doesn't work either
> 		tester.executeListener(tester.getComponentFromLastRenderedPage("shared"), IResourceListener.INTERFACE);
> 		Assert.assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
> 	}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira