Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2011-08-09 15:45:56 +0000
committerMartin Fluegge2011-08-09 15:45:56 +0000
commit6da925d59e1d48ac6200308c1951cc33132042a2 (patch)
treef873bc1ac786d85b8ce16845c97240f5ec66894a /plugins/org.eclipse.emf.cdo.dawn.tests
parentc897ef8db9fe36446d579a761896273208ac67f2 (diff)
downloadcdo-6da925d59e1d48ac6200308c1951cc33132042a2.tar.gz
cdo-6da925d59e1d48ac6200308c1951cc33132042a2.tar.xz
cdo-6da925d59e1d48ac6200308c1951cc33132042a2.zip
[332902] [Dawn] Decouple Dawn Runtime from integrated frameworks
https://bugs.eclipse.org/bugs/show_bug.cgi?id=332902
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.tests')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/TCPConfigStarter.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnCodeGenGMFFragmentTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnWrapperResourceTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/GMFTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/TestFrameworkTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnCodeGenerationTest.java205
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnAcoreTestUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnCodeGenerationTestUtil.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnSWTBotUtil.java105
12 files changed, 353 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF
index b09563ab73..366f315815 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF
@@ -9,11 +9,11 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.gmf;bundle-version="[1.2.0,2.0.0)",
org.eclipse.gmf.runtime.notation;bundle-version="[1.4.0,2.0.0)",
org.eclipse.emf.cdo.dawn.examples.acore;bundle-version="[0.2.0,1.0.1)",
- org.eclipse.emf.cdo.dawn;bundle-version="[0.2.0,1.0.1)",
+ org.eclipse.emf.cdo.dawn;bundle-version="[2.0.0,3.0.0)",
org.eclipse.emf.transaction;bundle-version="[1.4.0,2.0.0)",
org.eclipse.emf.workspace;bundle-version="[1.4.0,2.0.0)",
org.eclipse.gmf.runtime.emf.core;bundle-version="[1.4.0,2.0.0)",
- org.eclipse.emf.cdo.dawn.ui;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.emf.cdo.dawn.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.cdo.ui;bundle-version="4.0.0",
org.eclipse.emf.cdo.dawn.util;bundle-version="[1.0.0,2.0.0)",
@@ -34,7 +34,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.cdo.dawn.examples.acore.editor;bundle-version="[1.0.0,2.0.0)",
org.eclipse.emf.cdo.dawn.examples.acore.diagram;bundle-version="[1.0.0,2.0.0)",
org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.gmf.ui;bundle-version="1.0.0",
- org.eclipse.emf.ecoretools.diagram;bundle-version="[0.10.0,2.0.0)"
+ org.eclipse.emf.ecoretools.diagram;bundle-version="[0.10.0,2.0.0)",
+ org.eclipse.emf.cdo.dawn.emf;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.emf.cdo.dawn.gmf;bundle-version="[2.0.0,3.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
@@ -46,6 +48,5 @@ Export-Package: org.eclipse.emf.cdo.dawn.tests;version="1.0.0";x-internal:=true,
org.eclipse.emf.cdo.dawn.tests.ui.emf;version="1.0.0";x-internal:=true,
org.eclipse.emf.cdo.dawn.tests.ui.gmf;version="1.0.0";x-internal:=true,
org.eclipse.emf.cdo.dawn.tests.ui.util;version="1.0.0";x-internal:=true
-Import-Package: org.antlr.runtime;version="3.0.0",
- org.eclipse.emf.cdo.dawn.examples.acore.provider;version="[0.2.0,1.0.1)"
+Import-Package: org.antlr.runtime;version="3.0.0"
Bundle-Localization: plugin
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 9c53603072..ec91c4e080 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
@@ -54,6 +54,9 @@ public class AllTestsDawnUISWTBot extends ConfigTestSuite
@Override
protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
{
+ /******************** General **********************/
+ // testClasses.add(DawnCodeGenerationTest.class);
+
/******************** GMF **********************/
testClasses.add(DawnPreferencesTest.class);
testClasses.add(DawnCreationWizardSWTBotTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/TCPConfigStarter.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/TCPConfigStarter.java
index 9116bf5edd..6704ed47b9 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/TCPConfigStarter.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/TCPConfigStarter.java
@@ -31,14 +31,14 @@ public class TCPConfigStarter extends AllConfigs
}
@Override
- protected void initConfigSuites(TestSuite parent)
+ protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
{
- addScenario(parent, COMBINED, MEM_BRANCHES, TCP, NATIVE);
+ testClasses.add(InitialTest.class);
}
@Override
- protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses, IScenario scenario)
+ protected void initConfigSuites(TestSuite parent)
{
- testClasses.add(InitialTest.class);
+ addScenario(parent, COMBINED, MEM_BRANCHES, TCP, NATIVE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnCodeGenGMFFragmentTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnCodeGenGMFFragmentTest.java
index 1899df4058..0732c172db 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnCodeGenGMFFragmentTest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnCodeGenGMFFragmentTest.java
@@ -52,7 +52,7 @@ public class DawnCodeGenGMFFragmentTest extends AbstractDawnTest
String outputFolder = DawnTestPlatform.instance.getTestFolder();
String diagramFolder = ouputFolder + "/" + "src/org/eclipse/emf/cdo/dawn/examples/acore/diagram";
- assertEquals(true, new File(outputFolder + "/META-INF/Manifest.MF").exists());
+ assertEquals(true, new File(outputFolder + "/META-INF/MANIFEST.MF").exists());
assertEquals(true, new File(outputFolder + "/fragment.xml").exists());
assertEquals(true, new File(outputFolder + "/build.properties").exists());
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnWrapperResourceTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnWrapperResourceTest.java
index d427a2209c..e23e785b16 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnWrapperResourceTest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/DawnWrapperResourceTest.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.dawn.tests.common;
import org.eclipse.emf.cdo.dawn.resources.DawnWrapperResource;
import org.eclipse.emf.cdo.dawn.tests.AbstractDawnTest;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
@@ -24,6 +25,7 @@ import java.util.Collections;
/**
* @author Martin Fluegge
*/
+@CleanRepositoriesBefore
public class DawnWrapperResourceTest extends AbstractDawnTest
{
public void testPostEventTransactionHandler() throws Exception
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/GMFTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/GMFTest.java
index 834e8811c8..ddcadfffdf 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/GMFTest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/GMFTest.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.dawn.examples.acore.AcorePackage;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.cdo.tests.mango.MangoValue;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -41,6 +42,7 @@ import java.util.List;
/**
* @author Martin Fluegge
*/
+@CleanRepositoriesBefore
public class GMFTest extends AbstractCDOTest
{
public void testDiagram() throws Exception
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/TestFrameworkTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/TestFrameworkTest.java
index f0f7b831ba..adf7f7118b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/TestFrameworkTest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/common/TestFrameworkTest.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.dawn.resources.DawnWrapperResource;
import org.eclipse.emf.cdo.dawn.tests.AbstractDawnTest;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
@@ -29,6 +30,7 @@ import org.eclipse.gmf.runtime.notation.Diagram;
*
* @author Martin Fluegge
*/
+@CleanRepositoriesBefore
public class TestFrameworkTest extends AbstractDawnTest
{
public void testResourceCreation() throws CommitException
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnCodeGenerationTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnCodeGenerationTest.java
new file mode 100644
index 0000000000..bb12daf724
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/DawnCodeGenerationTest.java
@@ -0,0 +1,205 @@
+/**
+ * Copyright (c) 2004 - 2011 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.ui;
+
+import org.eclipse.emf.cdo.dawn.tests.AbstractDawnUITest;
+import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnCodeGenerationTestUtil;
+import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnSWTBotUtil;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+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;
+
+/**
+ * @author Martin Fluegge
+ */
+@CleanRepositoriesBefore
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class DawnCodeGenerationTest extends AbstractDawnUITest<SWTWorkbenchBot>
+{
+ private SWTBotView packageExplorer;
+
+ @Override
+ @Before
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ prepare();
+ }
+
+ @Override
+ @After
+ public void tearDown() throws Exception
+ {
+ cleanup();
+ super.tearDown();
+ }
+
+ private void cleanup()
+ {
+ deleteProject("org.eclipse.emf.cdo.dawn.examples.acore");
+ }
+
+ @Test
+ public void testCodeGenerationGMF() throws Exception
+ {
+ SWTBotView packageExplorer = DawnSWTBotUtil.openView(getBot(), "Java", "Package Explorer");
+ packageExplorer.setFocus();
+
+ SWTBotTreeItem modelFolder = getBot().tree().expandNode("org.eclipse.emf.cdo.dawn.examples.acore", "model");
+
+ SWTBotTreeItem gmfgen = modelFolder.expandNode("acore.gmfgen");
+ gmfgen.contextMenu("Generate Dawn GenModel").click();
+
+ sleep(5000);
+
+ assertNotNull(modelFolder.getNode("acore.dawngenmodel"));
+ SWTBotTreeItem dawngenmodel_gmf = modelFolder.getNode("acore.dawngenmodel_gmf");
+ assertNotNull(dawngenmodel_gmf);
+
+ dawngenmodel_gmf.contextMenu("Generate Dawn GMF Fragment").click();
+
+ sleep(10000);
+
+ IProject fragment = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject("org.eclipse.emf.cdo.dawn.examples.acore.diagram.dawn");
+
+ assertNotNull(fragment);
+ String diagramFolder = "src/org/eclipse/emf/cdo/dawn/examples/acore/diagram";
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, "META-INF/MANIFEST.MF"));
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, "/fragment.xml"));
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, "/build.properties"));
+
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/edit/parts/DawnAcoreEditPartFactory.java"));
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/edit/parts/DawnACoreRootEditPart.java"));
+ assertEquals(
+ true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder
+ + "/edit/policies/DawnACoreRootCanonicalEditPolicy.java"));
+
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/part/DawnAcoreCreationWizard.java"));
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/part/DawnAcoreDiagramEditor.java"));
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/part/DawnAcoreDiagramEditorUtil.java"));
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/part/DawnAcoreDocumentProvider.java"));
+
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/providers/DawnAcoreEditPartProvider.java"));
+ assertEquals(true,
+ DawnCodeGenerationTestUtil.exists(fragment, diagramFolder + "/providers/DawnAcoreEditPolicyProvider.java"));
+ deleteProject("org.eclipse.emf.cdo.dawn.examples.acore.diagram.dawn");
+ sleep(2000);
+ }
+
+ @Test
+ public void testCodeGenerationEMF() throws Exception
+ {
+ packageExplorer = DawnSWTBotUtil.openView(getBot(), "Java", "Package Explorer");
+ packageExplorer.setFocus();
+
+ SWTBotTreeItem modelFolder = getBot().tree().expandNode("org.eclipse.emf.cdo.dawn.examples.acore", "model");
+
+ SWTBotTreeItem gmfgen = modelFolder.expandNode("acore.genmodel");
+ gmfgen.contextMenu("Generate Dawn GenModel").click();
+
+ IProject rootProject = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject("org.eclipse.emf.cdo.dawn.examples.acore");
+
+ waitUntilExists(rootProject, "model/acore.dawngenmodel", 10000);
+
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(rootProject, "model/acore.dawngenmodel_emf"));
+
+ modelFolder.setFocus();
+ SWTBotTreeItem dawngenmodel_emf = modelFolder.getNode("acore.dawngenmodel_emf");
+
+ assertNotNull(dawngenmodel_emf);
+
+ dawngenmodel_emf.contextMenu("Generate Dawn EMF Fragment").click();
+
+ sleep(10000);
+
+ assertNotNull(modelFolder.getNode("acore.dawngenmodel"));
+ assertNotNull(modelFolder.getNode("acore.dawngenmodel_emf"));
+
+ IProject fragment = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject("org.eclipse.emf.cdo.dawn.examples.acore.editor.dawn");
+
+ assertNotNull(fragment);
+
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, "META-INF/MANIFEST.MF"));
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, "/fragment.xml"));
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, "/build.properties"));
+
+ String folder = "src/org/eclipse/emf/cdo/dawn/examples/acore/presentation/";
+
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, folder + "DawnAcoreEditor.java"));
+ assertEquals(true, DawnCodeGenerationTestUtil.exists(fragment, folder + "DawnAcoreModelWizard.java"));
+ deleteProject("org.eclipse.emf.cdo.dawn.examples.acore.editor.dawn");
+ sleep(2000);
+ }
+
+ private void waitUntilExists(IProject project, String path, int timeout)
+ {
+ while (timeout > 0)
+ {
+ if (DawnCodeGenerationTestUtil.exists(project, "model/acore.dawngenmodel"))
+ {
+ return;
+ }
+ sleep(1000);
+ timeout -= 1000;
+ }
+ throw new RuntimeException("Could not find " + path + " within " + timeout + " ms.");
+ }
+
+ private SWTWorkbenchBot prepare()
+ {
+ SWTWorkbenchBot bot = getBot();
+
+ SWTBotView pluginsView = DawnSWTBotUtil.openView(bot, "Plug-in Development", "Plug-ins");
+
+ pluginsView.setFocus();
+
+ final SWTBotTree tree = bot.tree();
+ final SWTBotTree plugin = tree.select("org.eclipse.emf.cdo.dawn.examples.acore (1.0.0.qualifier)");
+
+ DawnSWTBotUtil.findContextMenu(plugin, "Import As", "Source Project").click();
+
+ // wait here until the import has finished
+ sleep(10000);
+ return bot;
+ }
+
+ private void deleteProject(String projectName)
+ {
+ SWTWorkbenchBot bot = getBot();
+ SWTBotTreeItem project = bot.tree().expandNode(projectName);
+ project.contextMenu("Delete").click();
+ bot.shell("Delete Resources").activate();
+ bot.checkBox().select();
+ bot.button("OK").click();
+ sleep(2000);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnAcoreTestUtil.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnAcoreTestUtil.java
index 8ff353e986..c2c34b8027 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnAcoreTestUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnAcoreTestUtil.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.dawn.tests.ui.util;
-import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer;
import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassAggregationsEditPart;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassAssociationsEditPart;
@@ -22,6 +21,7 @@ import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AInterfaceEdit
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.part.AcoreVisualIDRegistry;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.providers.AcoreElementTypes;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.providers.AcoreViewProvider;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput;
import org.eclipse.emf.cdo.dawn.ui.helper.EditorDescriptionHelper;
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnCodeGenerationTestUtil.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnCodeGenerationTestUtil.java
new file mode 100644
index 0000000000..d655544478
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnCodeGenerationTestUtil.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2004 - 2011 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.ui.util;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnCodeGenerationTestUtil
+{
+ public static boolean exists(IProject project, String path)
+ {
+ return project.getFile(path).exists();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java
index b0da13495b..088044a0cf 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java
@@ -10,9 +10,9 @@
*/
package org.eclipse.emf.cdo.dawn.tests.ui.util;
-import org.eclipse.emf.cdo.dawn.appearance.DawnAppearancer;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassEditPart;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AInterfaceEditPart;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput;
import org.eclipse.emf.cdo.dawn.ui.helper.EditorDescriptionHelper;
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnSWTBotUtil.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnSWTBotUtil.java
index d5b70e0480..baa8b4f225 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnSWTBotUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnSWTBotUtil.java
@@ -10,9 +10,13 @@
*/
package org.eclipse.emf.cdo.dawn.tests.ui.util;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.instanceOf;
+
import org.eclipse.emf.cdo.dawn.examples.acore.AClass;
import org.eclipse.emf.cdo.dawn.examples.acore.diagram.edit.parts.AClassEditPart;
-import org.eclipse.emf.cdo.dawn.synchronize.DawnConflictHelper;
+import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnConflictHelper;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -33,18 +37,30 @@ import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefConnectionEditPart;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.hamcrest.Description;
+import org.hamcrest.Matcher;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -52,6 +68,14 @@ import java.util.List;
*/
public class DawnSWTBotUtil
{
+ private static final String LABEL_OK = "OK";
+
+ private static final String LABEL_OTHERS = "Other...";
+
+ private static final String LABEL_WINDOW = "Window";
+
+ private static final String LABEL_SHOW_VIEW = "Show View";
+
public static void initTest(SWTWorkbenchBot bot)
{
closeWelcomePage(bot);
@@ -73,7 +97,7 @@ public class DawnSWTBotUtil
public static void setConnectorType(SWTWorkbenchBot bot, String serverName, String serverPort, String repository,
String protocol)
{
- bot.menu("Window").menu("Preferences").click();
+ bot.menu(LABEL_WINDOW).menu("Preferences").click();
SWTBotShell shell = bot.shell("Preferences");
shell.activate();
@@ -88,7 +112,7 @@ public class DawnSWTBotUtil
serverPortLabel.setText(serverPort);
repositoryLabel.setText(repository);
fileNameLabel.setText(protocol);
- bot.button("OK").click();
+ bot.button(LABEL_OK).click();
}
public static List<SWTBotGefEditPart> getAllEditParts(SWTBotGefEditor editor)
@@ -277,6 +301,81 @@ public class DawnSWTBotUtil
return ret;
}
+ public static SWTBotView openView(SWTWorkbenchBot bot, String categoryName, String viewName)
+ {
+ bot.menu(LABEL_WINDOW).menu(LABEL_SHOW_VIEW).menu(LABEL_OTHERS).click();
+
+ SWTBotShell shell = bot.shell(LABEL_SHOW_VIEW);
+ shell.activate();
+ bot.tree().expandNode(categoryName).select(viewName);
+ bot.button(LABEL_OK).click();
+
+ return bot.activeView();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static SWTBotMenu findContextMenu(final AbstractSWTBot<?> bot, final String... texts)
+ {
+ final Matcher<?>[] matchers = new Matcher<?>[texts.length];
+ for (int i = 0; i < texts.length; i++)
+ {
+ matchers[i] = allOf(instanceOf(MenuItem.class), withMnemonic(texts[i]));
+ }
+
+ final MenuItem menuItem = UIThreadRunnable.syncExec(new WidgetResult<MenuItem>()
+ {
+ public MenuItem run()
+ {
+ MenuItem menuItem = null;
+ Control control = (Control)bot.widget;
+ Menu menu = control.getMenu();
+ for (int i = 0; i < matchers.length; i++)
+ {
+ menuItem = show(menu, matchers[i]);
+ if (menuItem != null)
+ {
+ menu = menuItem.getMenu();
+ }
+ }
+
+ return menuItem;
+ }
+ });
+ if (menuItem == null)
+ {
+ throw new WidgetNotFoundException("Could not find menu: " + Arrays.asList(texts));
+ }
+
+ return new SWTBotMenu(menuItem);
+ }
+
+ private static MenuItem show(final Menu menu, final Matcher<?> matcher)
+ {
+ if (menu != null)
+ {
+ menu.notifyListeners(SWT.Show, new Event());
+ MenuItem[] items = menu.getItems();
+ for (final MenuItem menuItem : items)
+ {
+ if (matcher.matches(menuItem))
+ {
+ return menuItem;
+ }
+ }
+ menu.notifyListeners(SWT.Hide, new Event());
+ }
+ return null;
+ }
+
+ public static void setAutomaticBuild(SWTWorkbenchBot bot, boolean enabled)
+ {
+ SWTBotMenu menu = bot.menu("Project").menu("Build Automatically");
+ // if(menu.isEnabled()&&enabled)
+ {
+ menu.click();
+ }
+ }
+
// public static Edge createEdgeRemote(Node source, Node target, String type)
// {
// Edge newEdge = ViewService.createEdge(source, target, type, PreferencesHint.USE_DEFAULTS);

Back to the top