Skip to content

Commit

Permalink
RED-1433 Drop support for Robot Framework 2.9.x
Browse files Browse the repository at this point in the history
Change-Id: Id638cd2c85bf6edc8c3f66f00041d670bb11c6a2
  • Loading branch information
olapolus committed Jul 24, 2020
1 parent c9c64b3 commit 11a4b5c
Show file tree
Hide file tree
Showing 131 changed files with 1,283 additions and 3,513 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void missingRobotProblemIsReported() throws Exception {
public void deprecatedRobotProblemIsReported_whenPythonInstallationIsNotDeprecated() throws Exception {
final RobotProject robotProject = spy(model.createRobotProject(project));
final IRuntimeEnvironment env = new RobotRuntimeEnvironment(null,
"Robot Framework 2.8.2 (Python 2.7.1 on win32)");
"Robot Framework 2.9.2 (Python 2.7.1 on win32)");
builder.checkRuntimeEnvironment(env, robotProject, reporter);

assertThat(reporter.getReportedProblems()).containsExactly(
Expand All @@ -119,23 +119,13 @@ public void deprecatedRobotProblemIsReported_whenPythonInstallationIsNotDeprecat
public void deprecatedRobotProblemIsReported_whenPythonInstallationIsDeprecated() throws Exception {
final RobotProject robotProject = spy(model.createRobotProject(project));
final IRuntimeEnvironment env = new RobotRuntimeEnvironment(null,
"Robot Framework 2.8.2 (Python 2.6.1 on win32)");
"Robot Framework 2.9.2 (Python 2.6.1 on win32)");
builder.checkRuntimeEnvironment(env, robotProject, reporter);

assertThat(reporter.getReportedProblems()).containsExactly(
new Problem(ProjectConfigurationProblem.ENVIRONMENT_DEPRECATED_ROBOT, new ProblemPosition(1)));
}

@Test
public void noProblemsAreReported_whenRobotInstallationIsNotDeprecated() throws Exception {
final RobotProject robotProject = spy(model.createRobotProject(project));
final IRuntimeEnvironment env = new RobotRuntimeEnvironment(null,
"Robot Framework 2.9 (Python 2.7.1 on win32)");
builder.checkRuntimeEnvironment(env, robotProject, reporter);

assertThat(reporter.getReportedProblems()).isEmpty();
}

@Test
public void deprecatedPythonProblemIsReported() throws Exception {
final RobotProject robotProject = spy(model.createRobotProject(project));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,19 +451,6 @@ public void declaredVariableInTimeoutIsNotReported() throws CoreException {
assertThat(problems).isEmpty();
}

@Test
public void documentSettingIsNotReported_whenRobotIsOld() throws CoreException {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile file = new RobotSuiteFileCreator(version).appendLine("*** Settings ***")
.appendLine("Document doc")
.build();

final FileValidationContext context = prepareContext(version);
final Collection<Problem> problems = validate(context, file);

assertThat(problems).isEmpty();
}

@Test
public void documentSettingIsReportedToBeDeprecated_whenRobotIs30() throws CoreException {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down Expand Up @@ -493,23 +480,6 @@ public void documentSettingIsUnknown_whenRobotIs31() throws CoreException {
new Problem(GeneralSettingsProblem.UNKNOWN_SETTING, new ProblemPosition(2, Range.closed(17, 25))));
}

@Test
public void outdatedSetupAndTeardownSyntaxAreNotReported_whenRobotIsOld() throws CoreException {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile file = new RobotSuiteFileCreator(version).appendLine("*** Settings ***")
.appendLine("Suite Precondition kw")
.appendLine("Suite Postcondition kw")
.appendLine("Test Precondition kw")
.appendLine("Test Postcondition kw")
.build();

final List<KeywordEntity> accessibleKws = newArrayList(newResourceKeyword("kw", new Path("/file.robot")));
final FileValidationContext context = prepareContext(accessibleKws, version);
final Collection<Problem> problems = validate(context, file);

assertThat(problems).isEmpty();
}

@Test
public void outdatedSetupAndTeardownSyntaxAreReportedToBeDeprecated_whenRobotIs30() throws CoreException {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,6 @@ public void duplicatedDocumentationsAreReportedInRf3() {
new Problem(GeneralSettingsProblem.DUPLICATED_SETTING, new ProblemPosition(4, Range.closed(53, 68))));
}

@Test
public void documentSettingIsNotReported_inOlderRobot() {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile fileModel = new RobotSuiteFileCreator(version).appendLine("*** Keywords ***")
.appendLine("keyword")
.appendLine(" [Document] doc1")
.build();

final Collection<Problem> problems = validate(prepareContext(version), fileModel);
assertThat(problems).isEmpty();
}

@Test
public void documentSettingIsReportedAsDeprecated_inRf3() {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down Expand Up @@ -326,21 +314,6 @@ public void duplicatedTeardownsAreReportedInRf3() {
new Problem(GeneralSettingsProblem.DUPLICATED_SETTING, new ProblemPosition(4, Range.closed(46, 56))));
}

@Test
public void postconditionSettingIsNotRecognized_inOlderRobot() {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile fileModel = new RobotSuiteFileCreator(version).appendLine("*** Keywords ***")
.appendLine("kw")
.appendLine(" [Postcondition] keyword")
.build();

final List<KeywordEntity> accessibleKws = newArrayList(newResourceKeyword("keyword", new Path("/file.robot")));

final Collection<Problem> problems = validate(prepareContext(accessibleKws, version), fileModel);
assertThat(problems).containsOnly(
new Problem(KeywordsProblem.UNKNOWN_KEYWORD_SETTING, new ProblemPosition(3, Range.closed(22, 37))));
}

@Test
public void postconditionSettingIsReportedAsDeprecated_inRf30() {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,6 @@ public void duplicatedDocumentationsAreReportedInRf3() throws CoreException {
new Problem(GeneralSettingsProblem.DUPLICATED_SETTING, new ProblemPosition(4, Range.closed(52, 67))));
}

@Test
public void documentSettingIsNotReported_inOlderRobot() throws CoreException {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile fileModel = new RobotSuiteFileCreator(version).appendLine("*** Test Cases ***")
.appendLine("case")
.appendLine(" [Document] doc1")
.build();

final Collection<Problem> problems = validate(prepareContext(version), fileModel);
assertThat(problems).isEmpty();
}

@Test
public void documentSettingIsReportedAsDeprecated_inRf30() throws CoreException {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down Expand Up @@ -425,20 +413,6 @@ public void duplicatedSetupsAreReportedInRf3() throws CoreException {
new Problem(GeneralSettingsProblem.DUPLICATED_SETTING, new ProblemPosition(4, Range.closed(47, 54))));
}

@Test
public void preconditionSettingIsNotReported_inOlderRobot() throws CoreException {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile fileModel = new RobotSuiteFileCreator(version).appendLine("*** Test Cases ***")
.appendLine("case")
.appendLine(" [Precondition] keyword")
.build();

final List<KeywordEntity> accessibleKws = newArrayList(newResourceKeyword("keyword", new Path("/file.robot")));

final Collection<Problem> problems = validate(prepareContext(accessibleKws, version), fileModel);
assertThat(problems).isEmpty();
}

@Test
public void preconditionSettingIsReportedAsDeprecated_inRf30() throws CoreException {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down Expand Up @@ -516,20 +490,6 @@ public void duplicatedTeardownsAreReportedInRf3() throws CoreException {
new Problem(GeneralSettingsProblem.DUPLICATED_SETTING, new ProblemPosition(4, Range.closed(50, 60))));
}

@Test
public void postconditionSettingIsNotReported_forOlderRobot() throws CoreException {
final RobotVersion version = new RobotVersion(2, 9);
final RobotSuiteFile fileModel = new RobotSuiteFileCreator(version).appendLine("*** Test Cases ***")
.appendLine("case")
.appendLine(" [Postcondition] keyword")
.build();

final List<KeywordEntity> accessibleKws = newArrayList(newResourceKeyword("keyword", new Path("/file.robot")));

final Collection<Problem> problems = validate(prepareContext(accessibleKws, version), fileModel);
assertThat(problems).isEmpty();
}

@Test
public void postconditionSettingIsReportedAsDeprecated_inRf30() throws CoreException {
final RobotVersion version = new RobotVersion(3, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,9 @@ public class VersionDependentValidatorsTest {
public static class GeneralSettingsTableValidatorsTest {

@Test
public void properValidatorsAreReturnedForVersionUnder29() {
assertThat(getGeneralSettingsTableValidators("2.8.0")).hasSize(11)
.hasOnlyElementsOfTypes(SettingsDuplicationInOldRfValidator.class,
TemplateSettingUntilRf31Validator.class);
}

@Test
public void properValidatorsAreReturnedForVersion29() {
assertThat(getGeneralSettingsTableValidators("2.9")).hasSize(12)
.hasOnlyElementsOfTypes(SettingsDuplicationInOldRfValidator.class,
MetadataKeyInColumnOfSettingValidatorUntilRF30.class,
TemplateSettingUntilRf31Validator.class);
public void properValidatorsAreReturnedForVersionUnder30() {
assertThat(getGeneralSettingsTableValidators("2.9")).hasSize(2)
.hasOnlyElementsOfTypes(TemplateSettingUntilRf31Validator.class);
}

@Test
Expand Down Expand Up @@ -157,9 +148,8 @@ public static class TestCaseSettingsValidatorsTest {

@Test
public void properValidatorsAreReturnedForVersionUnder30() {
assertThat(getTestCaseSettingsValidators("2.9")).hasSize(2)
.hasOnlyElementsOfTypes(LocalSettingsDuplicationInOldRfValidator.class,
TemplateSettingUntilRf31Validator.class);
assertThat(getTestCaseSettingsValidators("2.9")).hasSize(1)
.hasOnlyElementsOfTypes(TemplateSettingUntilRf31Validator.class);
}

@Test
Expand Down Expand Up @@ -284,9 +274,8 @@ private Stream<VersionDependentModelUnitValidator> getTaskSettingsValidators(fin
public static class KeywordSettingsValidatorsTest {

@Test
public void properValidatorsAreReturnedForVersionUnder30() {
assertThat(getKeywordSettingsValidators("2.9")).hasSize(1)
.hasOnlyElementsOfTypes(LocalSettingsDuplicationInOldRfValidator.class);
public void noValidatorsAreReturnedForVersionUnder30() {
assertThat(getKeywordSettingsValidators("2.9")).isEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ public void link() {
for (final ATags<?> tagSetting : getTagsSettings(settingsTable)) {
elements.add(new RobotSetting(this, tagSetting));
}
for (final TestTemplate templateSetting : settingsTable.getTestTemplatesViews()) {
for (final TestTemplate templateSetting : settingsTable.getTestTemplates()) {
elements.add(new RobotSetting(this, templateSetting));
}
for (final TaskTemplate templateSetting : settingsTable.getTaskTemplates()) {
elements.add(new RobotSetting(this, templateSetting));
}
for (final TestTimeout timeoutSetting : settingsTable.getTestTimeoutsViews()) {
for (final TestTimeout timeoutSetting : settingsTable.getTestTimeouts()) {
elements.add(new RobotSetting(this, timeoutSetting));
}
for (final TaskTimeout timeoutSetting : settingsTable.getTaskTimeouts()) {
Expand Down Expand Up @@ -242,11 +242,11 @@ private static List<String> getImportPaths(final List<RobotSetting> importSettin
private static List<? extends AKeywordBaseSetting<?>> getKeywordBasedSettings(final SettingTable settingTable) {
final List<AKeywordBaseSetting<?>> elements = new ArrayList<>();

settingTable.getSuiteSetupsViews().stream().findFirst().ifPresent(elements::add);
settingTable.getSuiteTeardownsViews().stream().findFirst().ifPresent(elements::add);
settingTable.getTestSetupsViews().stream().findFirst().ifPresent(elements::add);
settingTable.getSuiteSetups().stream().findFirst().ifPresent(elements::add);
settingTable.getSuiteTeardowns().stream().findFirst().ifPresent(elements::add);
settingTable.getTestSetups().stream().findFirst().ifPresent(elements::add);
settingTable.getTaskSetups().stream().findFirst().ifPresent(elements::add);
settingTable.getTestTeardownsViews().stream().findFirst().ifPresent(elements::add);
settingTable.getTestTeardowns().stream().findFirst().ifPresent(elements::add);
settingTable.getTaskTeardowns().stream().findFirst().ifPresent(elements::add);

return elements;
Expand All @@ -255,8 +255,8 @@ private static List<? extends AKeywordBaseSetting<?>> getKeywordBasedSettings(fi
private static List<? extends ATags<?>> getTagsSettings(final SettingTable settingTable) {
final List<ATags<?>> elements = new ArrayList<>();

settingTable.getForceTagsViews().forEach(elements::add);
settingTable.getDefaultTagsViews().forEach(elements::add);
settingTable.getForceTags().forEach(elements::add);
settingTable.getDefaultTags().forEach(elements::add);

return elements;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.robotframework.ide.eclipse.main.plugin.project.build.fix.CreateResourceFileFixer;
import org.robotframework.ide.eclipse.main.plugin.project.build.fix.DefineGlobalVariableInConfigFixer;
import org.robotframework.ide.eclipse.main.plugin.project.build.fix.JoinTemplateNameFixer;
import org.robotframework.ide.eclipse.main.plugin.project.build.fix.MetadataKeyInSameColumnFixer;
import org.robotframework.ide.eclipse.main.plugin.project.build.fix.RemoveSettingFixer;
import org.robotframework.ide.eclipse.main.plugin.project.build.fix.RemoveSettingValuesExceptFirstFixer;

Expand Down Expand Up @@ -141,28 +140,6 @@ public List<? extends IMarkerResolution> createFixers(final IMarker marker) {
return newArrayList(new RemoveSettingFixer());
}
},
DUPLICATED_SETTING_OLD {

@Override
public ProblemCategory getProblemCategory() {
return ProblemCategory.DEPRECATED_API;
}

@Override
public String getProblemDescription() {
return "Setting '%s' is duplicated. Line continuation (...) should be used instead";
}

@Override
public boolean hasResolution() {
return true;
}

@Override
public List<? extends IMarkerResolution> createFixers(final IMarker marker) {
return newArrayList(new ChangeToFixer("..."));
}
},
INVALID_NUMBER_OF_SETTING_VALUES {

@Override
Expand Down Expand Up @@ -571,28 +548,6 @@ public List<? extends IMarkerResolution> createFixers(final IMarker marker) {
return newArrayList(new RemoveSettingValuesExceptFirstFixer("Remove Test Timeout message"));
}
},
METADATA_SETTING_JOINED_WITH_KEY_IN_COLUMN_29 {

@Override
public ProblemCategory getProblemCategory() {
return ProblemCategory.DEPRECATED_API;
}

@Override
public String getProblemDescription() {
return "Setting metadata using key in first column syntax is deprecated in RF 2.9 and removed in RF 3.0";
}

@Override
public boolean hasResolution() {
return true;
}

@Override
public List<? extends IMarkerResolution> createFixers(final IMarker marker) {
return newArrayList(new MetadataKeyInSameColumnFixer());
}
},
DEPRECATED_SETTING_NAME {

@Override
Expand Down
Loading

0 comments on commit 11a4b5c

Please sign in to comment.