blob: 47de67d9202d32ee8dbca8a6504338083e1ed372 (
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
|
/*****************************************************************************
* Copyright (c) 2013 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:
* Nizar GUEDIDI (CEA LIST) - Initial API and implementation
/*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.deployment.test.load;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.deployment.test.IDeploymentDiagramTestsConstants;
import org.eclipse.papyrus.uml.diagram.deployment.test.canonical.AbstractPapyrusTestCase;
import org.junit.Test;
/**
* The Class Load10NodeTest.
*/
public class Load10NodeTest extends AbstractPapyrusTestCase {
@Override
protected String getProjectName() {
return IDeploymentDiagramTestsConstants.PROJECT_NAME;
}
@Override
protected String getFileName() {
return IDeploymentDiagramTestsConstants.FILE_NAME;
}
/**
* Test to create a node.
*
* @param type
* the type
*/
public void testToCreateANode(IElementType type) {
CreateViewRequest requestcreation = CreateViewRequestFactory.getCreateShapeRequest(type, getDiagramEditPart().getDiagramPreferencesHint());
Command command = getDiagramEditPart().getCommand(requestcreation);
assertNotNull("CREATION: creation command null", command);
assertTrue("CREATION: test if the command is created", command != UnexecutableCommand.INSTANCE);
assertTrue("CREATION: test if the command can be executed", command.canExecute() == true);
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
}
/**
* Test load10 node.
*/
@Test
public void testLoad10Node() {
for(int i = 0; i < 10; i++) {
testToCreateANode(UMLElementTypes.Node_2008);
}
}
}
|