You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Thorsten Schöning (JIRA)" <ji...@apache.org> on 2016/04/11 15:29:25 UTC

[jira] [Comment Edited] (WICKET-6133) Failing test SpringBeanWithGenericsTest in 7.3.0.0 SNAPSHOT

    [ https://issues.apache.org/jira/browse/WICKET-6133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235083#comment-15235083 ] 

Thorsten Schöning edited comment on WICKET-6133 at 4/11/16 1:28 PM:
--------------------------------------------------------------------

Yes, it happens on Windows and it still happens. I just updated my 7.3.0.0 branch some minutes ago with the same results like before:

{CODE}
Tests run: 7, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.512 sec <<< FAILURE! - in org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTestlistField(org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest)
Time elapsed: 0.061 sec  <<< FAILURE!
java.lang.AssertionError: expected:<3> but was:<1>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:834)
        at org.junit.Assert.assertEquals(Assert.java:645)
        at org.junit.Assert.assertEquals(Assert.java:631)
        at org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest.listField(SpringBeanWithGenericsTest.java:143)
{CODE}

My suggestion is as follows: First check if ConfigContextWithGenerics.getStrings is logically correct or not compared to the other methods and their naming scheme in this class and compared to the caller and what methods are actually called in SpringBeanWithGenericsTest, especially around line 142 "page.getStringsList" etc. Don't mind that it works on Linux, ask yourself if the naming scheme is correct or if my mentioned commit simply forgot to rename ConfigContextWithGenerics.getStrings.

It's surely the latter, so the fact that it works anyway in your case can only mean that some "magic" behind the scenes is working "by accident" correctly on Linux, but doesn't on Windows at least most of the times in my JDK 1.7.0_80.

I guess that there's some API around reflection/annotations used in your Spring glue or in Spring with non-deterministic iteration of fields and that whenever I see the error, ConfigContextWithGenerics.myList was found instead of ConfigContextWithGenerics.getStrings. Simply because that's the only field in the whole class with only exactly one element and the error message speaks of exactly one element. The return types of both methods are compatible, so this could be possible.


was (Author: tschoening):
Yes, it happens on Windows and it still happens. I just updated my 7.3.0.0 branch some minutes ago with the same results like before:

{CODE}
Tests run: 7, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.512 sec <<< FAILURE! - in org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTestlistField(org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest)
Time elapsed: 0.061 sec  <<< FAILURE!
java.lang.AssertionError: expected:<3> but was:<1>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:834)
        at org.junit.Assert.assertEquals(Assert.java:645)
        at org.junit.Assert.assertEquals(Assert.java:631)
        at org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest.listField(SpringBeanWithGenericsTest.java:143)
{CODE}

My suggestion is as follows: First check if ConfigContextWithGenerics.getStrings is logically correct or not compared to the other methods and their naming scheme in this class and compared to the caller and what methods are actually called in SpringBeanWithGenericsTest, especially around line 142 "page.getStringsList" etc. Don't mind that it works on Linux, ask yourself if the naming scheme is correct or if my mentioned commit simply forgot to rename ConfigContextWithGenerics.getStrings.

It's surely the latter, so the fact that it works anyway in your case can only mean that some "magic" behind the scenes is working by accident correctly on Linux, but doesn't on Windows at least in my JDK 1.7.0_80. I guess that there's some API around reflection/annotations used in your Spring glue or in Spring with non-deterministic iteration of fields and that whenever I see the error ConfigContextWithGenerics.myList was found instead of ConfigContextWithGenerics.getStrings. Simply because that's the only field in the whole class with just exactly one element and the error message speaks of exactly one element. The return types of both methods are compatible, so this could be possible.

> Failing test SpringBeanWithGenericsTest in 7.3.0.0 SNAPSHOT
> -----------------------------------------------------------
>
>                 Key: WICKET-6133
>                 URL: https://issues.apache.org/jira/browse/WICKET-6133
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 7.3.0
>         Environment: Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
> Maven home: C:\Program Files\Apache Software Foundation\Maven\bin\..
> Java version: 1.7.0_80, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_80\jre
> Default locale: de_DE, platform encoding: Cp1252
> OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows"
>            Reporter: Thorsten Schöning
>            Assignee: Andrea Del Bene
>         Attachments: SpringBeanWithGenericsTest.java.patch
>
>
> I try to build 7.3.0.0-SNAPSHOT from source, but there's at least the
> following failing test. Skipping the tests builds OK and the results
> seem to work.
> {CODE}
> [...]
> Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.398 sec - in org.apache.wicket.spring.injection.annot.SpringBeanTest
> Running org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest
> Tests run: 7, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.557 sec <<< FAILURE! - in org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTestlistField(org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest)
> Time elapsed: 0.072 sec  <<< FAILURE!
> java.lang.AssertionError: expected:<3> but was:<1>
>         at org.junit.Assert.fail(Assert.java:88)
>         at org.junit.Assert.failNotEquals(Assert.java:834)
>         at org.junit.Assert.assertEquals(Assert.java:645)
>         at org.junit.Assert.assertEquals(Assert.java:631)
>         at org.apache.wicket.spring.injection.annot.SpringBeanWithGenericsTest.listField(SpringBeanWithGenericsTest.java:143)
> [...]
> {CODE}
> The mentioned line is the last one of the following quote:
> {CODE}
>         @Test
>         public void listField() throws Exception
>         {
>                 AnnotatedListField page =
>                         tester.startPage(new AnnotatedListField());
>                 assertNotNull(page.getStringsList());
>                 assertEquals(3, page.getStringsList().size());
> {CODE}
> I've tested different versions of Maven, with and without a .m2 folder and even with changes to the source code of the test and my feeling is that the error I see is somewhat non deterministic. Without an available .m2 folder the test seems to PASS very often, but only during the first execution, directly afterwards with the same commands the test FAILs most of the time. I executed the test the whole morning today and it failed always, only to succeed some minutes ago before writing this report between lots of failing executions.
> I think the problem is with creating the test data properly and found the following commit, which introduced "getStringsList":
> https://github.com/apache/wicket/commit/f0340a3ef62a18df14badb26acee01bf102b9a2c
> The interesting part for me about that commit is that
> "ConfigContextWithGenerics.getStrings" in the same file was NOT
> changed as well. So I renamed to .stringsList and that did have an
> effect, now another test is failing instead:
> {CODE}
> Failed tests:
>   SpringBeanWithGenericsTest.listField:147->Assert.assertThat:923->Assert.assert
> That:956
> Expected: is <3>
>      but: was <1>
> {CODE}
> Looking at the other methods of ConfigContextWithGenerics, I'm pretty sure that "strings" is wrongly named, because all other methods are named after annotated fields. So I guess there's some magic in the background able to ignore the names and map using method signatur or such. And that might fail in most of my executions.
> Having a closer look at the error message, it says that 1 element is found where 3 were expected. The only 1 element list in the class is "myList", so I guess that is used most of times in my executions for whatever reason.
> I had a closer look at SpringComponentInjector and AnnotProxyFieldValueFactory, which e.g. contains getBeanNameOfClass, which resolves beans without any name.
> So in my opinion there's definitely something wrong with this test, at least ConfigContextWithGenerics.getStrings is wrongly named, but changing only that doesn't resolve the issue for me. There are still invocations failing with the 3 expected, 1 recognized error.
> This was discussed on the users list as well:
> http://mail-archives.apache.org/mod_mbox/wicket-users/201603.mbox/<1557500025.20160330120517%40am-soft.de>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)