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
|
/*****************************************************************************
* 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:
* Remi Schnekenburger (CEA LIST) - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.profile.externalresource.tests.oneresourceforallprofiles;
import java.util.Arrays;
import java.util.List;
import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractChangeStrategyTests;
import org.eclipse.papyrus.uml.profile.externalresource.tests.AbstractExternalResourcesTest;
/**
* Test class for load/unload
*/
public class OneResourceForAllProfilesTests extends AbstractChangeStrategyTests {
/**
* {@inheritDoc}
*/
@Override
protected String getTestProjectName() {
return ONE_RESOURCE_FOR_ALL_PROFILES_FOLDER;
}
/**
* {@inheritDoc}
*/
@Override
protected List<String> getModelFileNames() {
return Arrays.asList(DI_FILE, NOTATION_FILE, UML_FILE, ALL_PROFILES_FILE);
}
// @Test
// public void moveStereotypeApplicationOutsidePapyrusEditor() {
// UmlModel umlModel = null;
// // get The model. try to see applied stereotypes
// try {
// umlModel = (UmlModel)modelSet.getModelChecked(UmlModel.MODEL_ID);
// } catch (NotFoundException e) {
// fail(e.getMessage());
// }
// Model rootModel = (Model)umlModel.getResource().getContents().get(0);
// Assert.assertNotNull("Root model impossible to find", rootModel);
//
// ICommand command = ExternalResourceProfileUtils.createUpdateStereotypeApplicationsLocationCommand(rootModel, PapyrusStereotypeApplicationHelper.getCurrentLocationStrategy(rootModel), StrategyRegistry.getInstance().getStrategy(OneResourceOnlyStrategy.ID));
// Assert.assertNotNull("Impossible to create update command", command);
// Assert.assertTrue("Command should be executable", command.canExecute());
// IStatus status = null;
// try {
// status = OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
// } catch (ExecutionException e1) {
// fail(e1.getMessage());
// }
//
// if(!status.isOK()) {
// fail(status.getMessage());
// }
//
// URI tmpURI = URI.createPlatformResourceURI(getTestProjectName()+"/tmp.di", true);
// try {
// getModelSet(getURI()).saveAs(tmpURI);
// } catch (IOException e) {
// fail(e.getMessage());
// }
// checkModel(rootModel);
// // check current model still have right stereotypes/values
// tearDownRegistry();
// // try to load and read profiles in the tmp file
// ModelSet tmpModelSet = getModelSet(tmpURI);
// Assert.assertNotNull("TMP Model set should not be null", tmpModelSet);
// UmlModel tmpUmlModel = null;
// // get The tmp model. try to see applied stereotypes
// try {
// tmpUmlModel = (UmlModel)tmpModelSet.getModelChecked(UmlModel.MODEL_ID);
// } catch (NotFoundException e) {
// fail(e.getMessage());
// }
// Assert.assertNotNull(tmpUmlModel);
// Resource tmpResource = tmpUmlModel.getResource();
// Assert.assertNotNull(tmpResource);
// Model tmpRootModel = (Model)tmpResource.getContents().get(0);
// Assert.assertNotNull(tmpRootModel);
// checkModel(tmpRootModel);
// // additionnal checks : strategy, location of the stereotype application, etc.
// // test some stereotype applications
// // Model::class1 should have <<classStereotype>> Applied (verify root level stererotype)
// Class class1_ = (Class)tmpRootModel.getPackagedElement(MODEL_CLASS1, true, UMLPackage.eINSTANCE.getClass_(), false);
// EObject application = class1_.getStereotypeApplication(class1_.getAppliedStereotype(CLASS_STEREOTYPE_QN));
// Assert.assertNotNull("No stereotype applied on "+ MODEL_CLASS1, application);
// Assert.assertNotNull(application.eResource());
// URI stereotypeApplicationURI = application.eResource().getURI();
// Assert.assertEquals("Stereotype is not in expected resource", tmpURI.trimFileExtension().appendFileExtension(OneResourceOnlyStrategy.PROFILE_DEFAULT_EXTENSION), stereotypeApplicationURI);
// // check undo, check redo...
// }
}
|