Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.ant.tests.ui.debug;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchManager;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
Expand Down Expand Up @@ -96,8 +98,7 @@ protected IBreakpointManager getBreakpointManager() {
* the event waiter to use
* @return Object the source of the event
*/
@Override
protected Object launchAndWait(ILaunchConfiguration configuration, DebugEventWaiter waiter) throws CoreException {
private Object launchAndWait(ILaunchConfiguration configuration, DebugEventWaiter waiter) throws CoreException {
return launchAndWait(configuration, waiter, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.ant.tests.ui.debug;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.ant.tests.ui.debug;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.ant.tests.ui.debug;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,33 @@

package org.eclipse.ant.tests.ui.editor.performance;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.assertProject;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;

import org.eclipse.ant.internal.ui.AntUIPlugin;
import org.eclipse.ant.internal.ui.preferences.AntEditorPreferenceConstants;
import org.eclipse.ant.tests.ui.performance.AbstractAntPerformanceTest;
import org.eclipse.ant.tests.ui.testplugin.ProjectHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.test.performance.Dimension;
import org.eclipse.test.performance.PerformanceTestCaseJunit5;
import org.eclipse.ui.PartInitException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

@SuppressWarnings("restriction")
public class OpenAntEditorTest extends AbstractAntPerformanceTest {
public class OpenAntEditorTest extends PerformanceTestCaseJunit5 {

@BeforeEach
@Override
public void setUp(TestInfo testInfo) throws Exception {
super.setUp(testInfo);
assertProject();
EditorTestHelper.runEventQueue();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package org.eclipse.ant.tests.ui;

import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.console.IHyperlink;
import org.junit.Rule;
Expand All @@ -26,16 +24,6 @@ public abstract class AbstractAntUIBuildTest extends AbstractAntUITest {
@Rule
public RunInSeparateThreadRule runInSeparateThread = new RunInSeparateThreadRule();

/**
* Launches the launch configuration Waits for all of the lines to be appended
* to the console.
*
* @param config the config to execute
*/
protected void launch(ILaunchConfiguration config) throws CoreException {
launchAndTerminate(config, 20000);
}

protected void activateLink(final IHyperlink link) {
Display.getDefault().asyncExec(() -> link.linkActivated());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.eclipse.ant.internal.ui.model.IAntModel;
import org.eclipse.ant.launching.IAntLaunchConstants;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.ant.tests.ui.testplugin.AntUITestUtil;
import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
Expand Down Expand Up @@ -275,7 +276,7 @@ private void assertTargets(AntTargetNode[] targets, String[] expectedTargetNames
}

protected ILaunchConfiguration getLaunchConfiguration(String buildFileName, String arguments, Map<String, String> properties, String propertyFiles) throws CoreException {
ILaunchConfiguration config = getLaunchConfiguration(buildFileName);
ILaunchConfiguration config = AntUITestUtil.getLaunchConfiguration(buildFileName);
assertNotNull("Could not locate launch configuration for " + buildFileName, config); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
if (arguments != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

package org.eclipse.ant.tests.ui;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getProject;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.launchAndTerminate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

package org.eclipse.ant.tests.ui.performance;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getJavaProject;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchManager;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.eclipse.ant.internal.ui.IAntUIConstants;
import org.eclipse.ant.tests.ui.editor.performance.EditorTestHelper;
import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand Down Expand Up @@ -70,8 +71,8 @@ public void testOpenAntLaunchConfigurationDialog2() {
}

private ILaunchConfiguration getLaunchConfiguration(String buildFileName) {
IFile file = AbstractAntUITest.getJavaProject().getProject().getFolder("launchConfigurations").getFile(buildFileName + ".launch"); //$NON-NLS-1$ //$NON-NLS-2$
ILaunchConfiguration config = AbstractAntUITest.getLaunchManager().getLaunchConfiguration(file);
IFile file = getJavaProject().getProject().getFolder("launchConfigurations").getFile(buildFileName + ".launch"); //$NON-NLS-1$ //$NON-NLS-2$
ILaunchConfiguration config = getLaunchManager().getLaunchConfiguration(file);
assertTrue(config.exists(), "Could not find launch configuration for " + buildFileName); //$NON-NLS-1$
return config;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,32 @@

package org.eclipse.ant.tests.ui.performance;

import static org.junit.Assert.assertNotNull;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.assertProject;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.launchAndTerminate;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.eclipse.ant.tests.ui.AbstractAntUIBuildPerformanceTest;
import org.eclipse.ant.tests.ui.testplugin.AntUITestUtil;
import org.eclipse.ant.tests.ui.testplugin.CloseWelcomeScreenExtension;
import org.eclipse.core.externaltools.internal.IExternalToolConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.junit.Test;
import org.eclipse.test.performance.PerformanceTestCaseJunit5;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

@SuppressWarnings("restriction")
public class SeparateVMTests extends AbstractAntUIBuildPerformanceTest {
@ExtendWith(CloseWelcomeScreenExtension.class)
public class SeparateVMTests extends PerformanceTestCaseJunit5 {

@BeforeEach
void setup() throws Exception {
assertProject();
}

/**
* Performance test for launching Ant in a separate vm.
Expand All @@ -52,7 +65,7 @@ public void testBuild() throws CoreException {
public void testBuildNoConsole() throws CoreException {
// tagAsSummary("Separate JRE Build; capture output off", Dimension.ELAPSED_PROCESS);
ILaunchConfiguration config = getLaunchConfiguration("echoingSepVM"); //$NON-NLS-1$
assertNotNull("Could not locate launch configuration for " + "echoingSepVM", config); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull(config, "Could not locate launch configuration for " + "echoingSepVM"); //$NON-NLS-1$ //$NON-NLS-2$
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
copy.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
copy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false);
Expand All @@ -73,7 +86,7 @@ public void testBuildNoConsole() throws CoreException {
public void testBuildMinusDebug() throws CoreException {
// tagAsSummary("Separate JRE Build; -debug", Dimension.ELAPSED_PROCESS);
ILaunchConfiguration config = getLaunchConfiguration("echoingSepVM"); //$NON-NLS-1$
assertNotNull("Could not locate launch configuration for " + "echoingSepVM", config); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull(config, "Could not locate launch configuration for " + "echoingSepVM"); //$NON-NLS-1$ //$NON-NLS-2$
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
copy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, "-debug"); //$NON-NLS-1$
// possible first time hit of the SWT pieces getting written from the JAR to the
Expand Down Expand Up @@ -102,4 +115,19 @@ public void testBuildWithLotsOfLinks() throws CoreException {
commitMeasurements();
assertPerformance();
}

/**
* Launches the Ant build for this config. Waits for all of the lines to be
* appended to the console.
*
* @param config the launch configuration to execute
* @param i the number of times to perform the launch
*/
private void launch(ILaunchConfiguration config, int i) throws CoreException {
startMeasuring();
for (int j = 0; j < i; j++) {
AntUITestUtil.launch(config);
}
stopMeasuring();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

package org.eclipse.ant.tests.ui.separateVM;

import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getJavaProject;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getLaunchConfiguration;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.getProject;
import static org.eclipse.ant.tests.ui.testplugin.AntUITestUtil.launchAndTerminate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand All @@ -32,6 +36,7 @@
import org.eclipse.ant.launching.IAntLaunchConstants;
import org.eclipse.ant.tests.ui.AbstractAntUIBuildTest;
import org.eclipse.ant.tests.ui.debug.TestAgainException;
import org.eclipse.ant.tests.ui.testplugin.AntUITestUtil;
import org.eclipse.ant.tests.ui.testplugin.ConsoleLineTracker;
import org.eclipse.ant.tests.ui.testplugin.ProjectHelper;
import org.eclipse.core.resources.IFile;
Expand Down Expand Up @@ -306,7 +311,7 @@ public void testFailInputHandler() throws CoreException {
assertNotNull("Could not locate launch configuration for " + "echoingSepVM", config); //$NON-NLS-1$ //$NON-NLS-2$
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
copy.setAttribute(IAntUIConstants.SET_INPUTHANDLER, false);
launch(copy);
AntUITestUtil.launch(copy);
String message = ConsoleLineTracker.getMessage(1);
assertNotNull("There must be a message", message); //$NON-NLS-1$
assertTrue("Incorrect message. Should start with Message:. Message: " + message, message.startsWith("echo1")); //$NON-NLS-1$ //$NON-NLS-2$
Expand Down
Loading
Loading