@Test public void test_findRelationshipStyle_ReturnsTheCorrectStyle_WhenStylesAreDefined() { SoftwareSystem element = model.addSoftwareSystem("Name", "Description"); Relationship relationship = element.uses(element, "Uses"); relationship.addTags("Some Tag"); styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000"); styles.addRelationshipStyle("Some Tag").color("#0000ff"); RelationshipStyle style = styles.findRelationshipStyle(relationship); assertEquals("#0000ff", style.getColor()); }
@Test public void test_writeView_IncludesStyling_WhenStylesAreAdded() throws Exception { workspace = new Workspace("", ""); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("My software system", ""); Person user = workspace.getModel().addPerson("A user", ""); user.uses(softwareSystem, "Uses"); workspace.getViews().createSystemContextView(softwareSystem, "key", "").addAllElements(); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000"); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.PERSON).background("#00ff00"); workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(Tags.RELATIONSHIP).color("#0000ff"); plantUMLWriter.write(workspace, stringWriter); assertEquals("@startuml(id=key)" + System.lineSeparator() + "scale max 1999x1999" + System.lineSeparator() + "title My software system - System Context" + System.lineSeparator() + "" + System.lineSeparator() + "skinparam {" + System.lineSeparator() + " shadowing false" + System.lineSeparator() + " arrowColor #707070" + System.lineSeparator() + " actorBorderColor #707070" + System.lineSeparator() + " componentBorderColor #707070" + System.lineSeparator() + " rectangleBorderColor #707070" + System.lineSeparator() + " noteBackgroundColor #ffffff" + System.lineSeparator() + " noteBorderColor #707070" + System.lineSeparator() + "}" + System.lineSeparator() + "rectangle \"A user\" <<Person>> as 2 #00ff00" + System.lineSeparator() + "rectangle \"My software system\" <<Software System>> as 1 #ff0000" + System.lineSeparator() + "2 .[#0000ff].> 1 : Uses" + System.lineSeparator() + "@enduml" + System.lineSeparator(), stringWriter.toString()); }
workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000"); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.PERSON).background("#00ff00"); workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(Tags.RELATIONSHIP).color("#0000ff");
styles.addElementStyle(Tags.PERSON).width(550).background("#d46a6a").shape(Shape.Person); styles.addRelationshipStyle(Tags.RELATIONSHIP).thickness(4).dashed(false).fontSize(32).width(400); styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false); styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true); styles.addRelationshipStyle(TAG_ALERT).color("#ff0000"); styles.addRelationshipStyle("Future State").opacity(30).dashed(true);
styles.addElementStyle("Spring Repository").background("#95D46C").color("#000000"); styles.addElementStyle("Failover").opacity(25); styles.addRelationshipStyle("Failover").opacity(25).position(70);
styles.addElementStyle(MICROSERVICE_TAG).shape(Shape.Hexagon); styles.addElementStyle(DATASTORE_TAG).background("#f5da81").shape(Shape.Cylinder); styles.addRelationshipStyle(Tags.RELATIONSHIP).routing(Routing.Orthogonal); styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true); styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
styles.addElementStyle(DATABASE_TAG).shape(Shape.Cylinder); styles.addElementStyle(FAILOVER_TAG).opacity(25); styles.addRelationshipStyle(FAILOVER_TAG).opacity(25).position(70);