Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2014-07-21 10:41:51 -0400
committerVincent Lorenzo2014-07-21 10:41:51 -0400
commitca773032c60138a39138d0566a925a4c0796cf10 (patch)
tree7ed9dc45a8ef79f7cb5cb6ed5cb793150711ec81
parentee7471b78ae63be0ef5143fd59737fb54510961d (diff)
downloadorg.eclipse.papyrus-ca773032c60138a39138d0566a925a4c0796cf10.tar.gz
org.eclipse.papyrus-ca773032c60138a39138d0566a925a4c0796cf10.tar.xz
org.eclipse.papyrus-ca773032c60138a39138d0566a925a4c0796cf10.zip
Fix table requirements tests
-rw-r--r--tests/junit/extraplugins/table/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF6
-rw-r--r--tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF2
-rwxr-xr-xtests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/RevealRequirementTableTest.java93
-rw-r--r--tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java31
4 files changed, 83 insertions, 49 deletions
diff --git a/tests/junit/extraplugins/table/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/table/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF
index ff15b488496..da3afa8b243 100644
--- a/tests/junit/extraplugins/table/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/extraplugins/table/org.eclipse.papyrus.infra.nattable.tests/META-INF/MANIFEST.MF
@@ -15,9 +15,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.nattable.model;bundle-version="0.10.2",
org.eclipse.papyrus.infra.nattable;bundle-version="0.10.2",
org.eclipse.nebula.widgets.nattable.core,
- org.eclipse.papyrus.infra.core.log,
- org.eclipse.papyrus.infra.gmfdiag.common,
- org.eclipse.papyrus.uml.tools
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.2",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.2",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.2"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF
index c4a558a2137..6c1ef5a28f5 100644
--- a/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/META-INF/MANIFEST.MF
@@ -22,7 +22,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.core;bundle-version="0.10.2",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.2",
org.eclipse.nebula.widgets.nattable.core,
- org.eclipse.papyrus.infra.widgets
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.2"
Export-Package: org.eclipse.papyrus.sysml.nattable.requirement.tests,
org.eclipse.papyrus.sysml.nattable.requirement.tests.tests
Bundle-Vendor: %Bundle-Vendor
diff --git a/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/RevealRequirementTableTest.java b/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/RevealRequirementTableTest.java
index 2405cd49b32..629ad4300c9 100755
--- a/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/RevealRequirementTableTest.java
+++ b/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/RevealRequirementTableTest.java
@@ -15,6 +15,7 @@
package org.eclipse.papyrus.sysml.nattable.requirement.tests.tests;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -90,38 +91,38 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
for(Resource current : resources) {
if(current.getURI().lastSegment().equals("revealSemanticModel.uml")) {
- uml = current;
+ this.uml = current;
} else if(current.getURI().lastSegment().equals("revealSemanticModel.notation")) {
- notation = current;
+ this.notation = current;
} else if(current.getURI().lastSegment().equals("revealSemanticModel.di")) {
- di = current;
+ this.di = current;
}
}
- rootModel = (Model)uml.getContents().get(0);
- root = notation.getContents();
+ this.rootModel = (Model)this.uml.getContents().get(0);
+ this.root = this.notation.getContents();
//TODO on luna : open diagram
}
@Test
public void test1SelectElement() {
- diagramTest = root.get(0);
+ this.diagramTest = this.root.get(0);
selectTablePage(3);
- INattableModelManager manager = (INattableModelManager)editor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager)this.editor.getAdapter(INattableModelManager.class);
if(manager.getTable().isInvertAxis()) {
manager.invertAxis();
}
- if(editor.getActiveEditor() instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(diagramTest));
+ if(this.editor.getActiveEditor() instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)this.editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(this.diagramTest));
ISelectionService serv = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final ISelection selection = serv.getSelection();
if(selection instanceof IStructuredSelection) {
Object currentAxisObject = ((IStructuredSelection)selection).getFirstElement();
Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject);
- Assert.assertTrue("failed to match the selection with: " + diagramTest, diagramTest.equals(currentRealObject));
+ Assert.assertTrue("failed to match the selection with: " + this.diagramTest, this.diagramTest.equals(currentRealObject));
SelectionLayer layer = manager.getBodyLayerStack().getSelectionLayer();
int[] rowSelectedPositions = layer.getFullySelectedRowPositions();
@@ -135,22 +136,22 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
@Test
public void test2SelectElementInvertAxis() {
- diagramTest = root.get(0);
+ this.diagramTest = this.root.get(0);
selectTablePage(3);
- INattableModelManager manager = (INattableModelManager)editor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager)this.editor.getAdapter(INattableModelManager.class);
if(!manager.getTable().isInvertAxis()) {
manager.invertAxis();
}
- if(editor.getActiveEditor() instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(diagramTest));
+ if(this.editor.getActiveEditor() instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)this.editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(this.diagramTest));
ISelectionService serv = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final ISelection selection = serv.getSelection();
if(selection instanceof IStructuredSelection) {
Object currentAxisObject = ((IStructuredSelection)selection).getFirstElement();
Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject);
- Assert.assertTrue("failed to match the selection with: " + diagramTest, diagramTest.equals(currentRealObject));
+ Assert.assertTrue("failed to match the selection with: " + this.diagramTest, this.diagramTest.equals(currentRealObject));
SelectionLayer layer = manager.getBodyLayerStack().getSelectionLayer();
int[] rowSelectedPositions = layer.getFullySelectedRowPositions();
@@ -164,22 +165,22 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
@Test
public void test3SelectElement() {
- classTest = (Class)rootModel.allOwnedElements().get(4);
+ this.classTest = (Class)this.rootModel.allOwnedElements().get(4);
selectTablePage(4);
- INattableModelManager manager = (INattableModelManager)editor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager)this.editor.getAdapter(INattableModelManager.class);
if(manager.getTable().isInvertAxis()) {
manager.invertAxis();
}
- if(editor.getActiveEditor() instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(classTest));
+ if(this.editor.getActiveEditor() instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)this.editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(this.classTest));
ISelectionService serv = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final ISelection selection = serv.getSelection();
if(selection instanceof IStructuredSelection) {
Object currentAxisObject = ((IStructuredSelection)selection).getFirstElement();
Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject);
- Assert.assertTrue("failed to match the selection with: " + classTest, classTest.equals(currentRealObject));
+ Assert.assertTrue("failed to match the selection with: " + this.classTest, this.classTest.equals(currentRealObject));
SelectionLayer layer = manager.getBodyLayerStack().getSelectionLayer();
int[] rowSelectedPositions = layer.getFullySelectedRowPositions();
@@ -193,22 +194,22 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
@Test
public void test4SelectElementInvertAxis() {
- classTest = (Class)rootModel.allOwnedElements().get(4);
+ this.classTest = (Class)this.rootModel.allOwnedElements().get(4);
selectTablePage(4);
- INattableModelManager manager = (INattableModelManager)editor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager)this.editor.getAdapter(INattableModelManager.class);
if(!manager.getTable().isInvertAxis()) {
manager.invertAxis();
}
- if(editor.getActiveEditor() instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(classTest));
+ if(this.editor.getActiveEditor() instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)this.editor.getActiveEditor()).revealSemanticElement(Collections.singletonList(this.classTest));
ISelectionService serv = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final ISelection selection = serv.getSelection();
if(selection instanceof IStructuredSelection) {
Object currentAxisObject = ((IStructuredSelection)selection).getFirstElement();
Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject);
- Assert.assertTrue("failed to match the selection with: " + classTest, classTest.equals(currentRealObject));
+ Assert.assertTrue("failed to match the selection with: " + this.classTest, this.classTest.equals(currentRealObject));
SelectionLayer layer = manager.getBodyLayerStack().getSelectionLayer();
int[] rowSelectedPositions = layer.getFullySelectedRowPositions();
@@ -222,17 +223,22 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
@Test
public void test5SelectMultipleElements() {
- elementListTest = rootModel.allOwnedElements().get(2).getOwnedElements();
-
+ this.elementListTest = this.rootModel.allOwnedElements().get(2).getOwnedElements();
+ List<Object> columns = new ArrayList<Object>();
selectTablePage(4);
- INattableModelManager manager = (INattableModelManager)editor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager)this.editor.getAdapter(INattableModelManager.class);
if(manager.getTable().isInvertAxis()) {
manager.invertAxis();
}
- if(editor.getActiveEditor() instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)editor.getActiveEditor()).revealSemanticElement(elementListTest);
+ for(Object current : manager.getColumnElementsList()) {
+ Object currentRealObject = AxisUtils.getRepresentedElement(current);
+ columns.add(currentRealObject);
+ }
+
+ if(this.editor.getActiveEditor() instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)this.editor.getActiveEditor()).revealSemanticElement(this.elementListTest);
ISelectionService serv = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final ISelection selection = serv.getSelection();
if(selection instanceof IStructuredSelection) {
@@ -240,7 +246,11 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
for(int index = 0; index < selectedRowElements.size(); index++) {
Object currentAxisObject = selectedRowElements.get(index);
Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject);
- Assert.assertTrue("failed to match the selection", elementListTest.contains(currentRealObject));
+ if(currentRealObject instanceof Class) {
+ Assert.assertTrue("failed to match the selection", this.elementListTest.contains(currentRealObject));
+ } else {
+ Assert.assertTrue(columns.contains(currentRealObject));
+ }
}
SelectionLayer layer = manager.getBodyLayerStack().getSelectionLayer();
@@ -262,17 +272,22 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
@Test
public void test6SelectMultipleElementsInvertAxis() {
- elementListTest = rootModel.allOwnedElements().get(2).getOwnedElements();
-
+ this.elementListTest = this.rootModel.allOwnedElements().get(2).getOwnedElements();
+ List<Object> rows = new ArrayList<Object>();
selectTablePage(4);
- INattableModelManager manager = (INattableModelManager)editor.getAdapter(INattableModelManager.class);
+ INattableModelManager manager = (INattableModelManager)this.editor.getAdapter(INattableModelManager.class);
+
if(!manager.getTable().isInvertAxis()) {
manager.invertAxis();
}
+ for(Object current : manager.getRowElementsList()) {
+ Object currentRealObject = AxisUtils.getRepresentedElement(current);
+ rows.add(currentRealObject);
+ }
- if(editor.getActiveEditor() instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)editor.getActiveEditor()).revealSemanticElement(elementListTest);
+ if(this.editor.getActiveEditor() instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)this.editor.getActiveEditor()).revealSemanticElement(this.elementListTest);
ISelectionService serv = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final ISelection selection = serv.getSelection();
if(selection instanceof IStructuredSelection) {
@@ -280,7 +295,11 @@ public class RevealRequirementTableTest extends AbstractEditorTest {
for(int index = 0; index < selectedRowElements.size(); index++) {
Object currentAxisObject = selectedRowElements.get(index);
Object currentRealObject = AxisUtils.getRepresentedElement(currentAxisObject);
- Assert.assertTrue("failed to match the selection", elementListTest.contains(currentRealObject));
+ if(currentRealObject instanceof Class) {
+ Assert.assertTrue("failed to match the selection", this.elementListTest.contains(currentRealObject));
+ } else {
+ Assert.assertTrue(rows.contains(currentRealObject));
+ }
}
SelectionLayer layer = manager.getBodyLayerStack().getSelectionLayer();
diff --git a/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java b/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java
index f19b501ac65..98250e8c7cd 100644
--- a/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java
+++ b/tests/junit/extraplugins/table/org.eclipse.papyrus.sysml.nattable.requirement.tests/src/org/eclipse/papyrus/sysml/nattable/requirement/tests/tests/TableCreationInSysMLModelTest.java
@@ -20,7 +20,6 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RunnableWithResult;
@@ -171,7 +170,9 @@ public class TableCreationInSysMLModelTest {
public void testCreationAndDestructionOnRootModel() {
Object result = ModelExplorerUtils.executeCreateNestedEditorHandlerInModelExplorer(papyrusEditor, TableCreationInSysMLModelTest.view, AllTests.COMMAND_ID, TableCreationInSysMLModelTest.rootModel, BUNDLE_ID);
//to refresh the table content
- while(Display.getDefault().readAndDispatch());
+ while(Display.getDefault().readAndDispatch()) {
+ ;
+ }
Assert.assertTrue(result instanceof NatTableEditor);
NatTableEditor editor = (NatTableEditor)result;
NattableModelManager manager = (NattableModelManager)editor.getAdapter(INattableModelManager.class);
@@ -204,7 +205,9 @@ public class TableCreationInSysMLModelTest {
Assert.assertNotNull(requirement);
requirement3 = (Class)requirement;
//to refresh the table content
- while(Display.getDefault().readAndDispatch());
+ while(Display.getDefault().readAndDispatch()) {
+ ;
+ }
managedAxis = rowAxisManager.getAllManagedAxis();
Assert.assertEquals(3, managedAxis.size());
Assert.assertTrue(managedAxis.contains(requirement1));
@@ -226,7 +229,9 @@ public class TableCreationInSysMLModelTest {
Assert.assertNull(requirement);
requirement3 = (Class)requirement;
//to refresh the table content
- while(Display.getDefault().readAndDispatch());
+ while(Display.getDefault().readAndDispatch()) {
+ ;
+ }
managedAxis = rowAxisManager.getAllManagedAxis();
Assert.assertEquals(2, managedAxis.size());
Assert.assertTrue(managedAxis.contains(requirement1));
@@ -241,7 +246,9 @@ public class TableCreationInSysMLModelTest {
public void testCreationAndDestructionOnRequirement() {
Object result = ModelExplorerUtils.executeCreateNestedEditorHandlerInModelExplorer(papyrusEditor, TableCreationInSysMLModelTest.view, AllTests.COMMAND_ID, TableCreationInSysMLModelTest.requirement1, BUNDLE_ID);
//to refresh the table content
- while(Display.getDefault().readAndDispatch());
+ while(Display.getDefault().readAndDispatch()) {
+ ;
+ }
Assert.assertTrue(result instanceof NatTableEditor);
NatTableEditor editor = (NatTableEditor)result;
NattableModelManager manager = (NattableModelManager)editor.getAdapter(INattableModelManager.class);
@@ -270,12 +277,18 @@ public class TableCreationInSysMLModelTest {
Assert.assertTrue(creationCommand.canExecute());
domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(creationCommand));
- NamedElement requirement = TableCreationInSysMLModelTest.requirement1.getMember("Requirement1"); //$NON-NLS-1$
+ while(Display.getDefault().readAndDispatch()) {
+
+ }
+ NamedElement requirement = TableCreationInSysMLModelTest.requirement1.getMember("Requirement"); //$NON-NLS-1$
+
Assert.assertNotNull(requirement);
nestedRequirement3 = (Class)requirement;
//to refresh the table content
- while(Display.getDefault().readAndDispatch());
+ while(Display.getDefault().readAndDispatch()) {
+ ;
+ }
managedAxis = rowAxisManager.getAllManagedAxis();
Assert.assertEquals(3, managedAxis.size());
Assert.assertTrue(managedAxis.contains(nestedRequirement1));
@@ -298,7 +311,9 @@ public class TableCreationInSysMLModelTest {
nestedRequirement3 = (Class)requirement;
//to refresh the table content
- while(Display.getDefault().readAndDispatch());
+ while(Display.getDefault().readAndDispatch()) {
+ ;
+ }
managedAxis = rowAxisManager.getAllManagedAxis();
Assert.assertEquals(2, managedAxis.size());

Back to the top