Search in sources :

Example 1 with IBusinessActor

use of com.archimatetool.model.IBusinessActor in project archi by archimatetool.

the class ColorFactoryTests method testGetUserDefaultFillColor.

@Test
public void testGetUserDefaultFillColor() {
    IBusinessActor actor = IArchimateFactory.eINSTANCE.createBusinessActor();
    Color color = ColorFactory.getUserDefaultFillColor(actor);
    assertNull(color);
    Preferences.STORE.setValue(IPreferenceConstants.DEFAULT_FILL_COLOR_PREFIX + actor.eClass().getName(), "#010203");
    color = ColorFactory.getUserDefaultFillColor(actor);
    assertEquals(1, color.getRed());
    assertEquals(2, color.getGreen());
    assertEquals(3, color.getBlue());
}
Also used : IBusinessActor(com.archimatetool.model.IBusinessActor) Color(org.eclipse.swt.graphics.Color) Test(org.junit.Test)

Example 2 with IBusinessActor

use of com.archimatetool.model.IBusinessActor in project archi by archimatetool.

the class ColorFactoryTests method testGetUserDefaultLineColor_Element.

@Test
public void testGetUserDefaultLineColor_Element() {
    IBusinessActor actor = IArchimateFactory.eINSTANCE.createBusinessActor();
    Color color = ColorFactory.getUserDefaultLineColor(actor);
    assertNull(color);
    Preferences.STORE.setValue(IPreferenceConstants.DEFAULT_ELEMENT_LINE_COLOR, "#020304");
    color = ColorFactory.getUserDefaultLineColor(actor);
    assertEquals(2, color.getRed());
    assertEquals(3, color.getGreen());
    assertEquals(4, color.getBlue());
    Preferences.STORE.setToDefault(IPreferenceConstants.DEFAULT_ELEMENT_LINE_COLOR);
}
Also used : IBusinessActor(com.archimatetool.model.IBusinessActor) Color(org.eclipse.swt.graphics.Color) Test(org.junit.Test)

Example 3 with IBusinessActor

use of com.archimatetool.model.IBusinessActor in project archi by archimatetool.

the class ArchimateDiagramModelFactoryTests method testGetNewObjectArchimateDiagramObject.

@Test
public void testGetNewObjectArchimateDiagramObject() {
    ICreationFactory factory = new ArchimateDiagramModelFactory(IArchimatePackage.eINSTANCE.getBusinessActor());
    IDiagramModelArchimateObject dmo = (IDiagramModelArchimateObject) factory.getNewObject();
    assertTrue(dmo.getArchimateElement() instanceof IBusinessActor);
    assertEquals("Business Actor", dmo.getName());
}
Also used : IBusinessActor(com.archimatetool.model.IBusinessActor) IDiagramModelArchimateObject(com.archimatetool.model.IDiagramModelArchimateObject) Test(org.junit.Test)

Example 4 with IBusinessActor

use of com.archimatetool.model.IBusinessActor in project archi by archimatetool.

the class ArchiLabelProviderTests method testGetImage.

@Test
public void testGetImage() {
    // Null object
    assertNull(ArchiLabelProvider.INSTANCE.getImage(null));
    // Object
    IBusinessActor actor = IArchimateFactory.eINSTANCE.createBusinessActor();
    Image image1 = ArchiLabelProvider.INSTANCE.getImage(actor);
    assertNotNull(image1);
    // Same image for object's class
    Image image2 = ArchiLabelProvider.INSTANCE.getImage(actor.eClass());
    assertSame(image1, image2);
}
Also used : IBusinessActor(com.archimatetool.model.IBusinessActor) Image(org.eclipse.swt.graphics.Image) IDiagramModelImage(com.archimatetool.model.IDiagramModelImage) Test(org.junit.Test)

Example 5 with IBusinessActor

use of com.archimatetool.model.IBusinessActor in project archi by archimatetool.

the class ArchiLabelProviderTests method testGetRelationshipSentence.

@Test
public void testGetRelationshipSentence() {
    // Null object
    assertEquals("", ArchiLabelProvider.INSTANCE.getRelationshipSentence(null));
    IBusinessActor actor = IArchimateFactory.eINSTANCE.createBusinessActor();
    actor.setName("Fred");
    IBusinessRole role = IArchimateFactory.eINSTANCE.createBusinessRole();
    role.setName("Nobody");
    IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
    relation.setSource(actor);
    relation.setTarget(role);
    assertEquals("Fred is assigned to Nobody", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
    relation.setSource(role);
    relation.setTarget(actor);
    assertEquals("Nobody is assigned to Fred", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
    // Junctions
    IJunction j1 = IArchimateFactory.eINSTANCE.createJunction();
    j1.setName("Johnny");
    relation.setSource(j1);
    relation.setTarget(actor);
    assertEquals("Johnny connects to Fred", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
    relation.setSource(actor);
    relation.setTarget(j1);
    assertEquals("Fred connects to Johnny", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
}
Also used : IBusinessActor(com.archimatetool.model.IBusinessActor) IBusinessRole(com.archimatetool.model.IBusinessRole) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IJunction(com.archimatetool.model.IJunction) Test(org.junit.Test)

Aggregations

IBusinessActor (com.archimatetool.model.IBusinessActor)7 Test (org.junit.Test)7 Color (org.eclipse.swt.graphics.Color)2 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)1 IBusinessRole (com.archimatetool.model.IBusinessRole)1 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)1 IDiagramModelImage (com.archimatetool.model.IDiagramModelImage)1 IJunction (com.archimatetool.model.IJunction)1 JRField (net.sf.jasperreports.engine.JRField)1 Image (org.eclipse.swt.graphics.Image)1