Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 59301 Details for
Bug 165936
Some AGR test suites need to be refactored
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
LaunchPart4_VerificationHookClass
PlatformUIProfilingPerspectiveLaunchPart4.java (text/plain), 19.92 KB, created by
Liz Dancy
on 2007-02-19 14:33:04 EST
(
hide
)
Description:
LaunchPart4_VerificationHookClass
Filename:
MIME Type:
Creator:
Liz Dancy
Created:
2007-02-19 14:33:04 EST
Size:
19.92 KB
patch
obsolete
>package org.eclipse.hyades.use.cases.auto.profiling.logging; > >import java.util.ArrayList; > >import org.eclipse.hyades.use.cases.auto.common.Logger; >import org.eclipse.hyades.use.cases.auto.common.VerifyHookUtil; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Control; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.Table; >import org.eclipse.swt.widgets.TableItem; >import org.eclipse.swt.widgets.Tree; >import org.eclipse.swt.widgets.TreeColumn; >import org.eclipse.swt.widgets.TreeItem; >import org.eclipse.tptp.test.auto.gui.internal.runner.AutoGUIVerificationHook; > >/** > * Generated code for the test suite <b>Platform.UI.ProfilingPerspective.Launch.Part5</b> located at > * <i>/org.eclipse.hyades.use.cases/gui/Profiling_and_Logging/Platform.UI.ProfilingPerspective.Launch.Part5.testsuite</i>. > * @modified by Liz Dancy > */ >public class PlatformUIProfilingPerspectiveLaunchPart4 extends > AutoGUIVerificationHook { > > /** > * Constructor for PlatformUIProfilingPerspectiveLaunchPart5. An instance of this class is created to > * test a test method. > * > * @param testMethodName The test method to be tested. > * @param paramTypes The parameter types of the test method > * @param args The arguments of the test method > */ > public PlatformUIProfilingPerspectiveLaunchPart4(String testMethodName, > Class[] paramTypes, Object[] args) { > super(testMethodName, paramTypes, args); > } > > /** > * @see junit.framework.TestCase#setUp() > */ > protected void setUp() throws Exception { > } > > /** > * @see junit.framework.TestCase#tearDown() > */ > protected void tearDown() throws Exception { > Logger.getInstance().close(); > } > > /** > * Verify the profiling set removement warning. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Open a new profiling launch configuration.</li> > * <li>Click the <b>Profiling</b> tab, then the <b>Overview</b> tab.</li> > * <li>Select a profiling set that is shared by more than one launch configurations.</li> > * <li>Click <b>Remove</b> button.</li> > * <li>A warning dialog should show up with an appropriate message.</li> > * <li>Click <b>No</b></li> > * <li>Ensure the profiling set was not removed.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #5 > * @throws Exception > */ > public void verifyProfilingSetRemoveWarning(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > boolean doesWarningExist = false; > > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfilingSetRemoveWarning"); > > Control[] labels = VerifyHookUtil.findAllControl(arg0, VerifyHookUtil.LABEL_CONTROL_TYPE, null); > > for (int i = 0; i < labels.length; i++){ > int index = ((Label)labels[i]).getText().trim().indexOf("The profiling set about to be removed is applied in more then one configurations"); > > if(index >= 0){ > doesWarningExist = true; > break; > } > } > assertTrue(doesWarningExist); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfilingSetRemoveWarning"); > } > > /** > * Verify the profiling set removement warning. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Open a new profiling launch configuration.</li> > * <li>Click the <b>Profiling</b> tab, then the <b>Overview</b> tab.</li> > * <li>Select a profiling set that is shared by more than one launch configurations.</li> > * <li>Click <b>Remove</b> button.</li> > * <li>A warning dialog should show up with an appropriate message.</li> > * <li>Click <b>Yes</b></li> > * <li>Check to ensure that the profiling set for the involved launch configurations in step 3 updated accordingly.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #7 > * @throws Exception > */ > public void verifyProfilingSetRemoveWarningYes1(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfilingSetRemoveWarningYes1"); > verifySelectedTreeItem(arg0, "RemovingSetWarningYes1"); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfilingSetRemoveWarningYes1"); > } > > /** > * Verify the profiling set removement warning. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Open a new profiling launch configuration.</li> > * <li>Click the <b>Profiling</b> tab, then the <b>Overview</b> tab.</li> > * <li>Select a profiling set that is shared by more than one launch configurations.</li> > * <li>Click <b>Remove</b> button.</li> > * <li>A warning dialog should show up with an appropriate message.</li> > * <li>Click <b>Yes</b></li> > * <li>Check to ensure that the profiling set for the involved launch configurations in step 3 updated accordingly.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #7 > * @throws Exception > */ > public void verifyProfilingSetRemoveWarningYes2(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > boolean foundSet = false; > > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfilingSetRemoveWarningYes2"); > > Control tables[] = VerifyHookUtil.findAllControl(arg0, VerifyHookUtil.TABLE_CONTROL_TYPE, null); > TableItem[] tableItemsSelected = null; > > for(int i = 0; i < tables.length; i++){ > tableItemsSelected = ((Table)tables[i]).getSelection(); > > for(int j = 0; j < tableItemsSelected.length; j++){ > if(tableItemsSelected[j].getText(0).trim().equals("RemovingSet")) > foundSet = true; > } > } > > assertFalse(foundSet); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfilingSetRemoveWarningYes2"); > } > > /** > * Verify the profiling set removement warning. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Open a new profiling launch configuration.</li> > * <li>Click the <b>Profiling</b> tab, then the <b>Overview</b> tab.</li> > * <li>Select a profiling set that is shared by more than one launch configurations.</li> > * <li>Click <b>Remove</b> button.</li> > * <li>A warning dialog should show up with an appropriate message.</li> > * <li>Click <b>Yes</b></li> > * <li>Check to ensure that the profiling set for the involved launch configurations in step 3 updated accordingly.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #7 > * @throws Exception > */ > public void verifyProfilingSetRemoveWarningYes3(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfilingSetRemoveWarningYes3"); > verifySelectedTreeItem(arg0, "RemovingSetWarningYes2"); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfilingSetRemoveWarningYes3"); > } > > /** > * Verify profiling agent detached status. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> button.</li> > * <li>Click <b>Profile</b> button.</li> > * <li>Right click on the agent, and select <b>Detach from Agent</b>.</li> > * <li>Verify agent is detached.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #6 > * @throws Exception > */ > public void verifyLocalDetached(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyLocalDetached"); > verifyAgentStatus(arg0, "detached"); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyLocalDetached"); > } > > /** > * Verify profiling agent paused status. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> button.</li> > * <li>Click <b>Profile</b> button.</li> > * <li>Right click on the agent, and select <b>Pause</b>.</li> > * <li>Verify agent is paused.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #6 > * @throws Exception > */ > public void verifyLocalPaused(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyLocalPaused"); > verifyAgentStatus(arg0, "attached"); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyLocalPaused"); > } > > /** > * Verify profiling agent paused status. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> button.</li> > * <li>Click <b>Profile</b> button.</li> * > * <li>Verify agent is monitoring.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #5 > * @throws Exception > */ > public void verifyLocalMonitoring(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyLocalMonitoring"); > verifyAgentStatus(arg0, "monitoring"); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyLocalMonitoring"); > } > > /** > * Verify relaunch from the profile dropdown menu on the toolbar. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> button.</li> > * <li>Click <b>Profile</b> button.</li> * > * <li>The application should be profiled.</li> > * <li>Click on the profile drop down button on the menu bar.</li> > * <li>Select the configuration that corresponds to the last launched class (e.g. HelloWorld)</li> > * <li>Verify the java process is relaunched and traced.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #8 > * @throws Exception > */ > public void verifyDropDownRelaunch(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyDropDownRelaunch"); > > Composite memoryStatisticsView = VerifyHookUtil.getWorkbenchPartControl(arg0); > assertNotNull (memoryStatisticsView); > Tree tree = (Tree)VerifyHookUtil.findControl(memoryStatisticsView, VerifyHookUtil.TREE_CONTROL_TYPE, null); > assertNotNull (tree); > TreeItem[] treeItems = tree.getItems(); > verifyAppInstances(tree, treeItems, "HelloWorld", 1, 1); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyDropDownRelaunch"); > > } > > /** > * Verify relaunch from toolbar dropdown menu. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> button.</li> > * <li>Click <b>Profile</b> button.</li> * > * <li>The application should be profiled.</li> > * <li>Click on the <b>Profile</b> button on the tool bar.</li> > * <li>Verify the java process is relaunched and traced.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #7 > * @throws Exception > */ > public void verifyProfileButtonRelaunch(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfileButtonRelaunch"); > > Composite memoryStatisticsView = VerifyHookUtil.getWorkbenchPartControl(arg0); > assertNotNull (memoryStatisticsView); > Tree tree = (Tree)VerifyHookUtil.findControl(memoryStatisticsView, VerifyHookUtil.TREE_CONTROL_TYPE, null); > assertNotNull (tree); > TreeItem[] treeItems = tree.getItems(); > verifyAppInstances(tree, treeItems, "HelloWorld", 1, 1); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfileButtonRelaunch"); > } > > /** > * Verify last launched relaunch. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Profile an external Java application.</li> > * <li>Click <b>Run</b> from toolbar, and then choose </b>Profile</b>.</li> > * <li>Select the Java application just profiled.</li> > * <li>The application should be profiled.</li> > * <li>Verify the java process is relaunched and traced.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #5 > * @throws Exception > */ > public void verifyProfileLastLaunchedRelaunch(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfileLastLaunchedRelaunch"); > > Composite memoryStatisticsView = VerifyHookUtil.getWorkbenchPartControl(arg0); > assertNotNull (memoryStatisticsView); > Tree tree = (Tree)VerifyHookUtil.findControl(memoryStatisticsView, VerifyHookUtil.TREE_CONTROL_TYPE, null); > assertNotNull (tree); > TreeItem[] treeItems = tree.getItems(); > verifyAppInstances(tree, treeItems, "HelloWorld", 1, 1); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfileLastLaunchedRelaunch"); > } > > > > > > /** > * Verify profiling trace data limits for method invocations. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> > * <li>In the <b>Overview</b> tab, select <b>Execution History - Statistical</b>.</li> > * <li>Go to the <b>Limits</b> tab, set the number of method invocations to limit.</li> > * <li>Click <b>Profile</b> button.</li> > * <li>Verify no new data is received after the specified method invocation times.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #7 > * @throws Exception > */ > public void verifyLimitsCalls(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyLimitsCalls"); > > Composite memoryStatisticsView = VerifyHookUtil.getWorkbenchPartControl(arg0); > assertNotNull (memoryStatisticsView); > Tree tree = (Tree)VerifyHookUtil.findControl(memoryStatisticsView, VerifyHookUtil.TREE_CONTROL_TYPE, null); > assertNotNull (tree); > TreeItem[] treeItems = tree.getItems(); > > verifyCallsDetails(tree, treeItems, new String[]{"(default package)"}, 7, true); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyLimitsCalls"); > } > > /** > * Verify profiling trace data limits for time. > * <p> > * <b>Testing Steps:</b> > * <ol> > * <li>Click on <b>Profile</b> button from the tool bar.</li> > * <li>Double click on <b>External Java Application</b>.</li> > * <li>In the <b>Main</b> tab, browse for a class name, and then click <b>Apply</b> > * <li>In the <b>Overview</b> tab, select <b>Execution History - Statistical</b>.</li> > * <li>Go to the <b>Limits</b> tab, specify some amount of profiling time.</li> > * <li>Click <b>Profile</b> button.</li> > * <li>Verify no new data is received after the specified profiling time.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #7 > * @throws Exception > */ > public void verifyProfilingLimitsTime(org.eclipse.ui.IViewPart arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfilingLimitsTime"); > > Composite memoryStatisticsView = VerifyHookUtil.getWorkbenchPartControl(arg0); > assertNotNull (memoryStatisticsView); > Tree tree = (Tree)VerifyHookUtil.findControl(memoryStatisticsView, VerifyHookUtil.TREE_CONTROL_TYPE, null); > assertNotNull (tree); > TreeItem[] treeItems = tree.getItems(); > > assertTrue("methodB is present even though it wasn't expected to be incldued as part of the trace", getTreeItemIndex(treeItems, "methodB() void") == -1); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfilingLimitsTime"); > } > > private void verifyAgentStatus(org.eclipse.ui.IViewPart arg0, String status){ > boolean found = false; > Composite profileMonitor = VerifyHookUtil.getWorkbenchPartControl(arg0); > assertNotNull (profileMonitor); > VerifyHookUtil.widgetDump(profileMonitor); > > Tree tree = (Tree)VerifyHookUtil.findControl(profileMonitor, VerifyHookUtil.TREE_CONTROL_TYPE, null); > assertNotNull (tree); > > TreeItem[] treeItemSelected = tree.getSelection(); > > for(int i = 0; i < treeItemSelected.length; i++){ > if (treeItemSelected[i].getText().indexOf(status) >= 0){ > found = true; > break; > } > } > assertTrue(found); > } > > private void verifySelectedTreeItem(org.eclipse.swt.widgets.Shell arg0, String label){ > Control trees[] = VerifyHookUtil.findAllControl(arg0, VerifyHookUtil.TREE_CONTROL_TYPE, null); > TreeItem[] treeItemsSelected = null; > boolean itemFound = false; > > for (int i = 0; i < trees.length; i++){ > treeItemsSelected = ((Tree)trees[i]).getSelection(); > > for (int j = 0; j < treeItemsSelected.length; j ++){ > if(treeItemsSelected[j].getText().trim().equals(label)){ > itemFound = true; > break; > } > } > } > assertTrue(itemFound); > } > > > private void verifyAppInstances(Tree tree, TreeItem[] treeItems, String app, int totalExpected, int activeExpected){ > > int totalInstancesClmnIndex = getTreeColumnIndex(tree, "Total Instances"); > int liveInstancesClmnIndex = getTreeColumnIndex(tree, "Live Instances"); > > int appItemIndex = getTreeItemIndex(treeItems, app); > > int appTotalInst = 0; > int appLiveInst = 0; > > for(int i = 0; i < treeItems.length; i++){ > > if( i == appItemIndex ){ > appTotalInst = Integer.parseInt((String)treeItems[i].getText(totalInstancesClmnIndex)); > appLiveInst = Integer.parseInt((String)treeItems[i].getText(liveInstancesClmnIndex)); > } > } > > /* verify the Total Instances and Live Instances of App */ > assertTrue("The appInstances are " + appTotalInst + " but the totalExpected are " + totalExpected,appTotalInst == totalExpected); > assertTrue(appLiveInst == activeExpected); > } > > private int getTreeItemIndex(TreeItem[] items, String item){ > int index = -1; > > for(int i = 0; i < items.length; i++){ > if(items[i].getText().trim().equals(item.trim())){ > index = i; > break; > } > } > return index; > } > > private int[] getTreeItemIndexes(TreeItem[] items, String[] names){ > > int[] indexes = new int[names.length]; > > for(int i = 0; i < names.length; i++){ > indexes[i] = getTreeItemIndex(items, names[i]); > } > return indexes; > } > > private int getTreeColumnIndex(Tree tree, String column){ > int index = -1; > > TreeColumn[] columns = tree.getColumns(); > for(int i = 0; i < columns.length; i++){ > if(columns[i].getText().trim().equals(column.trim())){ > index = i; > break; > } > } > return index; > } > > private void verifyCallsDetails(Tree tree, TreeItem[] treeItems, String[] names, int callTimes, boolean equal){ > > > int callsClmnIndex = getTreeColumnIndex(tree, "Calls"); > int[] indexes = getTreeItemIndexes(treeItems, names); > > ArrayList calls = new ArrayList(); > > for(int i = 0; i < treeItems.length; i++){ > if(isIn(i, indexes)){ > calls.add(treeItems[i].getText(callsClmnIndex)); > } > } > > /* This section verifies following requirments: calls >= callTimes */ > Object[] callsObj = calls.toArray(); > > for(int j = 0; j < callsObj.length; j++){ > if(equal){ > assertTrue(Integer.parseInt((String)callsObj[j]) == callTimes); > }else{ > assertTrue(Integer.parseInt((String)callsObj[j]) >= callTimes); > } > } > } > > private boolean isIn(int index, int[] nums){ > for(int i = 0; i < nums.length; i++){ > if(index == nums[i]){ > return true; > } > } > return false; > } > > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 165936
:
55133
|
55134
|
55135
|
59300
| 59301