Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9f12d238a42453a0ccc11e93a0da352da932f9bc (plain) (blame)
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
86
87
88
89
90
91
92
93
94
95
96
/*****************************************************************************
 * 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.internalblock.tests.creation.link.connector.delegation;

import java.util.HashMap;

import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.uml2.uml.ConnectableElement;
import org.eclipse.uml2.uml.Property;
import org.junit.BeforeClass;

/**
 * JUnit tests for Connector link creation test (via palette tools).
 */
public class TestCreationAndTestDelegateFromPortOnPart extends AbstractConnectorCreationAndTestDelegateFromElementTest {

	@BeforeClass
	public static void initSource() throws Exception {
		sourceView = port1_Part1SourceView;
	}

	@BeforeClass
	public static void initToolID() throws Exception {
		toolID = "internalblock.tool.connector";
	}

	@BeforeClass
	public static void initExpectedResults() throws Exception {

		// Initialize source creation results
		isCreationAllowed = new HashMap<View, Boolean>();

		isCreationAllowed.put(blockTargetView, false);

		isCreationAllowed.put(actorPart2_BlockTargetView, true);
		isCreationAllowed.put(actorPart2_p1TargetView, true);

		isCreationAllowed.put(portOnBlockTargetView, true);
		isCreationAllowed.put(port1_Part2TargetView, true);
		isCreationAllowed.put(port2OnNestedPart2_Part1TargetView, true);

		isCreationAllowed.put(flowportOnBlockTargetView, true);
		isCreationAllowed.put(flowport1_Part2TargetView, true);
		isCreationAllowed.put(flowport1_NestedPart2_Part1TargetView, true);

		isCreationAllowed.put(partTargetView, true);
		isCreationAllowed.put(nestedPart2_Part1TargetView, true);

		isCreationAllowed.put(propertyTargetView, true);
		isCreationAllowed.put(nestedPropertyTargetView, true);

		isCreationAllowed.put(referenceTargetView, true);
		isCreationAllowed.put(nestedReferenceTargetView, true);

		isCreationAllowed.put(valueTargetView, true);
		isCreationAllowed.put(nestedValueTargetView, true);

		// Initialize partWithPort for tests
		Property part1 = (Property)p1View.getElement();
		Property part2 = (Property)p2View.getElement();
		Property nestedPart2 = (Property)p2_p1View.getElement();

		expectedSourcePartWithPort = new HashMap<View, ConnectableElement>();
		expectedTargetPartWithPort = new HashMap<View, ConnectableElement>();

		for (View view : isCreationAllowed.keySet()) {
			expectedSourcePartWithPort.put(view, part1);
		}
		
		expectedSourcePartWithPort.remove(port2OnNestedPart2_Part1TargetView);
		expectedSourcePartWithPort.remove(flowport1_NestedPart2_Part1TargetView);
		expectedSourcePartWithPort.remove(actorPart2_p1TargetView);
		expectedSourcePartWithPort.remove(nestedPart2_Part1TargetView);
		expectedSourcePartWithPort.remove(nestedPropertyTargetView);
		expectedSourcePartWithPort.remove(nestedReferenceTargetView);
		expectedSourcePartWithPort.remove(nestedValueTargetView);
		
		expectedTargetPartWithPort.put(port1_Part2TargetView, part2);
		expectedTargetPartWithPort.put(flowport1_Part2TargetView, part2);
		
		expectedTargetPartWithPort.put(port2OnNestedPart2_Part1TargetView, nestedPart2);
		expectedTargetPartWithPort.put(flowport1_NestedPart2_Part1TargetView, nestedPart2);
	}

}

Back to the top