diff options
author | Martin Fluegge | 2010-12-20 16:21:16 +0000 |
---|---|---|
committer | Martin Fluegge | 2010-12-20 16:21:16 +0000 |
commit | b50c94666679652dbf059b91a0f8e3e3e5d71365 (patch) | |
tree | 345220b00a08d6c2d482d444cf145aa057ec6262 /plugins/org.eclipse.emf.cdo.dawn.tests | |
parent | 8f8dcd31143c522eda8bc7f8175860c54e505d73 (diff) | |
download | cdo-b50c94666679652dbf059b91a0f8e3e3e5d71365.tar.gz cdo-b50c94666679652dbf059b91a0f8e3e3e5d71365.tar.xz cdo-b50c94666679652dbf059b91a0f8e3e3e5d71365.zip |
[320193] [Dawn] Provide a flexible testing environment for UI tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320193
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.tests')
19 files changed, 401 insertions, 588 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/AllTestsDawnUISWTBot.launch b/plugins/org.eclipse.emf.cdo.dawn.tests/AllTestsDawnUISWTBot.launch index 0d08327e05..a363eeed28 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/AllTestsDawnUISWTBot.launch +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/AllTestsDawnUISWTBot.launch @@ -22,7 +22,7 @@ <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/> <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> -<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> +<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.dawn.tests.AllTestsDawnUISWTBot"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -clean"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.dawn.tests"/> diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnEMFTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnEMFTest.java new file mode 100644 index 0000000000..e1ab97059a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnEMFTest.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Martin Fluegge - initial API and implementation + */ +package org.eclipse.emf.cdo.dawn.tests; + +import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnEMFEditorBot; + +import org.junit.Before; + +/** + * @author Martin Fluegge + */ +public abstract class AbstractDawnEMFTest extends AbstractDawnUITest<DawnEMFEditorBot> +{ + @Override + @Before + public void setUp() throws Exception + { + super.setUp(); + } + + @Override + protected void createBot() + { + setBot(new DawnEMFEditorBot()); + } +} diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnGEFTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnGEFTest.java new file mode 100644 index 0000000000..725312746a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnGEFTest.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Martin Fluegge - initial API and implementation + */ +package org.eclipse.emf.cdo.dawn.tests; + +import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; + +import org.junit.Before; + +/** + * @author Martin Fluegge + */ +public abstract class AbstractDawnGEFTest extends AbstractDawnUITest<SWTGefBot> +{ + @Override + @Before + public void setUp() throws Exception + { + super.setUp(); + } + + @Override + protected void createBot() + { + setBot(new SWTGefBot()); + } +} diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java index 98a4759ebc..d79c976657 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java @@ -10,6 +10,7 @@ */ package org.eclipse.emf.cdo.dawn.tests; +import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput; import org.eclipse.emf.cdo.dawn.ui.helper.EditorDescriptionHelper; import org.eclipse.emf.cdo.eresource.CDOResource; @@ -19,6 +20,7 @@ import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; @@ -29,18 +31,29 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.junit.Before; + /** * @author Martin Fluegge */ -public abstract class AbstractDawnUITest extends AbstractCDOUITest// AbstractDawnTest +public abstract class AbstractDawnUITest<T extends SWTWorkbenchBot> extends AbstractCDOUITest<SWTWorkbenchBot> { @Override + @Before public void setUp() throws Exception { - SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; + super.setUp(); SWTBotPreferences.SCREENSHOTS_DIR = DawnTestPlatform.instance.getTestFolder(); resetWorkbench(); - super.setUp(); + DawnSWTBotUtil.initTest(getBot()); + getBot().viewByTitle("CDO Sessions").close(); + } + + @SuppressWarnings("unchecked") + @Override + protected T getBot() + { + return (T)super.getBot(); } /** diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java index 1e95e10e78..92104fbbbf 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java @@ -11,26 +11,62 @@ package org.eclipse.emf.cdo.dawn.tests; import org.eclipse.emf.cdo.dawn.tests.bugzillas.Bugzilla_321024_Test; +import org.eclipse.emf.cdo.dawn.tests.ui.DawnPreferencesTest; +import org.eclipse.emf.cdo.dawn.tests.ui.DawnProjectExplorerTest; +import org.eclipse.emf.cdo.dawn.tests.ui.emf.DawnEMFCreationWizardTest; +import org.eclipse.emf.cdo.dawn.tests.ui.emf.DawnEMFHandleEditorTest; +import org.eclipse.emf.cdo.dawn.tests.ui.emf.EMFEditorRollbackTest; +import org.eclipse.emf.cdo.dawn.tests.ui.gmf.ConflictTest; +import org.eclipse.emf.cdo.dawn.tests.ui.gmf.DawnCreationWizardSWTBotTest; +import org.eclipse.emf.cdo.dawn.tests.ui.gmf.MultipleResourcesTest; +import org.eclipse.emf.cdo.dawn.tests.ui.gmf.RollbackTest; +import org.eclipse.emf.cdo.dawn.tests.ui.gmf.SimpleDiagramTest; +import org.eclipse.emf.cdo.tests.AllTests; +import org.eclipse.emf.cdo.tests.config.impl.ConfigTest; +import org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; +import java.util.List; -/** - * This test suite should be executed as SWTBot test. - * - * @author Martin Fluegge - * @formatter:off - */ +import junit.framework.Test; +import junit.framework.TestSuite; -@RunWith(Suite.class) -@SuiteClasses({ - AllTestsDawnUISWTBotGMF.class, - AllTestsDawnUISWTBotEMF.class, - Bugzilla_321024_Test.class - }) - - -public class AllTestsDawnUISWTBot +public class AllTestsDawnUISWTBot extends ConfigTestSuite { + public static Test suite() + { + TestSuite testSuite = (TestSuite)new AllTestsDawnUISWTBot().getTestSuite(AllTests.class.getName()); + // testSuite.addTest(new JUnit4TestAdapter(AllTestsDawnUISWTBotGMF.class)); + return testSuite; + } + + @Override + protected void initConfigSuites(TestSuite parent) + { + addScenario(parent, COMBINED, MEM, TCP, NATIVE); + addScenario(parent, COMBINED, MEM_BRANCHES, TCP, NATIVE); + addScenario(parent, COMBINED, MEM_BRANCHES, TCP, LEGACY); + addScenario(parent, COMBINED, MEM_BRANCHES, TCP, LEGACY); + } + + @Override + protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses) + { + /******************** GMF **********************/ + testClasses.add(RollbackTest.class); + testClasses.add(DawnPreferencesTest.class); + testClasses.add(DawnCreationWizardSWTBotTest.class); + testClasses.add(SimpleDiagramTest.class); + testClasses.add(MultipleResourcesTest.class); + // MultipleResourcesDeletionTest.class, //excluded because of ui freeze + testClasses.add(DawnProjectExplorerTest.class); + testClasses.add(ConflictTest.class); + + /******************** EMF **********************/ + testClasses.add(DawnEMFCreationWizardTest.class); + testClasses.add(EMFEditorRollbackTest.class); + testClasses.add(DawnEMFHandleEditorTest.class); + + /******************** Bugzilla **********************/ + testClasses.add(Bugzilla_321024_Test.class); + } } diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotEMF.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotEMF.java index d2b2b381a9..61d00ea56b 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotEMF.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotEMF.java @@ -24,7 +24,7 @@ import org.junit.runners.Suite.SuiteClasses; * @author Martin Fluegge * @formatter:off */ - +@Deprecated @RunWith(Suite.class) @SuiteClasses({ DawnEMFCreationWizardTest.class, diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotGMF.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotGMF.java index 35d877587f..7761349463 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotGMF.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBotGMF.java @@ -29,7 +29,7 @@ import org.junit.runners.Suite.SuiteClasses; * @author Martin Fluegge * @formatter:off */ - +@Deprecated @RunWith(Suite.class) @SuiteClasses({ DawnPreferencesTest.class, diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_321024_Test.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_321024_Test.java index 0faa4f12eb..af32626948 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_321024_Test.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_321024_Test.java @@ -10,17 +10,12 @@ */ package org.eclipse.emf.cdo.dawn.tests.bugzillas; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,43 +23,20 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class Bugzilla_321024_Test extends AbstractDawnUITest +public class Bugzilla_321024_Test extends AbstractDawnGEFTest { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - } - @Test - public void createNewDawnDiagramEmptySemanticResourceName() throws Exception + public void testCreateNewDawnDiagramEmptySemanticResourceName() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); - bot.button("Finish").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("default.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("default.acore_diagram"); assertNotNull(editor); editor.close(); { diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnPreferencesTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnPreferencesTest.java index b362e01db2..bd73a9ca47 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnPreferencesTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnPreferencesTest.java @@ -11,16 +11,12 @@ package org.eclipse.emf.cdo.dawn.tests.ui; import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -28,44 +24,21 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class DawnPreferencesTest extends AbstractDawnUITest +public class DawnPreferencesTest extends AbstractDawnUITest<SWTWorkbenchBot> { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - } - @Test public void testOpenPreferencePage() throws Exception { - bot.menu("Window").menu("Preferences").click(); - SWTBotShell shell = bot.shell("Preferences"); + getBot().menu("Window").menu("Preferences").click(); + SWTBotShell shell = getBot().shell("Preferences"); shell.activate(); - bot.tree().select("Dawn Remote Preferences"); + getBot().tree().select("Dawn Remote Preferences"); - SWTBotText serverNameLabel = bot.textWithLabel("server name:"); - SWTBotText serverPortLabel = bot.textWithLabel("server port:"); - SWTBotText repositoryLabel = bot.textWithLabel("repository:"); - SWTBotText fileNameLabel = bot.textWithLabel("protocol:"); + SWTBotText serverNameLabel = getBot().textWithLabel("server name:"); + SWTBotText serverPortLabel = getBot().textWithLabel("server port:"); + SWTBotText repositoryLabel = getBot().textWithLabel("repository:"); + SWTBotText fileNameLabel = getBot().textWithLabel("protocol:"); assertEquals("localhost", serverNameLabel.getText()); assertEquals("2036", serverPortLabel.getText()); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnProjectExplorerTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnProjectExplorerTest.java index fff8400eff..0475fdbe40 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnProjectExplorerTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnProjectExplorerTest.java @@ -11,18 +11,14 @@ package org.eclipse.emf.cdo.dawn.tests.ui; import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.dawn.ui.views.DawnExplorer; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.ui.IViewPart; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,43 +26,19 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class DawnProjectExplorerTest extends AbstractDawnUITest +public class DawnProjectExplorerTest extends AbstractDawnUITest<SWTWorkbenchBot> { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - closeAllEditors(); - super.tearDown(); - } - @Test public void testOpenDawnExplorer() throws Exception { - bot.menu("Window").menu("Show View").menu("Other...").click(); + getBot().menu("Window").menu("Show View").menu("Other...").click(); - SWTBotShell shell = bot.shell("Show View"); + SWTBotShell shell = getBot().shell("Show View"); shell.activate(); - bot.tree().expandNode("Dawn").select("Dawn Explorer"); - bot.button("OK").click(); + getBot().tree().expandNode("Dawn").select("Dawn Explorer"); + getBot().button("OK").click(); - SWTBotView activeView = bot.activeView(); + SWTBotView activeView = getBot().activeView(); assertEquals("Dawn Explorer", activeView.getViewReference().getTitle()); IViewPart view = activeView.getViewReference().getView(false); assertInstanceOf(DawnExplorer.class, view); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFCreationWizardTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFCreationWizardTest.java index 958d3b74e4..34c3d9ab81 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFCreationWizardTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFCreationWizardTest.java @@ -10,9 +10,8 @@ */ package org.eclipse.emf.cdo.dawn.tests.ui.emf; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnEMFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.transaction.CDOTransaction; @@ -20,7 +19,6 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.keyboard.Keyboard; @@ -32,8 +30,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,56 +37,31 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class DawnEMFCreationWizardTest extends AbstractDawnUITest +public class DawnEMFCreationWizardTest extends AbstractDawnEMFTest { - private static SWTWorkbenchBot bot; - - // @BeforeClass - // public static void beforeClass() throws Exception - // { - // bot = new SWTGefBot(); - // DawnSWTBotUtil.initTest(bot); - // } - - @Override - @Before - public void setUp() throws Exception - { - bot = new SWTWorkbenchBot(); - DawnSWTBotUtil.initTest(bot); - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - } - @Test - public void createNewDawnAcoreEditor() throws Exception + public void testCreateNewDawnAcoreEditor() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); - bot.button("Next >").click(); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); + getBot().button("Next >").click(); + getBot().button("Next >").click(); - shell = bot.shell("New"); + shell = getBot().shell("New"); shell.activate(); - SWTBotCombo comboBox = bot.comboBox(0);// bot.ccomboBox(0); + SWTBotCombo comboBox = getBot().comboBox(0);// bot.ccomboBox(0); comboBox.setFocus(); comboBox.setSelection("ACore Root"); - bot.button("Finish").click(); + getBot().button("Finish").click(); sleep(500); - SWTBotEditor editor = bot.editorByTitle("default.acore"); + SWTBotEditor editor = getBot().editorByTitle("default.acore"); assertNotNull(editor); editor.close(); { @@ -99,61 +70,61 @@ public class DawnEMFCreationWizardTest extends AbstractDawnUITest } @Test - public void createNewDawnEditorSetName() throws Exception + public void testCreateNewDawnEditorSetName() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); + getBot().button("Next >").click(); - shell = bot.shell("New"); + shell = getBot().shell("New"); shell.activate(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); fileSemanticNameLabel.setText("test.acore"); assertEquals("test.acore", fileSemanticNameLabel.getText()); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotCombo comboBox = bot.comboBox(0);// bot.ccomboBox(0); + SWTBotCombo comboBox = getBot().comboBox(0);// bot.ccomboBox(0); comboBox.setFocus(); comboBox.setSelection("ACore Root"); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotEditor editor = bot.editorByTitle("test.acore"); + SWTBotEditor editor = getBot().editorByTitle("test.acore"); assertNotNull(editor); editor.close(); } @Test - public void createNewDawnEditorWrongResourceName() throws Exception + public void testCreateNewDawnEditorWrongResourceName() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); + getBot().button("Next >").click(); - shell = bot.shell("New"); + shell = getBot().shell("New"); shell.activate(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Keyboard keyboard = KeyboardFactory.getDefaultKeyboard(fileSemanticNameLabel.widget, null); fileSemanticNameLabel.setFocus(); fileSemanticNameLabel.typeText("x", 500); keyboard.pressShortcut(Keystrokes.BS); - assertEquals(false, bot.button("Next >").isEnabled()); - bot.button("Cancel").click(); + assertEquals(false, getBot().button("Next >").isEnabled()); + getBot().button("Cancel").click(); } @Test - public void createNewDawnEditorSelectFolder() throws Exception + public void testCreateNewDawnEditorSelectFolder() throws Exception { { CDOSession session = openSession(); @@ -165,32 +136,32 @@ public class DawnEMFCreationWizardTest extends AbstractDawnUITest transaction.commit(); } - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); + getBot().button("Next >").click(); - shell = bot.shell("New"); + shell = getBot().shell("New"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("test.acore"); - SWTBotTree tree = bot.tree(0); + SWTBotTree tree = getBot().tree(0); selectFolder(tree.getAllItems(), "folder", false); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotCombo comboBox = bot.comboBox(0);// bot.ccomboBox(0); + SWTBotCombo comboBox = getBot().comboBox(0);// bot.ccomboBox(0); comboBox.setFocus(); comboBox.setSelection("ACore Root"); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotEditor editor = bot.editorByTitle("test.acore"); + SWTBotEditor editor = getBot().editorByTitle("test.acore"); assertNotNull(editor); editor.close(); @@ -200,7 +171,7 @@ public class DawnEMFCreationWizardTest extends AbstractDawnUITest } @Test - public void createNewDawnDiagramTypeFolder() throws Exception + public void testCreateNewDawnDiagramTypeFolder() throws Exception { { CDOSession session = openSession(); @@ -212,32 +183,32 @@ public class DawnEMFCreationWizardTest extends AbstractDawnUITest transaction.commit(); } - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select(DawnAcoreTestUtil.CREATTION_WIZARD_NAME_EMF); + getBot().button("Next >").click(); - shell = bot.shell("New"); + shell = getBot().shell("New"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("test.acore"); - SWTBotText folder = bot.textWithLabel("Enter or select the parent folder: "); + SWTBotText folder = getBot().textWithLabel("Enter or select the parent folder: "); folder.setText("/folder"); SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotCombo comboBox = bot.comboBox(0);// bot.ccomboBox(0); + SWTBotCombo comboBox = getBot().comboBox(0);// bot.ccomboBox(0); comboBox.setFocus(); comboBox.setSelection("ACore Root"); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotEditor editor = bot.editorByTitle("test.acore"); + SWTBotEditor editor = getBot().editorByTitle("test.acore"); assertNotNull(editor); editor.close(); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFHandleEditorTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFHandleEditorTest.java index edc6860eef..402052d47d 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFHandleEditorTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/DawnEMFHandleEditorTest.java @@ -15,7 +15,7 @@ import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot; import org.eclipse.emf.cdo.dawn.examples.acore.AInterface; import org.eclipse.emf.cdo.dawn.examples.acore.AcoreFactory; import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnEMFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnEMFEditorBot; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotEMFEditor; @@ -32,7 +32,6 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,26 +40,17 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class DawnEMFHandleEditorTest extends AbstractDawnUITest +public class DawnEMFHandleEditorTest extends AbstractDawnEMFTest { - private static DawnEMFEditorBot bot; - @Override @Before public void setUp() throws Exception { - bot = new DawnEMFEditorBot(); - DawnSWTBotUtil.initTest(bot); + setBot(new DawnEMFEditorBot()); + DawnSWTBotUtil.initTest(getBot()); super.setUp(); } - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - } - @Test public void testOpenExistingResource() throws Exception { @@ -86,7 +76,8 @@ public class DawnEMFHandleEditorTest extends AbstractDawnUITest CDOConnectionUtil.instance.init(PreferenceConstants.getRepositoryName(), PreferenceConstants.getProtocol(), PreferenceConstants.getServerName()); CDOConnectionUtil.instance.openSession(); - DawnSWTBotEMFEditor editor = DawnAcoreTestUtil.openAcoreEMFEditor(URI.createURI("cdo://repo1/default.acore"), bot); + DawnSWTBotEMFEditor editor = DawnAcoreTestUtil.openAcoreEMFEditor(URI.createURI("cdo://repo1/default.acore"), + getBot()); assertNotNull(editor); SWTBotTree tree = editor.getSelectionPageTree(); @@ -111,7 +102,7 @@ public class DawnEMFHandleEditorTest extends AbstractDawnUITest @Test public void testCreateNewElement() throws Exception { - DawnSWTBotEMFEditor editor = DawnAcoreTestUtil.openNewAcoreEMFEditor("default.acore", bot); + DawnSWTBotEMFEditor editor = DawnAcoreTestUtil.openNewAcoreEMFEditor("default.acore", getBot()); assertNotNull(editor); SWTBotTree tree = editor.getSelectionPageTree(); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/EMFEditorRollbackTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/EMFEditorRollbackTest.java index abd487219c..36a3ebbbf9 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/EMFEditorRollbackTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/emf/EMFEditorRollbackTest.java @@ -10,15 +10,10 @@ */ package org.eclipse.emf.cdo.dawn.tests.ui.emf; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnEMFTest; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,33 +21,8 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class EMFEditorRollbackTest extends AbstractDawnUITest +public class EMFEditorRollbackTest extends AbstractDawnEMFTest { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - bot.viewByTitle("CDO Sessions").close(); - } - - @Override - @After - public void tearDown() throws Exception - { - sleep(1000); - super.tearDown(); - } - @Test public void testGMFAClassConflictMove() throws Exception { diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/ConflictTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/ConflictTest.java index 74cb010cb6..bbcc479388 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/ConflictTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/ConflictTest.java @@ -11,7 +11,7 @@ package org.eclipse.emf.cdo.dawn.tests.ui.gmf; import org.eclipse.emf.cdo.dawn.examples.acore.AClass; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.eresource.CDOResource; @@ -26,14 +26,10 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -43,41 +39,15 @@ import java.util.List; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class ConflictTest extends AbstractDawnUITest +public class ConflictTest extends AbstractDawnGEFTest { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - bot.viewByTitle("CDO Sessions").close(); - } - - @Override - @After - public void tearDown() throws Exception - { - // closeAllEditors(); - sleep(1000); - super.tearDown(); - } - @Test public void testAClassConflictMove() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.save(); editor.drag(100, 100, 200, 200); @@ -108,10 +78,10 @@ public class ConflictTest extends AbstractDawnUITest @Test public void testAClassConflictbyRemoteNameChange() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.save(); SWTBotGefEditPart swtBotGefEditPart = DawnAcoreTestUtil.getAClassEditParts(editor).get(0); @@ -153,10 +123,10 @@ public class ConflictTest extends AbstractDawnUITest @Test public void testAInterfaceConflictMove() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 100, 100, "A", getBot(), editor); editor.save(); editor.drag(100, 100, 200, 200); @@ -186,10 +156,10 @@ public class ConflictTest extends AbstractDawnUITest @Test public void testAAssociationConflict() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); List<SWTBotGefEditPart> aClassEditParts = DawnAcoreTestUtil.getAClassEditParts(editor); Node nodeA = (Node)aClassEditParts.get(0).part().getModel(); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java index 628c78ba5f..f5d83c7a86 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java @@ -10,8 +10,7 @@ */ package org.eclipse.emf.cdo.dawn.tests.ui.gmf; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.transaction.CDOTransaction; @@ -19,7 +18,6 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.keyboard.Keyboard; @@ -30,9 +28,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -40,43 +35,20 @@ import org.junit.runner.RunWith; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest +public class DawnCreationWizardSWTBotTest extends AbstractDawnGEFTest { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - super.tearDown(); - } - @Test - public void createNewDawnDiagram() throws Exception + public void testCreateNewDawnDiagram() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); - bot.button("Finish").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("default.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("default.acore_diagram"); assertNotNull(editor); editor.close(); { @@ -86,19 +58,19 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest } @Test - public void createNewDawnDiagramBothPages() throws Exception + public void testCreateNewDawnDiagramBothPages() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); - bot.button("Next >").click(); - bot.button("Finish").click(); + getBot().button("Next >").click(); + getBot().button("Next >").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("default.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("default.acore_diagram"); assertNotNull(editor); editor.close(); @@ -109,63 +81,63 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest } @Test - public void createNewDawnDiagramBothPagesSetName() throws Exception + public void testCreateNewDawnDiagramBothPagesSetName() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("test.acore_diagram"); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); assertEquals("test.acore", fileSemanticNameLabel.getText()); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("test.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("test.acore_diagram"); assertNotNull(editor); editor.close(); } @Test - public void createNewDawnDiagramBothPagesSetDifferenNames() throws Exception + public void testCreateNewDawnDiagramBothPagesSetDifferenNames() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("notational.acore_diagram"); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); assertEquals("notational.acore", fileSemanticNameLabel.getText()); - fileNameLabel = bot.textWithLabel("File name:"); + fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("semantic.acore"); - fileSemanticNameLabel = bot.textWithLabel("File name:"); + fileSemanticNameLabel = getBot().textWithLabel("File name:"); assertEquals("semantic.acore", fileSemanticNameLabel.getText()); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("notational.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("notational.acore_diagram"); assertNotNull(editor); editor.close(); @@ -176,60 +148,60 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest } @Test - public void createNewDawnDiagramEmptyNotationalResourceName() throws Exception + public void testCreateNewDawnDiagramEmptyNotationalResourceName() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText(""); Keyboard keyboard = KeyboardFactory.getDefaultKeyboard(fileNameLabel.widget, null); fileNameLabel.setFocus(); fileNameLabel.typeText("x", 500); keyboard.pressShortcut(Keystrokes.BS); - assertEquals(false, bot.button("Next >").isEnabled()); - bot.button("Cancel").click(); + assertEquals(false, getBot().button("Next >").isEnabled()); + getBot().button("Cancel").click(); } @Test - public void createNewDawnDiagramEmptySemanticResourceName() throws Exception + public void testCreateNewDawnDiagramEmptySemanticResourceName() throws Exception { - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("notational.acore_diagram"); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; Keyboard keyboard = KeyboardFactory.getDefaultKeyboard(fileSemanticNameLabel.widget, null); fileSemanticNameLabel.setFocus(); fileSemanticNameLabel.typeText("x", 500); keyboard.pressShortcut(Keystrokes.BS); - assertEquals(false, bot.button("Next >").isEnabled()); - bot.button("Cancel").click(); + assertEquals(false, getBot().button("Next >").isEnabled()); + getBot().button("Cancel").click(); } @Test - public void createNewDawnDiagramSelectFolder() throws Exception + public void testCreateNewDawnDiagramSelectFolder() throws Exception { { CDOSession session = openSession(); @@ -241,30 +213,30 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest transaction.commit(); } - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("test.acore_diagram"); - SWTBotTree tree = bot.tree(0); + SWTBotTree tree = getBot().tree(0); selectFolder(tree.getAllItems(), "folder", false); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); assertEquals("test.acore", fileSemanticNameLabel.getText()); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("test.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("test.acore_diagram"); assertNotNull(editor); editor.close(); @@ -275,7 +247,7 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest } @Test - public void createNewDawnDiagramTypeFolder() throws Exception + public void testCreateNewDawnDiagramTypeFolder() throws Exception { { CDOSession session = openSession(); @@ -287,31 +259,31 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest transaction.commit(); } - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("test.acore_diagram"); - SWTBotText folder = bot.textWithLabel("Enter or select the parent folder: "); + SWTBotText folder = getBot().textWithLabel("Enter or select the parent folder: "); folder.setText("/folder"); SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); assertEquals("test.acore", fileSemanticNameLabel.getText()); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("test.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("test.acore_diagram"); assertNotNull(editor); editor.close(); @@ -322,7 +294,7 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest } @Test - public void createNewDawnDiagramSelectDifferentFolders() throws Exception + public void testCreateNewDawnDiagramSelectDifferentFolders() throws Exception { { CDOSession session = openSession(); @@ -335,33 +307,33 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnUITest transaction.commit(); } - bot.menu("File").menu("New").menu("Other...").click(); + getBot().menu("File").menu("New").menu("Other...").click(); - SWTBotShell shell = bot.shell("New"); + SWTBotShell shell = getBot().shell("New"); shell.activate(); - bot.tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); - bot.button("Next >").click(); + getBot().tree().expandNode("Dawn Examples").select("Dawn Acore Diagram"); + getBot().button("Next >").click(); - shell = bot.shell("New Acore Diagram"); + shell = getBot().shell("New Acore Diagram"); shell.activate(); - SWTBotText fileNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileNameLabel = getBot().textWithLabel("File name:"); fileNameLabel.setText("test.acore_diagram"); - SWTBotTree tree = bot.tree(0); + SWTBotTree tree = getBot().tree(0); selectFolder(tree.getAllItems(), "folder1", false); - bot.button("Next >").click(); + getBot().button("Next >").click(); - SWTBotText fileSemanticNameLabel = bot.textWithLabel("File name:"); + SWTBotText fileSemanticNameLabel = getBot().textWithLabel("File name:"); assertEquals("test.acore", fileSemanticNameLabel.getText()); - tree = bot.tree(0); + tree = getBot().tree(0); selectFolder(tree.getAllItems(), "folder2", false); - bot.button("Finish").click(); + getBot().button("Finish").click(); - SWTBotGefEditor editor = bot.gefEditor("test.acore_diagram"); + SWTBotGefEditor editor = getBot().gefEditor("test.acore_diagram"); assertNotNull(editor); editor.close(); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesDeletionTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesDeletionTest.java index d1d03c397b..7e3ad64ea5 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesDeletionTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesDeletionTest.java @@ -11,7 +11,7 @@ package org.eclipse.emf.cdo.dawn.tests.ui.gmf; import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.eresource.CDOResource; @@ -42,7 +42,7 @@ import java.util.List; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class MultipleResourcesDeletionTest extends AbstractDawnUITest +public class MultipleResourcesDeletionTest extends AbstractDawnGEFTest { private static SWTGefBot bot; diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesTest.java index f0d6d4bef4..359b9931e2 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/MultipleResourcesTest.java @@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassAssociat import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassCompositionsEditPart; import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassImplementedInterfacesEditPart; import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassSubClassesEditPart; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.eresource.CDOResource; @@ -36,14 +36,10 @@ import org.eclipse.gmf.runtime.notation.NotationFactory; import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -54,40 +50,15 @@ import java.util.List; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class MultipleResourcesTest extends AbstractDawnUITest +public class MultipleResourcesTest extends AbstractDawnGEFTest { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - sleep(500); - closeAllEditors(); - super.tearDown(); - } - @Test public void testRemotelyRenameAClass() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.save(); @@ -95,7 +66,7 @@ public class MultipleResourcesTest extends AbstractDawnUITest CDOTransaction transaction = session.openTransaction(); CDOResource resource2 = transaction.getResource("/default.acore_diagram"); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 250, 100, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 250, 100, "B", getBot(), editor); editor.save(); @@ -121,10 +92,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testRemotelyMoveNode() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.save(); @@ -162,7 +133,7 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testCreateNodeRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); editor.save(); @@ -218,10 +189,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testAddNodeRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.save(); @@ -275,11 +246,11 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testModifyConnectionRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); List<SWTBotGefEditPart> aClassEditParts = DawnAcoreTestUtil.getAClassEditParts(editor); @@ -332,10 +303,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testCreateAssociationConnectionRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); editor.save(); { @@ -371,10 +342,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testCreateAggregationConnectionRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); editor.save(); { CDOSession session = openSession(); @@ -409,10 +380,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testCreateCompositionConnectionRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); editor.save(); { @@ -448,10 +419,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testCreateInheritanceConnectionRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); editor.save(); { @@ -487,10 +458,10 @@ public class MultipleResourcesTest extends AbstractDawnUITest @Test public void testCreateImplementsConnectionRemotely() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); - createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 200, 200, "B", getBot(), editor); editor.save(); { diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/RollbackTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/RollbackTest.java index 1942928374..3cd2accf24 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/RollbackTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/RollbackTest.java @@ -11,7 +11,7 @@ package org.eclipse.emf.cdo.dawn.tests.ui.gmf; import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.eresource.CDOResource; @@ -21,14 +21,10 @@ import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.gef.EditPart; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -38,43 +34,15 @@ import java.util.List; * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class RollbackTest extends AbstractDawnUITest +public class RollbackTest extends AbstractDawnGEFTest { - private static SWTGefBot bot; - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - bot.viewByTitle("CDO Sessions").close(); - } - - @Override - @After - public void tearDown() throws Exception - { - // closeAllEditors(); - sleep(1000); - super.tearDown(); - } - @Test public void testGMFAClassConflictMove() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.save(); editor.drag(100, 100, 200, 200); @@ -102,7 +70,7 @@ public class RollbackTest extends AbstractDawnUITest assertEquals(true, DawnAcoreTestUtil.showsConflict(classBEditpart.part())); editor.clickContextMenu("Solve Conflict"); - bot.button("yes").click(); + getBot().button("yes").click(); assertEquals(false, ((IDawnEditor)editor.getReference().getEditor(false)).getView().hasConflict()); diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/SimpleDiagramTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/SimpleDiagramTest.java index 0736cd9ac1..70bf70496c 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/SimpleDiagramTest.java +++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/SimpleDiagramTest.java @@ -16,9 +16,8 @@ import org.eclipse.emf.cdo.dawn.examples.acore.ACoreRoot; import org.eclipse.emf.cdo.dawn.examples.acore.AInterface; import org.eclipse.emf.cdo.dawn.examples.acore.AOperation; import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassEditPart; -import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest; +import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest; import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnAcoreTestUtil; -import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil; import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.view.CDOView; @@ -26,66 +25,33 @@ import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.common.util.EList; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher; import org.hamcrest.Description; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.List; -import java.util.Locale; /** * @author Martin Fluegge */ @RunWith(SWTBotJunit4ClassRunner.class) -public class SimpleDiagramTest extends AbstractDawnUITest +public class SimpleDiagramTest extends AbstractDawnGEFTest { - private static SWTGefBot bot; - - { - Locale.setDefault(Locale.US); - } - - @BeforeClass - public static void beforeClass() throws Exception - { - bot = new SWTGefBot(); - DawnSWTBotUtil.initTest(bot); - } - - @Override - @Before - public void setUp() throws Exception - { - super.setUp(); - } - - @Override - @After - public void tearDown() throws Exception - { - closeAllEditors(); - super.tearDown(); - } - @Test public void testCreateNewDawnDiagramAndAddElements() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 250, 100, "B", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 150, 250, "C", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 250, 100, "B", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 150, 250, "C", getBot(), editor); editor.saveAndClose(); @@ -117,12 +83,12 @@ public class SimpleDiagramTest extends AbstractDawnUITest @Test public void testCreateNewDawnDiagramAndAddElementsWithEdges() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 250, 100, "B", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 150, 250, "C", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 250, 100, "B", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 150, 250, "C", getBot(), editor); createEdge(DawnAcoreTestUtil.CONNECTION_IHERITS, 100, 100, 250, 100, editor); createEdge(DawnAcoreTestUtil.CONNECTION_IHERITS, 100, 100, 150, 250, editor); @@ -176,13 +142,13 @@ public class SimpleDiagramTest extends AbstractDawnUITest @Test public void testAClassWithAttributes() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.activateTool(DawnAcoreTestUtil.A_ATTRIBUTE); editor.click(100, 100); - typeTextToFocusedWidget("public foo:int", bot, true); + typeTextToFocusedWidget("public foo:int", getBot(), true); editor.save(); { @@ -215,13 +181,13 @@ public class SimpleDiagramTest extends AbstractDawnUITest @Test public void testAClassWithOperations() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); editor.activateTool(DawnAcoreTestUtil.A_OPERATION); editor.click(100, 100); - typeTextToFocusedWidget("public foo():int", bot, true); + typeTextToFocusedWidget("public foo():int", getBot(), true); editor.save(); { CDOSession session = openSession(); @@ -252,13 +218,13 @@ public class SimpleDiagramTest extends AbstractDawnUITest @Test public void testAInterfaceWithOperations() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); - createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 100, 100, "A", bot, editor); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); + createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 100, 100, "A", getBot(), editor); editor.activateTool(DawnAcoreTestUtil.A_OPERATION); editor.click(100, 100); - typeTextToFocusedWidget("public foo():int", bot, true); + typeTextToFocusedWidget("public foo():int", getBot(), true); editor.save(); { @@ -288,14 +254,14 @@ public class SimpleDiagramTest extends AbstractDawnUITest @Test public void testConnections() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 300, 100, "B", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 300, "C", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 300, 300, "D", bot, editor); - createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 200, 200, "Interface", bot, editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 100, "A", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 300, 100, "B", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 100, 300, "C", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_CLASS, 300, 300, "D", getBot(), editor); + createNodeWithLabel(DawnAcoreTestUtil.A_INTERFACE, 200, 200, "Interface", getBot(), editor); createEdge(DawnAcoreTestUtil.CONNECTION_IHERITS, 100, 100, 300, 100, editor); createEdge(DawnAcoreTestUtil.CONNECTION_ASSOCIATION, 310, 110, 310, 310, editor); @@ -358,7 +324,7 @@ public class SimpleDiagramTest extends AbstractDawnUITest @Test public void testExceptionOnClose() throws Exception { - SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", bot); + SWTBotGefEditor editor = DawnAcoreTestUtil.openNewAcoreGMFEditor("default.acore_diagram", getBot()); assertNotNull(editor); editor.close(); } |