-
Notifications
You must be signed in to change notification settings - Fork 17
/
CopyImagesTest.java
106 lines (82 loc) · 3.5 KB
/
CopyImagesTest.java
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
99
100
101
102
103
104
105
106
/*******************************************************************************
* Copyright (c) 2022 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.transition.system2subsystem.tests.mixed;
import static org.junit.Assert.assertTrue;
import java.util.Collection;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.polarsys.capella.transition.system2subsystem.tests.System2SubsystemTest;
import org.polarsys.capella.transition.system2subsystem.tests.System2SubsystemTest.Crossphase;
import org.polarsys.capella.transition.system2subsystem.tests.System2SubsystemTest.Interphase;
import org.polarsys.capella.transition.system2subsystem.tests.multiphases.MultiPhasesTest;
/**
* Test that verifies the copy of images for all kind of transitions
*/
public class CopyImagesTest {
private static final String MP_ORDERED_PA_PC_4 = "b271ea03-5360-43a3-823f-1f4aa88f83ba"; //$NON-NLS-1$
private static String _id_pc1 = "4d32c631-16c0-40cf-afb6-4493c895ab56"; //$NON-NLS-1$
private static final String LC_1 = "aa75d1f7-8bd9-49ff-8e61-a3462115e04e";
private static final String COPIED_IMAGE_PATH = "images/Capella128x128.png";
/**
* Test that verifies the copy of images during a Multiphases transition
*/
public static class CopyImagesInMultiphasesTest extends MultiPhasesTest {
public CopyImagesInMultiphasesTest() {
super();
}
@Override
protected Collection<?> getProjectionElements() {
return getObjects(MP_ORDERED_PA_PC_4);
}
@Override
protected void verify() throws Exception {
testImageCopy(getRequiredTestModels().get(1));
}
}
/**
* Test that verifies the copy of images during an Interphases transition
*/
public static class CopyImagesInInterphasesTest extends System2SubsystemTest implements Interphase {
public CopyImagesInInterphasesTest() {
super();
}
@Override
protected Collection<?> getProjectionElements() {
return getObjects(_id_pc1);
}
@Override
protected void verify() {
testImageCopy(getRequiredTestModels().get(1));
}
}
/**
* Test that verifies the copy of images during a Crossphases transition
*/
public static class CopyImagesInCrossphasesTest extends System2SubsystemTest implements Crossphase {
public CopyImagesInCrossphasesTest() {
super();
}
@Override
protected Collection<?> getProjectionElements() {
return getObjects(LC_1);
}
@Override
protected void verify() throws Exception {
testImageCopy(getRequiredTestModels().get(1));
}
}
public static void testImageCopy(String outputProjectName) {
IFile copiedImage = ResourcesPlugin.getWorkspace().getRoot().getProject(outputProjectName).getFile(COPIED_IMAGE_PATH);
assertTrue("An image file should have been copied", copiedImage.exists());
}
}