Skip to content

Commit

Permalink
Merge pull request dsldevkit#839 from joaodinissf/remove-xtext-depend…
Browse files Browse the repository at this point in the history
…encies

Remove Xtext dependency in cat.ddk.test.core plugin
  • Loading branch information
joaodinissf authored Nov 13, 2023
2 parents a355534 + 45b539b commit 995574e
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Collections;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
Expand All @@ -43,8 +43,8 @@
import com.avaloq.tools.ddk.check.ui.util.CheckResourceUtil;
import com.avaloq.tools.ddk.check.ui.wizard.Messages;
import com.avaloq.tools.ddk.test.core.BugTest;
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner;
import com.avaloq.tools.ddk.test.ui.swtbot.SwtWizardBot;
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner;
import com.google.inject.Inject;
import com.google.inject.Provider;

Expand All @@ -53,7 +53,7 @@
* The CheckProjectWizardTestBackup tests the Check Project Wizard.
*/
@InjectWith(CheckWizardUiTestInjectorProvider.class)
@RunWith(ClassRunner.class)
@RunWith(XtextClassRunner.class)
public class CheckCatalogWizardTest {

/** This is the name of the catalog wizard. It's the name SWTBot uses to look up the wizard. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
import com.avaloq.tools.ddk.check.ui.test.util.CheckWizardTestUtil;
import com.avaloq.tools.ddk.check.ui.wizard.Messages;
import com.avaloq.tools.ddk.test.core.BugTest;
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner;
import com.avaloq.tools.ddk.test.ui.swtbot.SwtWizardBot;
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner;


/**
* The CheckProjectWizardTest tests the Check Project Wizard.
*/
@InjectWith(CheckWizardUiTestInjectorProvider.class)
@RunWith(ClassRunner.class)
@RunWith(XtextClassRunner.class)
public class CheckProjectWizardTest {

/** This is the name of the project wizard. It's the name SWTBot uses to look up the wizard. */
Expand Down
6 changes: 0 additions & 6 deletions com.avaloq.tools.ddk.test.core/.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
Expand All @@ -44,7 +39,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
Expand Down
4 changes: 1 addition & 3 deletions com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.xtext.testing,
org.hamcrest.library,
org.junit,
org.mockito,
com.google.guava,
org.apache.commons.lang,
org.eclipse.emf.common,
org.eclipse.xtext.testing;visibility:=reexport
org.eclipse.emf.common
Export-Package: com.avaloq.tools.ddk.test.core,
com.avaloq.tools.ddk.test.core.data,
com.avaloq.tools.ddk.test.core.junit.runners,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.xtext.testing.XtextRunner;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
Expand All @@ -32,6 +31,7 @@
import org.junit.runner.manipulation.NoTestsRemainException;
import org.junit.runner.manipulation.Sorter;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.ParentRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
Expand All @@ -55,7 +55,7 @@


/**
* A JUnit runner extending the {@link XtextRunner} with support for @BeforeAll and @AfterAll annotated methods. These methods will be run once for a
* A JUnit runner extending the {@link BlockJUnit4ClassRunner} with support for @BeforeAll and @AfterAll annotated methods. These methods will be run once for a
* given test class before the first test method and after the last test method respectively.
* <p>
* <h1>Test Methods</h1> Considered are all those methods of the test class that are annotated with one (or more) of the following test annotations:
Expand Down Expand Up @@ -91,7 +91,7 @@
* </p>
*/
@SuppressWarnings({"restriction", "deprecation"})
public class ClassRunner extends XtextRunner {
public class ClassRunner extends BlockJUnit4ClassRunner {
/** The system property for the number of test runs. */
public static final String PROPERTY_TEST_RUNS = "com.avaloq.test.runs"; //$NON-NLS-1$
/** The system property for the number of times a failing test shall be retried. */
Expand Down
6 changes: 0 additions & 6 deletions com.avaloq.tools.ddk.test.ui.test/.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
Expand All @@ -44,7 +39,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
Expand Down
6 changes: 0 additions & 6 deletions com.avaloq.tools.ddk.test.ui/.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
Expand All @@ -44,7 +39,6 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
Expand Down
1 change: 0 additions & 1 deletion com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Require-Bundle: com.avaloq.tools.ddk.test.core,
org.eclipse.swtbot.eclipse.finder;visibility:=reexport,
org.eclipse.swtbot.junit4_x,
org.eclipse.swtbot.swt.finder,
org.eclipse.xtext.testing,
org.eclipse.ui;visibility:=reexport,
org.hamcrest.library,
org.junit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
import com.avaloq.tools.ddk.test.core.BugTestAwareRule;
import com.avaloq.tools.ddk.test.core.IssueAwareRule;
import com.avaloq.tools.ddk.test.core.LoggingRule;
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner;
import com.avaloq.tools.ddk.test.core.mock.ExtensionRegistryMock;
import com.avaloq.tools.ddk.test.core.mock.ServiceMock;
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner;
import com.google.common.collect.ImmutableList;


/**
* Provides a test class specific custom test framework for tests that run in the ACF environment.
* All exceptions are wrapped and handed over to the JUnit framework.
*/
@RunWith(ClassRunner.class)
@RunWith(XtextClassRunner.class)
public abstract class AbstractTest {

/**
Expand Down Expand Up @@ -298,8 +298,8 @@ private void addSourcesToWorkspace(final List<String> sourceFileNames) {
new WorkspaceModifyOperation() {
@Override
protected void execute(final IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
for (int i = 0; i < sourceFileNames.size(); i++) {
addSourceToWorkspace(sourceFileNames.get(i));
for (String sourceFileName : sourceFileNames) {
addSourceToWorkspace(sourceFileName);
}
}
}.run(new NullProgressMonitor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.asyncExec;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
Expand All @@ -30,10 +30,10 @@
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;

import com.avaloq.tools.ddk.test.ui.junit.runners.SwtBotRecordingTestRunner;
import com.avaloq.tools.ddk.test.ui.swtbot.SwtWorkbenchBot;
import com.avaloq.tools.ddk.test.ui.swtbot.util.SwtBotUtil;
import com.avaloq.tools.ddk.xtext.test.AbstractTest;
import com.avaloq.tools.ddk.xtext.test.junit.runners.SwtBotRecordingXtextTestRunner;
import com.avaloq.tools.ddk.xtext.ui.util.UiAssert;


Expand All @@ -45,7 +45,7 @@
* ID.<br>
* Provides {@link #closeEditor(IEditorPart, boolean)} for closing the running editor instance.
*/
@RunWith(SwtBotRecordingTestRunner.class)
@RunWith(SwtBotRecordingXtextTestRunner.class)
public abstract class AbstractUiTest extends AbstractTest {

/** Class-wide logger. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

import org.junit.runner.RunWith;

import com.avaloq.tools.ddk.test.ui.junit.runners.SwtBotRecordingTestRunner;
import com.avaloq.tools.ddk.test.ui.swtbot.SwtWorkbenchBot;
import com.avaloq.tools.ddk.test.ui.swtbot.util.SwtBotUtil;
import com.avaloq.tools.ddk.xtext.test.junit.runners.SwtBotRecordingXtextTestRunner;


/**
* AbstractXtextEditorUITest extends AbstractXtextEditorTest by providing SWT bot functionalities.
*/
@RunWith(SwtBotRecordingTestRunner.class)
@RunWith(SwtBotRecordingXtextTestRunner.class)
public abstract class AbstractXtextEditorUiTest extends AbstractXtextEditorTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.eclipse.xtext.ui.editor.GlobalURIEditorOpener;
import org.junit.runner.RunWith;

import com.avaloq.tools.ddk.test.ui.junit.runners.SwtBotRecordingTestRunner;
import com.avaloq.tools.ddk.test.ui.swtbot.SwtWorkbenchBot;
import com.avaloq.tools.ddk.test.ui.swtbot.util.SwtBotUtil;
import com.avaloq.tools.ddk.xtext.test.AbstractXtextTest;
import com.avaloq.tools.ddk.xtext.test.junit.runners.SwtBotRecordingXtextTestRunner;
import com.avaloq.tools.ddk.xtext.ui.util.UiAssert;


Expand All @@ -37,7 +37,7 @@
* ID.<br>
* Provides {@link #closeEditor(IEditorPart, boolean)} for closing the running editor instance.
*/
@RunWith(SwtBotRecordingTestRunner.class)
@RunWith(SwtBotRecordingXtextTestRunner.class)
public abstract class AbstractXtextUiTest extends AbstractXtextTest {

private static final long EDITOR_ENABLED_TIMEOUT = 30000L;
Expand Down
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.xtext.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Require-Bundle: com.avaloq.tools.ddk.xtext,
org.eclipse.pde.core,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtext.junit4,
org.eclipse.emf.ecore
org.eclipse.emf.ecore,
org.slf4j.ext
Import-Package: org.apache.log4j,
com.avaloq.tools.ddk.check.runtime.test.core,
com.avaloq.tools.ddk.check.test.core,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.junit.runner.RunWith;

import com.avaloq.tools.ddk.test.core.BugTest;
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner;
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner;


@RunWith(ClassRunner.class)
@RunWith(XtextClassRunner.class)
@SuppressWarnings("PMD.JUnitAssertionsShouldIncludeMessage")
// CHECKSTYLE:CONSTANTS-OFF
public class QualifiedNamePatternTest {
Expand Down
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.xtext.ui.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.xtext.ui,
org.mockito,
com.avaloq.tools.ddk.xtext.ui,
com.avaloq.tools.ddk.test.core,
org.eclipse.ui.ide
org.eclipse.ui.ide,
com.avaloq.tools.ddk.xtext.test.core
Export-Package: com.avaloq.tools.ddk.xtext.ui.test
Automatic-Module-Name: com.avaloq.tools.ddk.xtext.ui.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

import com.avaloq.tools.ddk.test.core.AfterAll;
import com.avaloq.tools.ddk.test.core.BeforeAll;
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner;
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner;
import com.google.common.collect.Iterables;
import com.google.inject.Guice;


@RunWith(ClassRunner.class)
@RunWith(XtextClassRunner.class)
public class ResourceNameTemplateVariableResolverTest {

private static final Object[] FILE = new Object[] {"file"}; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

import com.avaloq.tools.ddk.test.core.AfterAll;
import com.avaloq.tools.ddk.test.core.BeforeAll;
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner;
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner;
import com.google.inject.Guice;


@RunWith(ClassRunner.class)
@RunWith(XtextClassRunner.class)
public class SimpleEnumTemplateVariableResolverTest {

private static XtextTemplateContext mockContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package com.avaloq.tools.ddk.xtext.ui.templates

import com.avaloq.tools.ddk.test.core.AfterAll
import com.avaloq.tools.ddk.test.core.BeforeAll
import com.avaloq.tools.ddk.test.core.junit.runners.ClassRunner
import com.avaloq.tools.ddk.xtext.test.junit.runners.XtextClassRunner
import com.google.inject.Guice
import org.eclipse.jface.text.IDocument
import org.eclipse.jface.text.IRegion
Expand All @@ -33,7 +33,7 @@ import static org.mockito.Mockito.spy
import static org.mockito.Mockito.verify
import static org.mockito.Mockito.when

@RunWith(ClassRunner)
@RunWith(XtextClassRunner)
class TemplateProposalProviderHelperTest {

static val SIMPLE_ENUM_VARIABLE_TYPE = new SimpleEnumTemplateVariableResolver().type
Expand Down

0 comments on commit 995574e

Please sign in to comment.