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 59210 Details for
Bug 165935
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.
Launch Verification Hook Class
PlatformUIProfilingPerspectiveLaunch.java (text/plain), 14.00 KB, created by
Liz Dancy
on 2007-02-16 18:20:41 EST
(
hide
)
Description:
Launch Verification Hook Class
Filename:
MIME Type:
Creator:
Liz Dancy
Created:
2007-02-16 18:20:41 EST
Size:
14.00 KB
patch
obsolete
>package org.eclipse.hyades.use.cases.auto.profiling.logging; > >import java.util.Hashtable; > >import org.eclipse.hyades.use.cases.auto.common.Logger; >import org.eclipse.hyades.use.cases.auto.common.VerifyHookUtil; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Control; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.swt.widgets.Table; >import org.eclipse.swt.widgets.TableItem; >import org.eclipse.swt.widgets.Tree; >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</b> located at > * <i>/org.eclipse.hyades.use.cases/Gui/Profiling_and_Logging/Platform.UI.ProfilingPerspective.Launch.testsuite</i>. > */ >/* > * @author Mike Hao > */ >public class PlatformUIProfilingPerspectiveLaunch extends > AutoGUIVerificationHook { > > /** > * Constructor for PlatformUIProfilingPerspectiveLaunch. 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 PlatformUIProfilingPerspectiveLaunch(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 newly added profiling set default name. > * <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>Click the <b>Add</b> button and then the <b>Finish</b> button.</li> > * <li>A new profiling set with the name <b>New Profiling Set</b> should be added to the set list.</li> > * <li>Click the <b>Add</b> button and then the <b>Finish</b> button again.</li> > * <li>A new profiling set with the name <b>New Profiling Set (1)</b> should be added to the set list.</li> > * <li>Click the <b>Add</b> button and then the <b>Finish</b> button once again.</li> > * <li>A new profiling set with the name <b>New Profiling Set (2)</b> should be added to the set list.</li> > * </ol> > * <p> > * <b>Purpose:</b> Perform the verification in step #6 > * @throws Exception > */ > public void verifyProfilingSetName2(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyProfilingSetName2"); > verifyExistanceOfProfilingSet (arg0, "New Profiling Set (1)"); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyProfilingSetName2"); > } > > > private void verifyExistanceOfProfilingSet (Shell launchConfigurationDialog, String profilingSetName) > { > boolean doesExist = false; > Control tables[] = VerifyHookUtil.findAllControl(launchConfigurationDialog, VerifyHookUtil.TABLE_CONTROL_TYPE, null); > > for(int i = 0; i < tables.length; i++) > { > TableItem tableItem = VerifyHookUtil.findTableItem((Table)tables[i], 0, profilingSetName); > if (tableItem != null) > { > doesExist = true; > break; > } > } > > assertTrue(doesExist); > } > > /** > * VerifyNoDataCollectorError > * Verifies that an error is displayed when there are no data collectors selected for a launch > * > * 1. Open the profile launch configuraiton > * 2. Create a new Java application > * 3. Switch to the profile/monitor tab > * 4. Select the dynamic log discoverer and java profiling data collectors > * 5. Deselect both data collectors > * 6. Ensure that an error is displayed about no data collectors being selected. > * > * Performs the verification in step 6 > * @throws Exception > */ > public void verifyNoDataCollectorError(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyNoDataCollectorError"); > assertTrue(VerifyHookUtil.verifyControlValue(arg0, VerifyHookUtil.TEXT_CONTROL_TYPE, > new String[] {"The launch requires at least one data collector to be selected"})); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyNoDataCollectorError"); > } > > /** > * TestLaunchConfigurationPersistance > * 1. Open the profile launch configuration > * 2. Create a new launch configuration of type Java Application > * 3. Switch to the profile/monitor tab > * 4. Select memory analysis under Java Profiling > * 5. Click Edit option and select the collect instace level information > * 6. Close the launch configuration > * 7. Re-open it and verify that the state of the launch configuration was preserved. > * > * Purpose: Verifies that the right data collector and analysis type are selected > * @throws Exception > */ > public void verifyPersistenceOfDataCollector(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyPersistanceOfDataCollector"); > checkLaunchItemState (arg0, new String[]{"Java Profiling (double click to modify filters)", "Execution Time Analysis"}, new boolean[] {true, true}); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyPersistanceOfDataCollector"); > } > > private void checkLaunchItemState (org.eclipse.swt.widgets.Shell launchConfigDialog, String[] launchItemNames, boolean[] state) > { > Hashtable launchItemNamesHash = new Hashtable(); > Control[] trees = VerifyHookUtil.findAllControl(launchConfigDialog, VerifyHookUtil.TREE_CONTROL_TYPE, null); > > for (int i = 0; i < trees.length; i++) > { > for (int j = 0; j < launchItemNames.length; j++) > { > TreeItem treeItem = VerifyHookUtil.findChild((Tree)trees[i], launchItemNames[j], true); > if (treeItem != null) > launchItemNamesHash.put(launchItemNames[j], treeItem); > > } > } > > for (int i = 0; i < launchItemNames.length; i++) > { > TreeItem treeItem = (TreeItem)launchItemNamesHash.get(launchItemNames[i]); > assertNotNull("Didn't find the tree item: " + launchItemNames[i], treeItem); > assertTrue("The state of " + launchItemNames[i] + " is not " + state[i], treeItem.getChecked() == state[i]); > } > } > > /** > * TestLaunchConfigurationPersistance > * 1. Open the profile launch configuration > * 2. Create a new launch configuration of type Java Application > * 3. Switch to the profile/monitor tab > * 4. Select memory analysis under Java Profiling > * 5. Click Edit option and select the collect instace level information > * 6. Close the launch configuration > * 7. Re-open it and verify that the state of the launch configuration was preserved. > * > * Purpose: Verifies that the collect instance level information option is selected > * @throws Exception > */ > public void verifyAnalysisTypeOptPersistence(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyAnalysisTypeOptPersistance"); > > Control instanceLevelInfoButton = VerifyHookUtil.findControl(arg0, VerifyHookUtil.BUTTON_CONTROL_TYPE, "Collect.*instance level information"); > assertNotNull (instanceLevelInfoButton); > assertTrue(((Button)instanceLevelInfoButton).getSelection()); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyAnalysisTypeOptPersistance"); > } > > /** > * TestFilterPersistence > * 1. Open the profile launch configuration > * 2. Create a new launch configuration of type "Java Application" > * 3. Select Java Profiling and click edit option > * 4. Add 2 filters with the name filter1 and filter2 > * 5. Apply the changes, close the profile configuration > * 6. Re-open the profile launch configuration and verify that the filters were persisted > * @throws Exception > */ > public void verifyFilterPersistence(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyFilterPersistence"); > boolean doesExist = false; > > Control tables[] = VerifyHookUtil.findAllControl(arg0, VerifyHookUtil.TABLE_CONTROL_TYPE, null); > > > TableItem tableItem1 = VerifyHookUtil.findTableItem ((Table)tables[0], 0, "filter1"); > assertNotNull("filter1 did not persist",tableItem1); > TableItem tableItem2 = VerifyHookUtil.findTableItem((Table)tables[1], 0, "mypackage.*"); > TableItem tableItem3 = VerifyHookUtil.findTableItem ((Table)tables[0], 0, "filter2"); > assertNotNull("filter2 did not persist",tableItem3); > if(tableItem2 != null) > { //check one of the filter's details to be sure that the actual filter criteria persists > assertEquals(tableItem2.getText(1).trim(), "method1"); > assertEquals(tableItem2.getText(2).trim(), "EXCLUDE"); > doesExist = true; > > } > > assertTrue(doesExist); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyFilterPersistence"); > } > > > > /** > * TestMultipleLaunchConfigurations > * 1. Open the profile launch configuration > * 2. Create two launch configurations of type "Java Application" > * 3. Switch to the profile/monitor tab and select "Java Profiling" under the first launch configuration > * 4. Select the second launch configuration and ensure that only the memory analysis type is selected > * 5. Select the first launch configuration and set the Java Profiling launch configuration to "Websphere..." > * 6. Select the second launch configuration and ensure that the filter of the "Java Profiling" data collector is default. > * > * Purpose: Verify that only the memory analysis type is selected > * @throws Exception > */ > public void verifyNoDataCollectorSelected(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyNoDataCollectorSelected"); > checkLaunchItemState (arg0, new String[]{"Basic Memory Analysis", "Execution Time Analysis", "Method Code Coverage", "Probe Insertion"}, > new boolean[] {true, false, false, false}); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyNoDataCollectorSelected"); > } > > /** > * TestMultipleLaunchConfigurations > * 1. Open the profile launch configuration > * 2. Create two launch configurations of type "Java Application" > * 3. Switch to the profile/monitor tab and select "Java Profiling" under the first launch configuration > * 4. Select the second launch configuration and ensure that no data collectors are selected. > * 5. Select the first launch configuration and set the Java Profiling launch configuration to "Websphere..." > * 6. Select the second launch configuration and ensure that the filter of the "Java Profiling" data collector is default. > * @throws Exception > */ > public void verifyDefaultFilterIsSelected(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyDefaultFilterIsSelected"); > boolean doesExist = false; > Control tables[] = VerifyHookUtil.findAllControl(arg0, VerifyHookUtil.TABLE_CONTROL_TYPE, null); > > for(int i = 0; i < tables.length; i++) > { > TableItem tableItem = VerifyHookUtil.findTableItem ((Table)tables[i], 0, "Default"); > if(tableItem != null) > { > assertTrue(tableItem.getChecked()); > doesExist = true; > break; > } > } > assertTrue(doesExist); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyDefaultFilterIsSelected"); > } > > /** > * TestPersistenceOfDestinationOptions > * 1. Open the profile launch configuration > * 2. Create a launch configuration of type "Java Application" > * 3. Switch to the destination tab > * 4. Change the project name, monitor name, and set the profile to file option with a dummy file path. > * 5. Apply the changes and close the configuration dialog > * 6. Re-open the dialog and ensure that all changed data was persisted. > * > * Purpose: Verify the persistence of destination options > * @throws Exception > */ > public void verifyPersistenceOfDestOpt(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyPersistenceOfDestOpt"); > > /* The project name */ > assertNotNull(VerifyHookUtil.findControl(arg0, VerifyHookUtil.TEXT_CONTROL_TYPE, "NewProject")); > > /* The monitor name */ > assertNotNull(VerifyHookUtil.findControl(arg0, VerifyHookUtil.TEXT_CONTROL_TYPE, "NewMonitor")); > > /* The send to file option */ > Control sendToFile = VerifyHookUtil.findControl(arg0, VerifyHookUtil.BUTTON_CONTROL_TYPE, ".*Send profiling data to a file"); > assertNotNull(sendToFile); > assertTrue(((Button)sendToFile).getSelection()); > > /* The file name */ > assertNotNull(VerifyHookUtil.findControl(arg0, VerifyHookUtil.TEXT_CONTROL_TYPE, ".*dummy_File_Path")); > > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyPersistenceOfDestOpt"); > } > > /** > * TestPresenceOfJavaProfilingDataCollector > * 1. Open the profile launch configuration > * 2. Create a launch configuration of type: > * Attach - Java Process > * Eclipse Applicaiton > * Equinox OSGi Framework > * External Java Application > * Java Applet > * Java Application > * JUni > * JUnit Plug-in Test > * Statistical > * SWT Applicaiton > * Test > * 3. For each launch type, verify that the Java Profiling data collector is present under the profile/monitor tab. > * @throws Exception > */ > public void verifyJavaProfilingIsPresent(org.eclipse.swt.widgets.Shell arg0) > throws Exception > { > Logger.getInstance().logMessage(Logger.INFO, "Entering verifyJavaProfilingIsPresent"); > Control[] trees = VerifyHookUtil.findAllControl(arg0, VerifyHookUtil.TREE_CONTROL_TYPE, null); > > boolean isJavaProfilingPresent = false; > for (int i = 0; i < trees.length; i++) > { > TreeItem dataCollector = VerifyHookUtil.findChild((Tree)trees[i], "Java Profiling (double click to modify filters)"); > if (dataCollector != null) > { > isJavaProfilingPresent = true; > break; > } > } > > assertTrue(isJavaProfilingPresent); > Logger.getInstance().logMessage(Logger.INFO, "Exiting verifyJavaProfilingIsPresent"); > } > > > > > >}
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 165935
:
59208
|
59209
| 59210 |
59211
|
59268
|
59269
|
59280
|
59283