use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class ArchimateModelUtilsTests method testGetObjectByID.
@Test
public void testGetObjectByID() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
EObject element = ArchimateModelUtils.getObjectByID(model, null);
assertNull(element);
IArchimateElement newElement1 = IArchimateFactory.eINSTANCE.createApplicationFunction();
model.getDefaultFolderForObject(newElement1).getElements().add(newElement1);
IArchimateElement newElement2 = IArchimateFactory.eINSTANCE.createBusinessActor();
model.getDefaultFolderForObject(newElement2).getElements().add(newElement2);
element = ArchimateModelUtils.getObjectByID(model, newElement1.getId());
assertSame(newElement1, element);
element = ArchimateModelUtils.getObjectByID(model, newElement2.getId());
assertSame(newElement2, element);
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class ArchimateModelUtilsTests method testGetAllRelationshipsForConcept_NotNull.
@Test
public void testGetAllRelationshipsForConcept_NotNull() {
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
model.setDefaults();
IArchimateElement element1 = IArchimateFactory.eINSTANCE.createBusinessActor();
model.getDefaultFolderForObject(element1).getElements().add(element1);
IArchimateElement element2 = IArchimateFactory.eINSTANCE.createBusinessRole();
model.getDefaultFolderForObject(element2).getElements().add(element2);
assertNotNull(ArchimateModelUtils.getAllRelationshipsForConcept(element1));
assertNotNull(ArchimateModelUtils.getAllRelationshipsForConcept(element2));
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class RelationshipsMatrixTests method testIsValidRelationshipStart_Element.
@Test
public void testIsValidRelationshipStart_Element() {
IArchimateElement sourceElement = IArchimateFactory.eINSTANCE.createJunction();
IArchimateRelationship relationship = IArchimateFactory.eINSTANCE.createFlowRelationship();
assertTrue(matrix.isValidRelationshipStart(sourceElement.eClass(), relationship.eClass()));
relationship = IArchimateFactory.eINSTANCE.createTriggeringRelationship();
assertTrue(matrix.isValidRelationshipStart(sourceElement.eClass(), relationship.eClass()));
relationship = IArchimateFactory.eINSTANCE.createSpecializationRelationship();
assertFalse(matrix.isValidRelationshipStart(sourceElement.eClass(), relationship.eClass()));
sourceElement = IArchimateFactory.eINSTANCE.createSystemSoftware();
relationship = IArchimateFactory.eINSTANCE.createFlowRelationship();
assertTrue(matrix.isValidRelationshipStart(sourceElement.eClass(), relationship.eClass()));
relationship = IArchimateFactory.eINSTANCE.createAccessRelationship();
assertTrue(matrix.isValidRelationshipStart(sourceElement.eClass(), relationship.eClass()));
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class ArchimateModelDataSourceTests method testGetElementByID.
@Test
public void testGetElementByID() {
IArchimateElement element = IArchimateFactory.eINSTANCE.createApplicationService();
model.getDefaultFolderForObject(element).getElements().add(element);
String id = element.getId();
assertEquals(element, ds.getElementByID(id));
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class JunctionsCheckerTests method testGetIssues.
@Test
public void testGetIssues() {
List<IArchimateElement> elements = new ArrayList<IArchimateElement>();
IArchimateElement e1 = IArchimateFactory.eINSTANCE.createBusinessActor();
elements.add(e1);
IArchimateElement junction = IArchimateFactory.eINSTANCE.createJunction();
elements.add(junction);
IArchimateElement e2 = IArchimateFactory.eINSTANCE.createBusinessActor();
elements.add(e2);
IArchimateRelationship rel1 = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
rel1.connect(e1, junction);
IArchimateRelationship rel2 = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
rel2.connect(junction, e2);
JunctionsChecker checker = new JunctionsChecker(elements);
// Should be OK
List<IIssue> issues = checker.getIssues();
assertEquals(0, issues.size());
// Add a different relationship
IArchimateRelationship rel3 = IArchimateFactory.eINSTANCE.createTriggeringRelationship();
rel3.connect(junction, e2);
issues = checker.getIssues();
assertEquals(1, issues.size());
assertSame(junction, issues.get(0).getObject());
}
Aggregations