Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3c7ccb513037386c958b767afb0934a28bc3765b (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
/*****************************************************************************
 * 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.link.connector;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.sysml.diagram.parametric.tests.creation.link.AbstractLinkCreationFromElementTest4CB;
import org.eclipse.uml2.uml.Property;
import org.junit.BeforeClass;

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

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

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

	@BeforeClass
	public static void initExpectedResults() throws Exception {

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

		isCreationAllowed.put(diagramContainerTargetView, false);

		isCreationAllowed.put(constraintPropertyTargetView, false);
		isCreationAllowed.put(constraintParameterTargetView, true);
		isCreationAllowed.put(nestedConstraintPropertyTargetView, false);
		isCreationAllowed.put(nestedConstraintParameterTargetView, true);
		
		isCreationAllowed.put(partTargetView, false);
		isCreationAllowed.put(nestedPartTargetView, false);
		isCreationAllowed.put(subNestedPartContainer1_1_1TargetView, false);
		isCreationAllowed.put(subNestedPartContainer1_2_1TargetView, false);
		isCreationAllowed.put(subNestedPartContainer1_1_2TargetView, false);

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

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

		isCreationAllowed.put(commentTargetView, false);
		isCreationAllowed.put(commentCNTargetView, false);
		isCreationAllowed.put(constraintTargetView, false);
		isCreationAllowed.put(constraintCNTargetView, false);

		// Initialize nested property path for tests
		expectedSourceNestedPath = new HashMap<View, List<Property>>();
		expectedTargetNestedPath = new HashMap<View, List<Property>>();

		List<Property> emptyPath = Collections.emptyList();
		for(View view : isCreationAllowed.keySet()) {
			expectedSourceNestedPath.put(view, emptyPath);
			expectedTargetNestedPath.put(view, emptyPath);
		}
		
		List<Property> nestedPath = Arrays.asList(new Property[]{ (Property)constraintPropertyTargetView.getElement() });
		expectedTargetNestedPath.put(constraintParameterTargetView, nestedPath);
		nestedPath = Arrays.asList(new Property[]{ (Property)partContainer2.getElement(),  (Property)nestedConstraintPropertyTargetView.getElement()});
		expectedTargetNestedPath.put(nestedConstraintParameterTargetView, nestedPath);
	}

}

Back to the top