Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcdumoulin2013-01-31 16:03:45 +0000
committercdumoulin2013-01-31 16:03:45 +0000
commitab5a926eb16a5192b06a6495499871897687da0b (patch)
tree103a8a23e38c3ebb617bbf34dc1effda0fc11399
parentbaf2917a159543f1f12eee61809f8f93b1de36cc (diff)
downloadorg.eclipse.papyrus-ab5a926eb16a5192b06a6495499871897687da0b.tar.gz
org.eclipse.papyrus-ab5a926eb16a5192b06a6495499871897687da0b.tar.xz
org.eclipse.papyrus-ab5a926eb16a5192b06a6495499871897687da0b.zip
ASSIGNED - bug 399062: [core.tests] oep.infra.core.tests induce dependency cycle
https://bugs.eclipse.org/bugs/show_bug.cgi?id=399062 move tests for wizards to a dedicated plugin
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java8
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateModelWizard.java96
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateSysMLModelWizard.java59
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestInitModelWizard.java96
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewModelWizardBase.java85
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewProjectWizard.java33
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewSysMLProjectWizard.java44
8 files changed, 1 insertions, 425 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF
index f1a3724c148..d25599a16cb 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/META-INF/MANIFEST.MF
@@ -1,10 +1,7 @@
Manifest-Version: 1.0
Require-Bundle: org.junit4;bundle-version="4.0.0",
org.eclipse.uml2.uml;bundle-version="3.1.0",
- org.eclipse.papyrus.uml.diagram.wizards;bundle-version="0.10.0",
- org.eclipse.papyrus.uml.diagram.profile;bundle-version="0.10.0",
- org.eclipse.papyrus.sysml.diagram.ui;bundle-version="0.10.0",
- org.eclipse.papyrus.sysml.diagram.common;bundle-version="0.10.0"
+ org.eclipse.papyrus.uml.diagram.profile;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.infra.core.lifecycleevents,
org.eclipse.papyrus.infra.core.resource,
org.eclipse.papyrus.infra.core.services,
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java
index 6cc97b2d108..48d27dfc803 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/tests/AllTests.java
@@ -16,11 +16,6 @@ import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResourceTe
import org.eclipse.papyrus.infra.core.resource.ModelSetTest;
import org.eclipse.papyrus.infra.core.services.ComposedServiceTest;
import org.eclipse.papyrus.infra.core.services.ServicesRegistryTest;
-import org.eclipse.papyrus.infra.core.wizard.TestCreateModelWizard;
-import org.eclipse.papyrus.infra.core.wizard.TestCreateSysMLModelWizard;
-import org.eclipse.papyrus.infra.core.wizard.TestInitModelWizard;
-import org.eclipse.papyrus.infra.core.wizard.TestNewProjectWizard;
-import org.eclipse.papyrus.infra.core.wizard.TestNewSysMLProjectWizard;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -35,9 +30,6 @@ ModelSetTest.class, AbstractModelWithSharedResourceTest.class,
ComposedServiceTest.class, ServicesRegistryTest.class,
// {oep}.core.lifecycleevents
/* SaveAndDirtyServiceTest.class, */LifeCycleEventsProviderTest.class,
-//{oep.wizard}
-TestCreateModelWizard.class, TestCreateSysMLModelWizard.class, TestInitModelWizard.class, TestNewProjectWizard.class, TestNewSysMLProjectWizard.class
-
})
/**
* Suite Class for all tests in the plugin
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateModelWizard.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateModelWizard.java
deleted file mode 100644
index a1258a9ebec..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateModelWizard.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.papyrus.infra.core.wizard;
-
-import org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand;
-import org.eclipse.papyrus.uml.diagram.wizards.InitModelWizard;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.ui.IWorkbenchWizard;
-
-
-public class TestCreateModelWizard extends TestNewModelWizardBase {
-
- @Override
- protected IWorkbenchWizard createWizard() {
- return new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return false;
- }
-
- };
- }
-
- public void testOrderOfPages() {
- Class[] expectedPages = new Class[]{ NewModelFilePage.class, SelectDiagramCategoryPage.class, SelectDiagramKindPage.class, };
-
- IWorkbenchWizard wizard = initWizardDialog();
- testOrderOfPages(wizard, expectedPages);
- }
-
- public void testDiagramFileExtentionLabel() {
- final String expectedExtension = "test.xxx";
- IWorkbenchWizard wizard = new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return false;
- }
-
- @Override
- protected String getDiagramFileExtension(String categoryId, String defaultExtension) {
- return expectedExtension;
- }
-
- };
-
- initWizardDialog(wizard);
- NewModelFilePage page = (NewModelFilePage)wizard.getPages()[0];
- //assertEquals(expectedExtension, page.getFileExtension());
- }
-
-
- public void testDiagramFileExtenstionForProfile() {
- final String expectedExtension = "profile.di";
- InitModelWizard wizard = new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return false;
- }
-
- @Override
- protected String[] getDiagramCategoryIds() {
- return new String[]{CreateProfileModelCommand.COMMAND_ID};
- }
-
- };
-
- initWizardDialog(wizard);
-// String actual = wizard.getDiagramFileExtension();
-// assertEquals(expectedExtension, actual);
- }
-
- public void testDiagramFileExtenstionForUML() {
- final String expectedExtension = "di";
- InitModelWizard wizard = new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return false;
- }
-
- @Override
- protected String[] getDiagramCategoryIds() {
- return new String[]{"uml"};
- }
-
- };
-
- initWizardDialog(wizard);
-// String actual = wizard.getDiagramFileExtension();
-// assertEquals(expectedExtension, actual);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateSysMLModelWizard.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateSysMLModelWizard.java
deleted file mode 100644
index 6e725ae60bb..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestCreateSysMLModelWizard.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.papyrus.infra.core.wizard;
-
-import org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand;
-import org.eclipse.papyrus.sysml.diagram.ui.NewSysMLModelWizard;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.ui.IWorkbenchWizard;
-
-
-public class TestCreateSysMLModelWizard extends TestNewModelWizardBase {
-
- @Override
- protected IWorkbenchWizard createWizard() {
- return new NewSysMLModelWizard() {
-
- };
- }
-
- public void testOrderOfPages() {
- Class[] expectedPages = new Class[]{
- NewModelFilePage.class,
- SelectDiagramKindPage.class,
- };
-
- IWorkbenchWizard wizard = initWizardDialog();
- testOrderOfPages(wizard, expectedPages);
- }
-
- public void testDiagramCategory() {
- class NewSysMLModelWizardWithPublicAccess extends NewSysMLModelWizard {
- // open access to protected method
- @Override
- public String[] getDiagramCategoryIds() {
- return super.getDiagramCategoryIds();
- }
- }
-
- NewSysMLModelWizardWithPublicAccess wizard = new NewSysMLModelWizardWithPublicAccess();
- initWizardDialog(wizard);
- String actualCategory = wizard.getDiagramCategoryIds()[0];
- assertEquals(CreateSysMLModelCommand.COMMAND_ID, actualCategory);
- }
-
- public void testDiagramFileExtenstion() {
- final String expectedExtension = "di";
- NewSysMLModelWizard wizard = new NewSysMLModelWizard() {
- @Override
- protected String[] getDiagramCategoryIds() {
- return new String[]{CreateSysMLModelCommand.COMMAND_ID};
- }
-
- };
-
- initWizardDialog(wizard);
-// String actual = wizard.getDiagramFileExtension();
-// assertEquals(expectedExtension, actual);
- }
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestInitModelWizard.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestInitModelWizard.java
deleted file mode 100644
index cae45f9f654..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestInitModelWizard.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.papyrus.infra.core.wizard;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand;
-import org.eclipse.papyrus.uml.diagram.wizards.InitModelWizard;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRootElementPage;
-import org.eclipse.ui.IWorkbenchWizard;
-
-
-public class TestInitModelWizard extends TestNewModelWizardBase {
-
- private final boolean isCreateFromExistingModel = true;
-
- @Override
- protected IWorkbenchWizard createWizard() {
- return new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return true;
- }
-
- @Override
- protected String getDiagramFileName(IFile domainModel) {
- return "test.uml";
- }
-
- };
- }
-
- public void testDiagramFileExtentionLabel() {
- final String expectedExtension = "test.xxx";
- IWorkbenchWizard wizard = new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return isCreateFromExistingModel;
- }
-
- @Override
- public String getDiagramFileExtension(String diagramCategoryId) {
- return expectedExtension;
- }
-
- @Override
- protected String getDiagramFileName(IFile domainModel) {
- return "tanya"; // arbitrary extension to avoid NPE
- }
-
- };
-
- initWizardDialog(wizard);
- NewModelFilePage page = (NewModelFilePage)wizard.getPages()[0];
- assertEquals(expectedExtension, page.getFileExtension());
- }
-
-
- public void testOrderOfPages() {
- Class[] expectedPages = new Class[]{ NewModelFilePage.class, SelectDiagramCategoryPage.class, SelectDiagramKindPage.class, SelectRootElementPage.class, };
-
- IWorkbenchWizard wizard = initWizardDialog();
- testOrderOfPages(wizard, expectedPages);
- }
-
- public void testDiagramFileExtenstionForUML() {
- // 333849 - [Wizard] Init Diagram: Respect file extension of the UML model
- final String expectedExtension = "di";
- InitModelWizard wizard = new InitModelWizard() {
-
- @Override
- protected boolean isCreateFromExistingDomainModel() {
- return isCreateFromExistingModel;
- }
-
- @Override
- protected String getDiagramFileName(IFile domainModel) {
- return "tanya"; // arbitrary extension to avoid NPE
- }
-
- @Override
- protected String[] getDiagramCategoryIds() {
- return new String[]{ CreateProfileModelCommand.COMMAND_ID };
- }
-
- };
-
- initWizardDialog(wizard);
- // String actual = wizard.getDiagramFileExtension();
- // assertEquals(expectedExtension, actual);
- }
-
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewModelWizardBase.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewModelWizardBase.java
deleted file mode 100644
index d900b68e156..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewModelWizardBase.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.papyrus.infra.core.wizard;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jface.layout.PixelConverter;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.uml.diagram.wizards.Activator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWizard;
-import org.junit.Before;
-
-
-public abstract class TestNewModelWizardBase extends TestCase {
-
- protected static final IStructuredSelection EMPTY_SELECTION = new StructuredSelection();
-
- protected abstract IWorkbenchWizard createWizard();
-
- @Override
- @Before
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected IStructuredSelection getSelection() {
- return EMPTY_SELECTION;
- }
-
- protected IWorkbenchWizard initWizardDialog() {
- IWorkbenchWizard wizard = createWizard();
- initWizardDialog(wizard);
- return wizard;
- }
-
- protected IWorkbenchWizard initWizardDialog(final IWorkbenchWizard wizard) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- wizard.init(getWorkbench(), getSelection());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
- dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
- dialog.create();
- }
- });
-
- return wizard;
- }
-
- protected Shell getShell() {
- return getWorkbench().getActiveWorkbenchWindow().getShell();
- }
-
- protected IWorkbench getWorkbench() {
- return Activator.getDefault().getWorkbench();
- }
-
- protected void testOrderOfPages(IWorkbenchWizard wizard, Class[] expectedPages) {
- IWizardPage next = wizard.getPages()[0];
- for(int i = 0; i < expectedPages.length; i++) {
- String isNullMessageFormat = "page %s expected, but actual is: null";
- assertNotNull(String.format(isNullMessageFormat, i), next);
-
- testPageInstanceOf(next, expectedPages[i], i);
-
- next = next.getNextPage();
- }
- String noMorePagesExpectedMessageFormat = "page %s is not expected";
- assertNull(String.format(noMorePagesExpectedMessageFormat, next), next);
-
- }
-
- protected void testPageInstanceOf(IWizardPage next, Class expectedClass, int index) {
- String wrongClassFormat = "page %s expected to be SelectRootElementPage, but actual is: %s";
- assertTrue(String.format(wrongClassFormat, index, next.getClass()), expectedClass.isInstance(next));
- }
-
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewProjectWizard.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewProjectWizard.java
deleted file mode 100644
index ef0437e1bf0..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewProjectWizard.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.papyrus.infra.core.wizard;
-
-import org.eclipse.papyrus.uml.diagram.wizards.NewPapyrusProjectWizard;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.ui.IWorkbenchWizard;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-
-public class TestNewProjectWizard extends TestNewModelWizardBase {
-
-
- protected IWorkbenchWizard createWizard() {
- return new NewPapyrusProjectWizard();
- }
-
- public void testOrderOfPages() {
-
- Class[] expectedPages = new Class[]{
- WizardNewProjectCreationPage.class,
- SelectDiagramCategoryPage.class,
- SelectDiagramKindPage.class,
- };
-
- IWorkbenchWizard wizard = initWizardDialog();
- testOrderOfPages(wizard, expectedPages);
- }
-
- public void testProfileExtension() {
- }
-
-
-}
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewSysMLProjectWizard.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewSysMLProjectWizard.java
deleted file mode 100644
index 099d62e0db5..00000000000
--- a/tests/junit/plugins/core/org.eclipse.papyrus.infra.core.tests/test/org/eclipse/papyrus/infra/core/wizard/TestNewSysMLProjectWizard.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.papyrus.infra.core.wizard;
-
-import org.eclipse.papyrus.sysml.diagram.common.commands.CreateSysMLModelCommand;
-import org.eclipse.papyrus.sysml.diagram.ui.NewSysMLProjectWizard;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.ui.IWorkbenchWizard;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-
-public class TestNewSysMLProjectWizard extends TestNewModelWizardBase {
-
-
- @Override
- protected IWorkbenchWizard createWizard() {
- return new NewSysMLProjectWizard();
- }
-
- public void testOrderOfPages() {
-
- Class[] expectedPages = new Class[]{
- WizardNewProjectCreationPage.class,
- SelectDiagramKindPage.class,
- };
-
- IWorkbenchWizard wizard = initWizardDialog();
- testOrderOfPages(wizard, expectedPages);
- }
-
- public void testDiagramCategory() {
- class NewSysMLProjectWizardWithPublicAccess extends NewSysMLProjectWizard {
- // open access to protected method
- @Override
- public String[] getDiagramCategoryIds() {
- return new String[]{CreateSysMLModelCommand.COMMAND_ID};
- }
- }
-
- NewSysMLProjectWizardWithPublicAccess wizard = new NewSysMLProjectWizardWithPublicAccess();
- initWizardDialog(wizard);
- String actualCategory = wizard.getDiagramCategoryIds()[0];
- assertEquals(CreateSysMLModelCommand.COMMAND_ID, actualCategory);
- }
-
-}

Back to the top