diff options
author | Paul Pazderski | 2020-02-14 21:18:42 +0000 |
---|---|---|
committer | Paul Pazderski | 2020-02-16 22:41:13 +0000 |
commit | 296b2b78ef97e1aecb6e46e0eb45e4aed37c0ffb (patch) | |
tree | 8c8cca28755f62116b3a9e31d055dd0ef1c48d09 /org.eclipse.debug.tests | |
parent | 74e688a23653d390662d791d63d879af077a4217 (diff) | |
download | eclipse.platform.debug-296b2b78ef97e1aecb6e46e0eb45e4aed37c0ffb.tar.gz eclipse.platform.debug-296b2b78ef97e1aecb6e46e0eb45e4aed37c0ffb.tar.xz eclipse.platform.debug-296b2b78ef97e1aecb6e46e0eb45e4aed37c0ffb.zip |
Bug 251642 - Store termination timestamp as launch and process attributeI20200217-0600I20200216-1800
Also show termination time in process property dialog and process
console label and set launch time as process attribute for external tool
launches.
Change-Id: I052d280d16d8ad42d70992b0a57324a9ce2e4963
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java index c5797cfe3..3dc17e159 100644 --- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java +++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -33,7 +33,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; - import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileSystem; import org.eclipse.core.resources.IContainer; @@ -55,9 +54,11 @@ import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.Launch; +import org.eclipse.debug.core.model.IProcess; import org.eclipse.debug.internal.core.LaunchConfiguration; import org.eclipse.debug.internal.core.LaunchManager; import org.eclipse.debug.tests.TestsPlugin; +import org.eclipse.debug.tests.console.MockProcess; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IWorkbenchWindow; @@ -1182,7 +1183,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau } /** - * Tests that the framework adds time stamps to launch objects. + * Tests that the framework adds launch time stamps to launch objects. */ public void testLaunchTimeStamp() throws CoreException { ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp"); //$NON-NLS-1$ @@ -1190,7 +1191,8 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau try { String stamp = launch.getAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP); assertNotNull("missing time stamp", stamp); //$NON-NLS-1$ - Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not + long lstamp = Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not + assertTrue("Time travel launch", lstamp <= System.currentTimeMillis()); } finally { if (launch != null) { getLaunchManager().removeLaunch(launch); @@ -1199,6 +1201,30 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau } /** + * Tests that the framework adds terminate time stamps to launch and process + * objects. + */ + public void testTerminateTimeStamp() throws Exception { + ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp"); //$NON-NLS-1$ + ILaunch launch = workingCopy.launch(ILaunchManager.DEBUG_MODE, null); + IProcess process = null; + try { + process = DebugPlugin.newProcess(launch, new MockProcess(0), "test-terminate-timestamp"); + String stamp = launch.getAttribute(DebugPlugin.ATTR_TERMINATE_TIMESTAMP); + assertNotNull("missing time stamp", stamp); //$NON-NLS-1$ + long lstamp = Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not + assertTrue("Time travel launch", lstamp <= System.currentTimeMillis()); + } finally { + if (launch != null) { + getLaunchManager().removeLaunch(launch); + } + if (process != null) { + process.terminate(); + } + } + } + + /** * Tests that attributes in a nested map are persisted in alphabetical order. * * @throws CoreException |