mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Checking for unexpected log entries (exceptions) in tests.
This commit is contained in:
parent
568cdaa634
commit
503f335c19
12 changed files with 92 additions and 40 deletions
|
@ -15,8 +15,6 @@ import java.io.OutputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||
|
@ -31,6 +29,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -39,10 +38,11 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class BuiltinSpecsDetectorTest extends TestCase {
|
||||
public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||
private static final String PROVIDER_ID = "provider.id";
|
||||
private static final String PROVIDER_NAME = "provider name";
|
||||
private static final String LANGUAGE_ID = "language.test.id";
|
||||
|
@ -119,18 +119,20 @@ public class BuiltinSpecsDetectorTest extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ResourceHelper.cleanUp();
|
||||
Job.getJobManager().join(AbstractBuiltinSpecsDetector.JOB_FAMILY_BUILTIN_SPECS_DETECTOR, null);
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
|
||||
CoreModel coreModel = CoreModel.getDefault();
|
||||
ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
|
||||
// project description
|
||||
ICProjectDescription projectDescription = mngr.getProjectDescription(project);
|
||||
ICProjectDescription projectDescription = mngr.getProjectDescription(project, false);
|
||||
assertNotNull(projectDescription);
|
||||
assertEquals(1, projectDescription.getConfigurations().length);
|
||||
// configuration description
|
||||
|
|
|
@ -18,8 +18,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||
|
@ -37,6 +35,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser;
|
||||
|
@ -51,10 +50,11 @@ import org.eclipse.core.runtime.Platform;
|
|||
import org.eclipse.core.runtime.content.IContentType;
|
||||
import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||
import org.eclipse.core.runtime.content.IContentTypeSettings;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public class GCCBuildCommandParserTest extends TestCase {
|
||||
public class GCCBuildCommandParserTest extends BaseTestCase {
|
||||
// ID of the parser taken from the extension point
|
||||
private static final String GCC_BUILD_COMMAND_PARSER_EXT = "org.eclipse.cdt.make.core.build.command.parser.gcc"; //$NON-NLS-1$
|
||||
|
||||
|
@ -81,18 +81,20 @@ public class GCCBuildCommandParserTest extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ResourceHelper.cleanUp();
|
||||
Job.getJobManager().join(AbstractBuildCommandParser.JOB_FAMILY_BUILD_COMMAND_PARSER, null);
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
|
||||
CoreModel coreModel = CoreModel.getDefault();
|
||||
ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
|
||||
// project description
|
||||
ICProjectDescription projectDescription = mngr.getProjectDescription(project);
|
||||
ICProjectDescription projectDescription = mngr.getProjectDescription(project, false);
|
||||
assertNotNull(projectDescription);
|
||||
assertEquals(1, projectDescription.getConfigurations().length);
|
||||
// configuration description
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.ICConsoleParser;
|
||||
import org.eclipse.cdt.core.IErrorParser;
|
||||
|
@ -25,10 +26,10 @@ import org.eclipse.cdt.core.errorparsers.RegexErrorParser;
|
|||
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -46,6 +47,8 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
public abstract class AbstractBuildCommandParser extends AbstractLanguageSettingsOutputScanner
|
||||
implements ICConsoleParser, IErrorParser {
|
||||
|
||||
public static final Object JOB_FAMILY_BUILD_COMMAND_PARSER = "org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser";
|
||||
|
||||
private static final String LEADING_PATH_PATTERN = "\\S+[/\\\\]"; //$NON-NLS-1$
|
||||
private static final Pattern OPTIONS_PATTERN = Pattern.compile("-[^\\s\"']*(\\s*((\".*?\")|('.*?')|([^-\\s][^\\s]+)))?"); //$NON-NLS-1$
|
||||
private static final int OPTION_GROUP = 0;
|
||||
|
@ -115,6 +118,7 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
|||
return options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processLine(String line) {
|
||||
return processLine(line, null);
|
||||
}
|
||||
|
@ -159,11 +163,24 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
|||
thread.setName(oldName);
|
||||
return status;
|
||||
}
|
||||
@Override
|
||||
public boolean belongsTo(Object family) {
|
||||
return family == JOB_FAMILY_BUILD_COMMAND_PARSER;
|
||||
}
|
||||
};
|
||||
|
||||
ISchedulingRule rule = null;
|
||||
if (currentProject != null) {
|
||||
rule = currentProject.getFile(".settings/language.settings.xml");
|
||||
IFolder settingsFolder = currentProject.getFolder(".settings");
|
||||
if (!settingsFolder.exists()) {
|
||||
try {
|
||||
settingsFolder.create(true, true, null);
|
||||
if (settingsFolder.isAccessible())
|
||||
rule = currentProject.getFile(".settings/language.settings.xml");
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rule == null) {
|
||||
rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||
|
@ -193,6 +210,7 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessLineBehaviour() {
|
||||
return KEEP_LONGLINES;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSettingsOutputScanner implements ICListenerRegisterer {
|
||||
public static final Object JOB_FAMILY_BUILTIN_SPECS_DETECTOR = "org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector";
|
||||
|
||||
private static final int TICKS_STREAM_MONITOR = 100;
|
||||
private static final int TICKS_CLEAN_MARKERS = 1;
|
||||
private static final int TICKS_RUN_FOR_ONE_LANGUAGE = 10;
|
||||
|
@ -102,11 +104,13 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
|||
protected static final String SCANNER_DISCOVERY_PROBLEM_MARKER = MakeCorePlugin.PLUGIN_ID + ".scanner.discovery.problem"; //$NON-NLS-1$
|
||||
protected static final String PROVIDER = "provider"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||
ProblemMarkerInfo info = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar);
|
||||
addMarker(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
|
||||
final String providerName = getName();
|
||||
final String providerId = getId();
|
||||
|
@ -164,12 +168,15 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
|||
*
|
||||
*/
|
||||
private class ConsoleParser implements ICConsoleParser {
|
||||
@Override
|
||||
public void startup(ICConfigurationDescription cfgDescription) throws CoreException {
|
||||
// not used here, see instead startupForLanguage() in AbstractBuiltinSpecsDetector.runForEachLanguage(...)
|
||||
}
|
||||
@Override
|
||||
public boolean processLine(String line) {
|
||||
return AbstractBuiltinSpecsDetector.this.processLine(line, errorParserManager);
|
||||
}
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// not used here, see instead shutdownForLanguage() in AbstractBuiltinSpecsDetector.runForEachLanguage(...)
|
||||
}
|
||||
|
@ -236,6 +243,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
|||
return buildDirURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerListener(ICConfigurationDescription cfgDescription) {
|
||||
LanguageSettingsLogger.logInfo(getPrefixForLog() + "registerListener [" + System.identityHashCode(this) + "] " + this);
|
||||
|
||||
|
@ -243,6 +251,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
|||
execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterListener() {
|
||||
LanguageSettingsLogger.logInfo(getPrefixForLog() + "unregisterListener [" + System.identityHashCode(this) + "] " + this);
|
||||
}
|
||||
|
@ -261,6 +270,10 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
return runForEachLanguage(currentCfgDescription, null, null, monitor);
|
||||
}
|
||||
@Override
|
||||
public boolean belongsTo(Object family) {
|
||||
return family == JOB_FAMILY_BUILTIN_SPECS_DETECTOR;
|
||||
}
|
||||
};
|
||||
|
||||
IProject ownerProject = null;
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||
|
@ -25,6 +23,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.GCCBuiltinSpecsDetector;
|
||||
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.GCCBuiltinSpecsDetectorCygwin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -32,7 +31,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class GCCBuiltinSpecsDetectorTest extends TestCase {
|
||||
public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||
private static final String LANGUAGE_ID_C = GCCLanguage.ID;
|
||||
|
||||
class MockGCCBuiltinSpecsDetector extends GCCBuiltinSpecsDetector {
|
||||
|
@ -59,11 +58,12 @@ public class GCCBuiltinSpecsDetectorTest extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ResourceHelper.cleanUp();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.language.settings.providers;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||
|
@ -25,6 +24,7 @@ import org.eclipse.cdt.core.settings.model.CMacroEntry;
|
|||
import org.eclipse.cdt.core.settings.model.CMacroFileEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -33,7 +33,7 @@ import org.eclipse.core.runtime.Path;
|
|||
/**
|
||||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsExtensionsTests extends TestCase {
|
||||
public class LanguageSettingsExtensionsTests extends BaseTestCase {
|
||||
// These should match corresponding entries defined in plugin.xml
|
||||
private static final String EXTENSION_BASE_PROVIDER_ID = "org.eclipse.cdt.core.tests.language.settings.base.provider";
|
||||
private static final String EXTENSION_BASE_PROVIDER_NAME = "Test Plugin Mock Language Settings Base Provider";
|
||||
|
@ -63,10 +63,12 @@ public class LanguageSettingsExtensionsTests extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.language.settings.providers;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
|
@ -23,6 +22,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.ILanguageSettingsChangeEvent;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.ILanguageSettingsChangeListener;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||
|
@ -31,7 +31,7 @@ import org.eclipse.core.resources.IProject;
|
|||
/**
|
||||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsListenersTests extends TestCase {
|
||||
public class LanguageSettingsListenersTests extends BaseTestCase {
|
||||
// Must match provider id defined as extension point
|
||||
private static final String EXTENSION_REGISTERER_PROVIDER_ID = "org.eclipse.cdt.core.tests.language.settings.listener.registerer.provider";
|
||||
private static final String EXTENSION_EDITABLE_PROVIDER_ID = "org.eclipse.cdt.core.tests.custom.editable.language.settings.provider";
|
||||
|
@ -46,6 +46,7 @@ public class LanguageSettingsListenersTests extends TestCase {
|
|||
private int count = 0;
|
||||
private ILanguageSettingsChangeEvent lastEvent = null;
|
||||
|
||||
@Override
|
||||
public void handleEvent(ILanguageSettingsChangeEvent event) {
|
||||
count++;
|
||||
lastEvent = event;
|
||||
|
@ -77,13 +78,14 @@ public class LanguageSettingsListenersTests extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
LanguageSettingsProvidersSerializer.unregisterLanguageSettingsChangeListener(mockLseListener);
|
||||
LanguageSettingsManager.setWorkspaceProviders(null);
|
||||
ResourceHelper.cleanUp();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.language.settings.providers;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||
|
@ -28,6 +27,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.CModelMock;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescription;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -40,7 +40,7 @@ import org.eclipse.core.runtime.Path;
|
|||
/**
|
||||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsManagerTests extends TestCase {
|
||||
public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||
// Those should match ids of plugin extensions defined in plugin.xml
|
||||
private static final String EXTENSION_BASE_PROVIDER_ID = "org.eclipse.cdt.core.tests.language.settings.base.provider";
|
||||
private static final String EXTENSION_EDITABLE_PROVIDER_ID = "org.eclipse.cdt.core.tests.custom.editable.language.settings.provider";
|
||||
|
@ -82,6 +82,7 @@ public class LanguageSettingsManagerTests extends TestCase {
|
|||
this.entries = entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||
return entries;
|
||||
}
|
||||
|
@ -99,12 +100,13 @@ public class LanguageSettingsManagerTests extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
LanguageSettingsManager.setWorkspaceProviders(null);
|
||||
ResourceHelper.cleanUp();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,6 +233,8 @@ public class LanguageSettingsManagerTests extends TestCase {
|
|||
|
||||
// use careless provider causing an exception
|
||||
{
|
||||
setExpectedNumberOfLoggedNonOKStatusObjects(1);
|
||||
|
||||
ILanguageSettingsProvider providerNPE = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null) {
|
||||
@Override
|
||||
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||
|
@ -270,14 +274,14 @@ public class LanguageSettingsManagerTests extends TestCase {
|
|||
|
||||
};
|
||||
providers.add(providerYes);
|
||||
// define provider returning null when configuration id matches and some entries otherwise
|
||||
// define provider returning entries when configuration id does NOT match and null otherwise
|
||||
ILanguageSettingsProvider providerNo = new MockProvider(PROVIDER_1, PROVIDER_NAME_1, null) {
|
||||
@Override
|
||||
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||
if (cfgDescription.getId().equals(modelCfgDescription.getId())) {
|
||||
return null;
|
||||
if (cfgDescription!= null && !cfgDescription.getId().equals(modelCfgDescription.getId())) {
|
||||
return entries;
|
||||
}
|
||||
return entries;
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -376,10 +380,10 @@ public class LanguageSettingsManagerTests extends TestCase {
|
|||
ILanguageSettingsProvider provider = new MockProvider(PROVIDER_0, PROVIDER_NAME_0, null) {
|
||||
@Override
|
||||
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||
if (rc.equals(parentFolder)) {
|
||||
if (rc!=null && rc.equals(parentFolder)) {
|
||||
return entries;
|
||||
}
|
||||
if (rc.equals(emptySettingsPath)) {
|
||||
if (rc!=null && rc.equals(emptySettingsPath)) {
|
||||
return new ArrayList<ICLanguageSettingEntry>(0);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.language.settings.providers;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
@ -27,6 +26,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
|||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||
import org.eclipse.cdt.core.testplugin.CModelMock;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||
|
@ -39,7 +39,7 @@ import org.w3c.dom.Element;
|
|||
/**
|
||||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsPersistenceProjectTests extends TestCase {
|
||||
public class LanguageSettingsPersistenceProjectTests extends BaseTestCase {
|
||||
private static final String LANGUAGE_SETTINGS_PROJECT_XML = ".settings/language.settings.xml";
|
||||
private static final String LANGUAGE_SETTINGS_WORKSPACE_XML = "language.settings.xml";
|
||||
// Should match extension points defined in plugin.xml
|
||||
|
@ -128,12 +128,13 @@ public class LanguageSettingsPersistenceProjectTests extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
LanguageSettingsManager.setWorkspaceProviders(null);
|
||||
ResourceHelper.cleanUp();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
|
@ -32,6 +31,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -46,7 +46,7 @@ import org.eclipse.core.runtime.Path;
|
|||
/**
|
||||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsScannerInfoProviderTests extends TestCase {
|
||||
public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
|
||||
private static final IFile FAKE_FILE = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/project/path0"));
|
||||
private static final String PROVIDER_ID = "test.provider.id";
|
||||
private static final String PROVIDER_ID_2 = "test.provider.id.2";
|
||||
|
@ -81,11 +81,12 @@ public class LanguageSettingsScannerInfoProviderTests extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ResourceHelper.cleanUp();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,6 +178,9 @@ public class LanguageSettingsScannerInfoProviderTests extends TestCase {
|
|||
ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
|
||||
assertNull(language);
|
||||
|
||||
// AG FIXME - temporarily ignore the entry in the log
|
||||
setExpectedNumberOfLoggedNonOKStatusObjects(1);
|
||||
|
||||
ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
|
||||
assertEquals(0, info.getIncludePaths().length);
|
||||
assertEquals(0, info.getDefinedSymbols().size());
|
||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.core.language.settings.providers;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||
|
@ -28,6 +27,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.testplugin.CModelMock;
|
||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
|
@ -41,7 +41,7 @@ import org.w3c.dom.Element;
|
|||
/**
|
||||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsSerializableTests extends TestCase {
|
||||
public class LanguageSettingsSerializableTests extends BaseTestCase {
|
||||
private static final String CFG_ID = "test.configuration.id";
|
||||
private static final ICConfigurationDescription MOCK_CFG = new CModelMock.DummyCConfigurationDescription(CFG_ID);
|
||||
private static final IResource MOCK_RC = ResourcesPlugin.getWorkspace().getRoot();
|
||||
|
@ -70,11 +70,12 @@ public class LanguageSettingsSerializableTests extends TestCase {
|
|||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
ResourceHelper.cleanUp();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,7 +193,10 @@ public class LanguageSettingsProvidersSerializer {
|
|||
* That side effect is here to ensure atomic processing of firing & resetting the delta.
|
||||
*/
|
||||
public LanguageSettingsChangeEvent(ICProjectDescription prjDescription) {
|
||||
Assert.isTrue(prjDescription.isReadOnly());
|
||||
if (!prjDescription.isReadOnly()) {
|
||||
String msg = "Project description " + prjDescription.getName() + " is expected to be read-only";
|
||||
CCorePlugin.log(new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, msg, new Exception(msg)));
|
||||
}
|
||||
|
||||
projectName = prjDescription.getName();
|
||||
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
||||
|
|
Loading…
Add table
Reference in a new issue