You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Rudy De Busscher (JIRA)" <ji...@apache.org> on 2012/06/16 20:57:42 UTC
[jira] [Created] (DELTASPIKE-204)
AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
Rudy De Busscher created DELTASPIKE-204:
-------------------------------------------
Summary: AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
Key: DELTASPIKE-204
URL: https://issues.apache.org/jira/browse/DELTASPIKE-204
Project: DeltaSpike
Issue Type: Improvement
Components: Core
Affects Versions: 0.2-incubating
Environment: Oracle JRockit JVM
Reporter: Rudy De Busscher
Assignee: Rudy De Busscher
Priority: Minor
The current test code relies on the hash implementation (indirect) to return the keys of a hashMap in a certain order. On other JVM implementations (like Oracle JRockit) the hash implementation is different and thus the test fails.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DELTASPIKE-204)
AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
Posted by "Rudy De Busscher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DELTASPIKE-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393364#comment-13393364 ]
Rudy De Busscher commented on DELTASPIKE-204:
---------------------------------------------
I propose to change the test method to the following code:
There is no ordering problem anymore and checks if all the keys of the 'member' values are present in the result String.
@Test
public void assertComplexToString()
{
Map<String, Object> memberValues = new HashMap<String, Object>();
memberValues.put("booleanValue", false);
memberValues.put("booleanValues", new boolean[]{false});
memberValues.put("byteValue", (byte) 0);
memberValues.put("byteValues", new byte[]{(byte) 0});
memberValues.put("charValue", (char) 0);
memberValues.put("charValues", new char[]{(char) 0});
memberValues.put("doubleValue", 0.0);
memberValues.put("doubleValues", new double[]{0.0});
memberValues.put("floatValue", (float) 0);
memberValues.put("floatValues", new float[]{(float) 0});
memberValues.put("intValue", 0);
memberValues.put("intValues", new int[] { 0 } );
memberValues.put("longValue", 0L);
memberValues.put("longValues", new long[] { 0L } ) ;
memberValues.put("shortValue", (short) 0);
memberValues.put("shortValues", new short[] { (short) 0 } );
memberValues.put("stooge", Stooge.SHEMP);
memberValues.put("stooges", new Stooge[] { Stooge.MOE, Stooge.LARRY, Stooge.CURLY } );
memberValues.put("string", "");
memberValues.put("strings", new String[] { "" } );
memberValues.put("type", Object.class);
memberValues.put("types", new Class[]{Object.class});
Map<String, Object> nestMemberValues = new HashMap<String, Object>(memberValues);
memberValues.put("nest", AnnotationInstanceProvider.of(NestAnnotation.class, nestMemberValues));
memberValues.put("nests", new NestAnnotation[] { AnnotationInstanceProvider.of(NestAnnotation.class,
nestMemberValues) } );
TestAnnotation testAnnotation = AnnotationInstanceProvider.of(TestAnnotation.class, memberValues);
String testAnnotationToString = testAnnotation.toString();
assertTrue(testAnnotationToString.startsWith("@org.apache.deltaspike.test.api.util.metadata.TestAnnotation("));
//assertTrue(testAnnotationToString.contains("type=class java.lang.Object,booleanValue=false,byteValue=0"));
// Order depends on the JVM (Sun, Oracle JRockit, ...)
for (String key : memberValues.keySet()) {
assertTrue(testAnnotationToString.contains(key+"="));
}
assertTrue(testAnnotationToString.contains("type=class java.lang.Object"));
assertTrue(testAnnotationToString.contains("booleanValue=false"));
assertTrue(testAnnotationToString.contains("byteValue=0"));
// End changed test
assertTrue(testAnnotationToString.contains("nest=@org.apache.deltaspike.test.api.util.metadata.NestAnnotation"));
assertTrue(testAnnotationToString.endsWith(")"));
}
> AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
> ---------------------------------------------------------------------------
>
> Key: DELTASPIKE-204
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-204
> Project: DeltaSpike
> Issue Type: Improvement
> Components: Core
> Affects Versions: 0.2-incubating
> Environment: Oracle JRockit JVM
> Reporter: Rudy De Busscher
> Assignee: Rudy De Busscher
> Priority: Minor
> Labels: test
>
> The current test code relies on the hash implementation (indirect) to return the keys of a hashMap in a certain order. On other JVM implementations (like Oracle JRockit) the hash implementation is different and thus the test fails.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (DELTASPIKE-204)
AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
Posted by "Rudy De Busscher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DELTASPIKE-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rudy De Busscher resolved DELTASPIKE-204.
-----------------------------------------
Resolution: Fixed
Fix Version/s: 0.3-incubating
> AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
> ---------------------------------------------------------------------------
>
> Key: DELTASPIKE-204
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-204
> Project: DeltaSpike
> Issue Type: Improvement
> Components: Core
> Affects Versions: 0.2-incubating
> Environment: Oracle JRockit JVM
> Reporter: Rudy De Busscher
> Assignee: Rudy De Busscher
> Priority: Minor
> Labels: test
> Fix For: 0.3-incubating
>
>
> The current test code relies on the hash implementation (indirect) to return the keys of a hashMap in a certain order. On other JVM implementations (like Oracle JRockit) the hash implementation is different and thus the test fails.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DELTASPIKE-204)
AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DELTASPIKE-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393518#comment-13393518 ]
Mark Struberg commented on DELTASPIKE-204:
------------------------------------------
+1, go for it :)
> AnnotationInstanceProviderTest#assertComplexToString fails on certain JVM's
> ---------------------------------------------------------------------------
>
> Key: DELTASPIKE-204
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-204
> Project: DeltaSpike
> Issue Type: Improvement
> Components: Core
> Affects Versions: 0.2-incubating
> Environment: Oracle JRockit JVM
> Reporter: Rudy De Busscher
> Assignee: Rudy De Busscher
> Priority: Minor
> Labels: test
>
> The current test code relies on the hash implementation (indirect) to return the keys of a hashMap in a certain order. On other JVM implementations (like Oracle JRockit) the hash implementation is different and thus the test fails.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira