blob: 3e87090dbeda04b5e10a5c594f1988c241603438 (
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
97
98
|
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
*
* 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:
* Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.layers.stackmodel.layers.util;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.layers.Layer;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersStack;
import org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication;
import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
import org.eclipse.papyrus.layers.stackmodel.layers.TopLayerOperator;
import org.eclipse.papyrus.layers.stackmodel.layers.util.LayersFactoryTestUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Test utility to create tree of layers..
*
* @author cedric dumoulin
*
*/
public class LayerFactoryTestUtilsTest {
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
/**
* Test creation of a tree of layers.
*/
@Test
public void testCreateTreeImpl() {
// Create requested objects
LayersStackApplication application = LayersFactory.eINSTANCE.createLayersStackApplication();
PropertyRegistry propertyRegistry = application.getPropertyRegistry();
Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
// Create stack
LayersStack stack = application.getLayersStackFor(diagram);
// Create layers
LayersFactoryTestUtils factory = new LayersFactoryTestUtils(application);
factory.newTopLayer("top",
factory.newLayer("layer1"),
factory.newLayer("layer2"),
factory.newTopLayer("container1",
factory.newLayer("layer3") )
);
TopLayerOperator top = (TopLayerOperator)factory.getLayer("top");
TopLayerOperator container1 = (TopLayerOperator)factory.getLayer("top");
Layer layer1 = (Layer)factory.getLayer("layer1");
Layer layer2 = (Layer)factory.getLayer("layer1");
Layer layer3 = (Layer)factory.getLayer("layer1");
// Assert
assertNotNull("object created", top);
assertNotNull("object created", container1);
assertNotNull("object created", layer1);
assertNotNull("object created", layer2);
assertNotNull("object created", layer3);
}
}
|