From 90b3ebc1df54d2b76b038b405bb59f9a0ac7017d Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Sat, 19 Jun 2021 15:32:31 -0400 Subject: [PATCH] Bug 574331: Set default query results for tests Most of the tests in this bundle already had this bit of code before calling create project. This makes BuildDescriptionModelTests consistent with the rest. Note that this modifies global state and does not restore it. However, as that is consistent with the other tests in this bundle, and the global state is only maintained while running tests on this bundle, I am not fixing this aspect of the code. Change-Id: I2004af177a959e1efbd45b23c960b517d8993b7c --- .../core/tests/BuildDescriptionModelTests.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java index 5cd67e38e39..ee09c004a19 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java @@ -55,6 +55,7 @@ import org.eclipse.cdt.managedbuilder.internal.buildmodel.DbgUtil; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.macros.BuildMacroException; import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider; +import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager; import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -62,6 +63,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; +import org.eclipse.ui.dialogs.IOverwriteQuery; import junit.framework.Test; import junit.framework.TestCase; @@ -877,6 +879,17 @@ public class BuildDescriptionModelTests extends TestCase { } private IProject createProject(String name, String id) { + + // In case the projects need to be updated... + IOverwriteQuery queryALL = new IOverwriteQuery() { + @Override + public String queryOverwrite(String file) { + return ALL; + } + }; + UpdateManagedProjectManager.setBackupFileOverwriteQuery(queryALL); + UpdateManagedProjectManager.setUpdateProjectQuery(queryALL); + IProject proj = ManagedBuildTestHelper.createProject(name, id); if (proj != null) fCompositeCleaner.addRunnable(new ProjectCleaner(proj));