|
Added
Link Here
|
| 1 |
/********************************************************************** |
| 2 |
* Copyright (c) 2006 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* $Id: DefaultVerdictCategoryProvider.java,v 1.1 2006/03/16 00:38:02 bjiang Exp $ |
| 8 |
* |
| 9 |
* Contributors: |
| 10 |
* IBM - Initial API and implementation |
| 11 |
**********************************************************************/ |
| 12 |
package org.eclipse.hyades.test.ui.forms.extensions.provisional; |
| 13 |
|
| 14 |
import java.util.List; |
| 15 |
|
| 16 |
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult; |
| 17 |
import org.eclipse.hyades.models.common.testprofile.TPFVerdictEvent; |
| 18 |
|
| 19 |
/** |
| 20 |
* This class is the verdict category provider for TPTP test types implementing "executionHistoryExtension.verdictProvider" |
| 21 |
* extention point. The purpose of this class is to handle the special rolled up verdict in TPTP test logs. |
| 22 |
* |
| 23 |
* @author bjiang |
| 24 |
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=157300 |
| 25 |
* @since 4.4 |
| 26 |
*/ |
| 27 |
public class TPTPVerdictCategoryProvider extends DefaultVerdictCategoryProvider { |
| 28 |
|
| 29 |
/* |
| 30 |
* (non-Javadoc) |
| 31 |
* @see org.eclipse.hyades.test.ui.forms.extensions.provisional.DefaultVerdictCategoryProvider#getVerdictCategories(org.eclipse.hyades.models.common.testprofile.TPFExecutionResult) |
| 32 |
*/ |
| 33 |
public VerdictCategory[] getVerdictCategories(TPFExecutionResult executionResult) { |
| 34 |
|
| 35 |
List execEvents = executionResult.getExecutionHistory().getExecutionEvents(); |
| 36 |
TPFVerdictEvent verdict = null; |
| 37 |
if(execEvents != null) |
| 38 |
{ |
| 39 |
for(int i = (execEvents.size() - 1); i >=0; i--) |
| 40 |
{ |
| 41 |
if(execEvents.get(i) instanceof TPFVerdictEvent) |
| 42 |
// This is the rolled up verdict to be filtered out. |
| 43 |
verdict = (TPFVerdictEvent)execEvents.get(i); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
VerdictCategory[] vc = super.getVerdictCategories(executionResult); |
| 48 |
if(vc != null && verdict != null) |
| 49 |
{ |
| 50 |
for(int i = 0; i < vc.length; i++) |
| 51 |
{ |
| 52 |
if(vc[i].getText().equals(verdict.getVerdict().getLabel())) |
| 53 |
{ |
| 54 |
TPFVerdictEvent[] verdicts = vc[i].getVerdicts(); |
| 55 |
for(int v = (verdicts.length - 1); v >=0; v--) |
| 56 |
{ |
| 57 |
if(verdicts[v] == verdict) |
| 58 |
{ |
| 59 |
// verdicts[v] is the one to be filtered out from the list. |
| 60 |
TPFVerdictEvent[] filteredVerdicts = new TPFVerdictEvent[verdicts.length - 1]; |
| 61 |
if(v > 0) |
| 62 |
System.arraycopy(verdicts, 0, filteredVerdicts, 0, v); |
| 63 |
if(v < filteredVerdicts.length) |
| 64 |
System.arraycopy(verdicts, (v+1), filteredVerdicts, v, (filteredVerdicts.length - v)); |
| 65 |
|
| 66 |
vc[i].setVerdicts(filteredVerdicts); |
| 67 |
return vc; |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
return vc; |
| 74 |
} |
| 75 |
} |