1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
* 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:
*
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.node;
import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestPrepareUtils.createGraphicalNode;
import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.EditorUtils.getDiagramView;
import static org.eclipse.papyrus.sysml.diagram.parametric.tests.utils.TestUtils.createNodeFromPalette;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
import org.eclipse.papyrus.sysml.diagram.parametric.tests.AbstractTest4B;
import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* JUnit tests for element creation test (via palette tools) in diagram.
*/
public class TestNodeCreationOnValueStructureCompartment extends AbstractTest4B {
public static View valueStructureView;
@BeforeClass
public static void prepareContainerForTest() throws Exception {
try {
View blockView = ViewUtil.getChildBySemanticHint(getDiagramView(), SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
View blockStructureView = ViewUtil.getChildBySemanticHint(blockView, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID);
if(blockStructureView == null) {
throw new Exception("Unable to prepare container for test.");
}
View valueView = createGraphicalNode(SysMLElementTypes.VALUE_PROPERTY, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, blockStructureView);
valueStructureView = ViewUtil.getChildBySemanticHint(valueView, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
} catch (Exception e) {
throw new Exception("Unable to prepare container for test.", e);
}
}
@Test
public void testCreationConstraintProperty() throws Exception {
createNodeFromPalette("parametric.tool.constraintblockpropertycomposite", valueStructureView, false);
}
@Test
public void testCreationConstraintParameter() throws Exception {
createNodeFromPalette("parametric.tool.parameter", valueStructureView, false);
}
@Test
public void testCreationPart() throws Exception {
createNodeFromPalette("parametric.tool.blockpropertycomposite", valueStructureView, false);
}
@Test
public void testCreationReference() throws Exception {
createNodeFromPalette("parametric.tool.reference", valueStructureView, false);
}
@Test
public void testCreationValue() throws Exception {
createNodeFromPalette("parametric.tool.value", valueStructureView, false);
}
@Test
public void testCreationComment() throws Exception {
createNodeFromPalette("parametric.tool.comment", valueStructureView, true);
}
@Test
public void testCreationConstraint() throws Exception {
createNodeFromPalette("parametric.tool.constraint", valueStructureView, false);
}
}
|