JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-4791

EventGroupTestCase.testCompareTo() fails intermittently

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 2.2.5 (EE only)
  • Fix Version/s: 2.2.6 (EE only)
  • Component/s: Build: Integration Tests, Core: Routing / Filters
  • Labels:
    None
  • User impact:
    Low
  • Similar Issues:
    None

Description

The test EventGroupTestCase.testCompareTo() fails intermittently because it depends on the fact that some time passes between the creation of one object and the next.

This is the affected code:

// when the groupId is not Comparable, the creation time is used as fallback
        g1 = new EventGroup(new Object());
        g2 = new EventGroup(new Object());
        // g1 is older (smaller) than g2
        assertTrue(g1.compareTo(g2) < 0);
        assertTrue(g2.compareTo(g1) > 0);

In order for the assertions to pass, there must be at least one nanosecond between the creation of g1 and g2. Sometimes this is not the case so the test fails. I suggest inserting a Thread.yield() call in the middle of the two cretions, like this:

// when the groupId is not Comparable, the creation time is used as fallback
        g1 = new EventGroup(new Object());
        Thread.yield(); // this makes sure that there is a time difference between
                        // the two EventGroup creations.
        g2 = new EventGroup(new Object());
        // g1 is older (smaller) than g2
        assertTrue(g1.compareTo(g2) < 0);
        assertTrue(g2.compareTo(g1) > 0);

Issue Links

relates to

Sub-task - The sub-task of the issue MULE-4592 EventGroup does not work with IBM JDK

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds

People

  • Assignee:
    Edu Pereda
    Reporter:
    Edu Pereda
Vote (0)
Watch (0)

Dates

  • Created:
    15/Mar/10 05:14 PM
    Updated:
    16/Mar/10 08:12 AM
    Resolved:
    16/Mar/10 08:12 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.