Search in sources :

Example 16 with DynamicView

use of com.structurizr.view.DynamicView in project dsl by structurizr.

the class DynamicViewContentParserTests method test_parseRelationship_AddsTheRelationshipToTheView_WhenItAlreadyExistsInTheModel.

@Test
void test_parseRelationship_AddsTheRelationshipToTheView_WhenItAlreadyExistsInTheModel() {
    Person user = model.addPerson("User", "Description");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
    user.uses(softwareSystem, "Uses");
    DynamicView view = views.createDynamicView("key", "Description");
    DynamicViewDslContext context = new DynamicViewDslContext(view);
    IdentifiersRegister elements = new IdentifiersRegister();
    elements.register("source", user);
    elements.register("destination", softwareSystem);
    context.setIdentifierRegister(elements);
    parser.parseRelationship(context, tokens("source", "->", "destination"));
    assertEquals(1, view.getRelationships().size());
    RelationshipView rv = view.getRelationships().iterator().next();
    assertSame(user, rv.getRelationship().getSource());
    assertSame(softwareSystem, rv.getRelationship().getDestination());
    assertEquals("", rv.getDescription());
    assertEquals("1", rv.getOrder());
}
Also used : RelationshipView(com.structurizr.view.RelationshipView) SoftwareSystem(com.structurizr.model.SoftwareSystem) DynamicView(com.structurizr.view.DynamicView) Person(com.structurizr.model.Person) Test(org.junit.jupiter.api.Test)

Aggregations

DynamicView (com.structurizr.view.DynamicView)16 Test (org.junit.jupiter.api.Test)13 SoftwareSystem (com.structurizr.model.SoftwareSystem)8 ArrayList (java.util.ArrayList)6 Container (com.structurizr.model.Container)4 Person (com.structurizr.model.Person)4 RelationshipView (com.structurizr.view.RelationshipView)4 Element (com.structurizr.model.Element)2 Relationship (com.structurizr.model.Relationship)2 Workspace (com.structurizr.Workspace)1 StructurizrDslParser (com.structurizr.dsl.StructurizrDslParser)1 StructurizrDslParserException (com.structurizr.dsl.StructurizrDslParserException)1 Diagram (com.structurizr.export.Diagram)1 StructurizrPlantUMLExporter (com.structurizr.export.plantuml.StructurizrPlantUMLExporter)1 StaticStructureElement (com.structurizr.model.StaticStructureElement)1 ComponentView (com.structurizr.view.ComponentView)1 ContainerView (com.structurizr.view.ContainerView)1 DeploymentView (com.structurizr.view.DeploymentView)1 SystemContextView (com.structurizr.view.SystemContextView)1 SystemLandscapeView (com.structurizr.view.SystemLandscapeView)1