use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class ModelCheckerTests method checkProfiles.
@Test
public void checkProfiles() {
IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessActor();
model.getFolder(FolderType.BUSINESS).getElements().add(element);
IProfile profile = IArchimateFactory.eINSTANCE.createProfile();
profile.setName("Specialization");
profile.setConceptType(element.eClass().getName());
model.getProfiles().add(profile);
element.getProfiles().add(profile);
List<String> messages = modelChecker.checkProfiles(element);
assertEquals(0, messages.size());
// Remove from model
model.getProfiles().remove(profile);
messages = modelChecker.checkProfiles(element);
assertEquals(1, messages.size());
assertTrue(messages.get(0).startsWith("Profile reference is orphaned"));
// Wrong concept type
profile.setConceptType(IArchimatePackage.eINSTANCE.getArtifact().getName());
messages = modelChecker.checkProfiles(element);
assertEquals(2, messages.size());
assertTrue(messages.get(1).startsWith("Profile has wrong concept type"));
}
use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class ArchimateModelUtilsTests method findProfileUsage.
@Test
public void findProfileUsage() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setDefaults();
IProfile profile = IArchimateFactory.eINSTANCE.createProfile();
model.getProfiles().add(profile);
assertEquals(0, ArchimateModelUtils.findProfileUsage(profile).size());
IArchimateElement element = IArchimateFactory.eINSTANCE.createApplicationFunction();
model.getDefaultFolderForObject(element).getElements().add(element);
element.getProfiles().add(profile);
element = IArchimateFactory.eINSTANCE.createBusinessActor();
model.getDefaultFolderForObject(element).getElements().add(element);
element.getProfiles().add(profile);
assertEquals(2, ArchimateModelUtils.findProfileUsage(profile).size());
}
use of com.archimatetool.model.IProfile in project archi by archimatetool.
the class ArchimateModelUtilsTests method findProfilesUsage.
@Test
public void findProfilesUsage() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setDefaults();
IProfile profile = IArchimateFactory.eINSTANCE.createProfile();
model.getProfiles().add(profile);
assertEquals(0, ArchimateModelUtils.findProfilesUsage(model).size());
IArchimateElement element1 = IArchimateFactory.eINSTANCE.createApplicationFunction();
model.getDefaultFolderForObject(element1).getElements().add(element1);
element1.getProfiles().add(profile);
IArchimateElement element2 = IArchimateFactory.eINSTANCE.createBusinessActor();
model.getDefaultFolderForObject(element2).getElements().add(element2);
element2.getProfiles().add(profile);
Map<IProfile, List<IProfiles>> map = ArchimateModelUtils.findProfilesUsage(model);
assertEquals(1, map.size());
assertEquals(2, map.get(profile).size());
assertTrue(map.get(profile).contains(element1));
assertTrue(map.get(profile).contains(element2));
}
use of com.archimatetool.model.IProfile in project archi-modelrepository-plugin by archi-contribs.
the class GraficoModelImporter method loadElement.
/**
* Create an eObject from an XML file. Basically load a resource.
*
* @param file
* @return
* @throws IOException
*/
private EObject loadElement(File file) throws IOException {
IIdentifier eObject = GraficoResourceLoader.loadEObject(file);
// Update an ID -> Object mapping table (used as a cache to resolve proxies)
fIDLookup.put(eObject.getId(), eObject);
if (eObject instanceof IArchimateModel) {
for (IProfile profile : ((IArchimateModel) eObject).getProfiles()) {
fIDLookup.put(profile.getId(), profile);
}
}
return eObject;
}
Aggregations