< prev index next >

src/com/sun/javatest/report/KflSorter.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 115         int totalFound = 0;
 116 
 117         for (; iter.hasNext();) {
 118             TestResult tr = iter.next();
 119             Status s = tr.getStatus();
 120             TreeSet<TestResult> list = lists[s == null ? Status.NOT_RUN : s.getType()];
 121             list.add(tr);
 122             totalFound++;
 123         }
 124 
 125         return run(lists);
 126     }
 127 
 128     /**
 129      * Run the comparison of KFL vs set of results.
 130      * May take a long time to execute, performing the operation on a background
 131      * thread may be appropriate.
 132      * @param tests
 133      * @return Number of comparison problems encountered.
 134      */
 135     synchronized int run(TreeSet[] tests) {
 136         Iterator<KnownFailuresList.Entry> it = kfl.getIterator(false);
 137         int probs = 0;
 138         int tcprobs = 0;
 139 
 140         // iterator KFL entries
 141         for (;it.hasNext();) {
 142             KnownFailuresList.Entry entry = it.next();
 143             String url = entry.getRelativeURL();
 144             TestResult tr = trt.lookup(TestResult.getWorkRelativePath(url));
 145 
 146             if (tr == null) {
 147                 if (!processMissing)
 148                     continue;
 149 
 150                 if (missing.add(new TestDiff(url, null, Transitions.FAIL2MISSING)))
 151                     probs++;
 152 
 153                 if (enableTestCases) {
 154                     // add all test cases from this entry
 155                     tcprobs += addAllTestCases(entry, url, null, Transitions.TC_FAIL2MISSING,


 405             final String url, final TestResult tr,
 406             Transitions t, Set<TestDiff> set) {
 407         // could check enableTestCases flag before processing
 408         // add all test cases from this entry
 409         int problems = 0;
 410 
 411         String[] tcs = entry.getTestCaseList();
 412         if (tcs == null || tcs.length == 0)
 413             return 0;
 414 
 415         for (String s: tcs) {
 416             if (set.add(new TestDiff(url, s, tr, t)))
 417                 problems++;
 418         }
 419 
 420         return problems;
 421     }
 422 
 423     private int addListedTestCases(final KnownFailuresList.Entry entry,
 424             final String url, final TestResult tr,
 425             Transitions t, TreeSet set) {
 426         int problems = 0;
 427 
 428         String[] tcs = entry.getTestCaseList();
 429         if (tcs == null || tcs.length == 0)
 430             return 0;
 431 
 432         for (String s: tcs) {
 433 
 434         }
 435 
 436         return problems;
 437     }
 438 
 439     /**
 440      * Add all test cases for a test which match the given status to the tree set.
 441      * @param entry The corresponding KFL entry.
 442      * @param
 443      * @param set the data set to add the selected test cases to
 444      * @return the number of test cases which matched the status
 445      */


 602                             result.put(tcName, stat);
 603                         }
 604                     }
 605                     s = reader.readLine();
 606                 }
 607             } catch (IOException e) {
 608                 // TODO Auto-generated catch block
 609             } catch (TestResult.ReloadFault e) {
 610                 // TODO Auto-generated catch block
 611             }
 612         }
 613 
 614         return (result.isEmpty() ? null : result);
 615     }
 616 
 617     /**
 618      * Created for each result which somehow does not match what was expected
 619      * based on the KFL. Using this class allows the analysis to be done once
 620      * then queried again and again for different purposes.
 621      */
 622     public static class TestDiff implements Comparable {
 623         public TestDiff(String url, TestResult tr, Transitions type) {
 624             this.tr = tr;
 625             this.url = url;
 626         }
 627 
 628         public TestDiff(String url, String tc, TestResult tr, Transitions type) {
 629             this(url, tr, type);
 630             this.tc = tc;
 631             // resultMismatch =
 632             // caseMismatch =
 633         }
 634 
 635         public TestResult getTestResult() {
 636             return tr;
 637         }
 638 
 639         /**
 640          * Is the mismatch concerning the test's main result?
 641          * @return True if the result status is not the same as the result expected
 642          *    based on the KFL.  False if the main result matches.


 683 
 684         /**
 685          * Not normally used, but can be used as a secondary way to get
 686          * the associated KFL entry.  Typically this value will be null.
 687          * @return A KFL entry which caused this diff.
 688          */
 689         public KnownFailuresList.Entry getKflEntry() {
 690             return kflEntry;
 691         }
 692 
 693         /**
 694          * Not normally used, but can be used as a backup if there is a
 695          * special case where looking up the entry later would fail.
 696          * @param e The KFL entry to associate with this diff.
 697          */
 698         public void setKflEntry(KnownFailuresList.Entry e) {
 699             kflEntry = e;
 700         }
 701 
 702         @Override
 703         public int compareTo(Object o) {
 704             TestDiff e = (TestDiff) o;
 705             int n = getName().compareTo(e.getName());
 706 /*          if (n == 0) {
 707                 if (testCase == null && e.testCase == null)
 708                     return 0;
 709                 else if (testCase == null)
 710                     return -1;
 711                 else if (e.testCase == null)
 712                     return +1;
 713                 else
 714                     return testCase.compareTo(e.testCase);
 715             }
 716             else
 717                 return n;*/
 718             return n;
 719         }
 720 
 721         private TestResult tr;
 722         private String url;
 723         private String tc;
 724         private boolean resultMismatch = false;




 115         int totalFound = 0;
 116 
 117         for (; iter.hasNext();) {
 118             TestResult tr = iter.next();
 119             Status s = tr.getStatus();
 120             TreeSet<TestResult> list = lists[s == null ? Status.NOT_RUN : s.getType()];
 121             list.add(tr);
 122             totalFound++;
 123         }
 124 
 125         return run(lists);
 126     }
 127 
 128     /**
 129      * Run the comparison of KFL vs set of results.
 130      * May take a long time to execute, performing the operation on a background
 131      * thread may be appropriate.
 132      * @param tests
 133      * @return Number of comparison problems encountered.
 134      */
 135     synchronized int run(TreeSet<?>[] tests) {
 136         Iterator<KnownFailuresList.Entry> it = kfl.getIterator(false);
 137         int probs = 0;
 138         int tcprobs = 0;
 139 
 140         // iterator KFL entries
 141         for (;it.hasNext();) {
 142             KnownFailuresList.Entry entry = it.next();
 143             String url = entry.getRelativeURL();
 144             TestResult tr = trt.lookup(TestResult.getWorkRelativePath(url));
 145 
 146             if (tr == null) {
 147                 if (!processMissing)
 148                     continue;
 149 
 150                 if (missing.add(new TestDiff(url, null, Transitions.FAIL2MISSING)))
 151                     probs++;
 152 
 153                 if (enableTestCases) {
 154                     // add all test cases from this entry
 155                     tcprobs += addAllTestCases(entry, url, null, Transitions.TC_FAIL2MISSING,


 405             final String url, final TestResult tr,
 406             Transitions t, Set<TestDiff> set) {
 407         // could check enableTestCases flag before processing
 408         // add all test cases from this entry
 409         int problems = 0;
 410 
 411         String[] tcs = entry.getTestCaseList();
 412         if (tcs == null || tcs.length == 0)
 413             return 0;
 414 
 415         for (String s: tcs) {
 416             if (set.add(new TestDiff(url, s, tr, t)))
 417                 problems++;
 418         }
 419 
 420         return problems;
 421     }
 422 
 423     private int addListedTestCases(final KnownFailuresList.Entry entry,
 424             final String url, final TestResult tr,
 425             Transitions t, TreeSet<?> set) {
 426         int problems = 0;
 427 
 428         String[] tcs = entry.getTestCaseList();
 429         if (tcs == null || tcs.length == 0)
 430             return 0;
 431 
 432         for (String s: tcs) {
 433 
 434         }
 435 
 436         return problems;
 437     }
 438 
 439     /**
 440      * Add all test cases for a test which match the given status to the tree set.
 441      * @param entry The corresponding KFL entry.
 442      * @param
 443      * @param set the data set to add the selected test cases to
 444      * @return the number of test cases which matched the status
 445      */


 602                             result.put(tcName, stat);
 603                         }
 604                     }
 605                     s = reader.readLine();
 606                 }
 607             } catch (IOException e) {
 608                 // TODO Auto-generated catch block
 609             } catch (TestResult.ReloadFault e) {
 610                 // TODO Auto-generated catch block
 611             }
 612         }
 613 
 614         return (result.isEmpty() ? null : result);
 615     }
 616 
 617     /**
 618      * Created for each result which somehow does not match what was expected
 619      * based on the KFL. Using this class allows the analysis to be done once
 620      * then queried again and again for different purposes.
 621      */
 622     public static class TestDiff implements Comparable<TestDiff> {
 623         public TestDiff(String url, TestResult tr, Transitions type) {
 624             this.tr = tr;
 625             this.url = url;
 626         }
 627 
 628         public TestDiff(String url, String tc, TestResult tr, Transitions type) {
 629             this(url, tr, type);
 630             this.tc = tc;
 631             // resultMismatch =
 632             // caseMismatch =
 633         }
 634 
 635         public TestResult getTestResult() {
 636             return tr;
 637         }
 638 
 639         /**
 640          * Is the mismatch concerning the test's main result?
 641          * @return True if the result status is not the same as the result expected
 642          *    based on the KFL.  False if the main result matches.


 683 
 684         /**
 685          * Not normally used, but can be used as a secondary way to get
 686          * the associated KFL entry.  Typically this value will be null.
 687          * @return A KFL entry which caused this diff.
 688          */
 689         public KnownFailuresList.Entry getKflEntry() {
 690             return kflEntry;
 691         }
 692 
 693         /**
 694          * Not normally used, but can be used as a backup if there is a
 695          * special case where looking up the entry later would fail.
 696          * @param e The KFL entry to associate with this diff.
 697          */
 698         public void setKflEntry(KnownFailuresList.Entry e) {
 699             kflEntry = e;
 700         }
 701 
 702         @Override
 703         public int compareTo(TestDiff e) {

 704             int n = getName().compareTo(e.getName());
 705 /*          if (n == 0) {
 706                 if (testCase == null && e.testCase == null)
 707                     return 0;
 708                 else if (testCase == null)
 709                     return -1;
 710                 else if (e.testCase == null)
 711                     return +1;
 712                 else
 713                     return testCase.compareTo(e.testCase);
 714             }
 715             else
 716                 return n;*/
 717             return n;
 718         }
 719 
 720         private TestResult tr;
 721         private String url;
 722         private String tc;
 723         private boolean resultMismatch = false;


< prev index next >