Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 157300
Collapse All | Expand All

(-)schema/executionHistoryExtension.exsd (-1 / +1 lines)
Lines 28-34 Link Here
28
            <choice>
28
            <choice>
29
               <element ref="actionExtension" minOccurs="0" maxOccurs="unbounded"/>
29
               <element ref="actionExtension" minOccurs="0" maxOccurs="unbounded"/>
30
               <element ref="eventExtension" minOccurs="0" maxOccurs="unbounded"/>
30
               <element ref="eventExtension" minOccurs="0" maxOccurs="unbounded"/>
31
               <element ref="verdictProvider" minOccurs="0" maxOccurs="1"/>
31
               <element ref="verdictProvider" minOccurs="0" maxOccurs="unbounded"/>
32
               <element ref="resultExtension" minOccurs="0" maxOccurs="1"/>
32
               <element ref="resultExtension" minOccurs="0" maxOccurs="1"/>
33
            </choice>
33
            </choice>
34
         </sequence>
34
         </sequence>
(-)plugin.xml (+15 lines)
Lines 919-924 Link Here
919
         </action>
919
         </action>
920
      </actionSet>
920
      </actionSet>
921
   </extension>
921
   </extension>
922
       <extension
923
             point="org.eclipse.hyades.test.ui.executionHistoryExtension">
924
          <verdictProvider
925
                provider="org.eclipse.hyades.test.ui.forms.extensions.provisional.TPTPVerdictCategoryProvider"
926
                testType="org.eclipse.hyades.test.manual.testSuite">
927
          </verdictProvider>
928
          <verdictProvider
929
                provider="org.eclipse.hyades.test.ui.forms.extensions.provisional.TPTPVerdictCategoryProvider"
930
                testType="org.eclipse.hyades.test.java.junit.testSuite">
931
          </verdictProvider>
932
          <verdictProvider
933
                provider="org.eclipse.hyades.test.ui.forms.extensions.provisional.TPTPVerdictCategoryProvider"
934
                testType="org.eclipse.hyades.test.http.junit.testSuite">
935
          </verdictProvider>
936
       </extension>
922
   
937
   
923
   
938
   
924
</plugin>
939
</plugin>
(-)src/org/eclipse/hyades/test/ui/forms/extensions/provisional/TPTPVerdictCategoryProvider.java (+75 lines)
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
}

Return to bug 157300