Search in sources :

Example 6 with DynamicView

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

the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithContainerScopeAndKey.

@Test
void test_parse_CreatesADynamicViewWithContainerScopeAndKey() {
    DslContext context = context();
    IdentifiersRegister elements = new IdentifiersRegister();
    Container container = model.addSoftwareSystem("Name", "Description").addContainer("Container", "Description", "Technology");
    elements.register("container", container);
    context.setIdentifierRegister(elements);
    parser.parse(context, tokens("dynamic", "container", "key"));
    List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
    assertEquals(1, views.size());
    assertEquals("key", views.get(0).getKey());
    assertEquals("", views.get(0).getDescription());
    assertSame(container, views.get(0).getElement());
}
Also used : Container(com.structurizr.model.Container) ArrayList(java.util.ArrayList) DynamicView(com.structurizr.view.DynamicView) Test(org.junit.jupiter.api.Test)

Example 7 with DynamicView

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

the class DynamicViewParserTests method test_parse_GeneratesAKey_WhenTheKeyIsMissing.

@Test
void test_parse_GeneratesAKey_WhenTheKeyIsMissing() {
    DslContext context = context();
    DynamicView view = parser.parse(context, tokens("dynamic", "*"));
    assertEquals("Dynamic-001", view.getKey());
}
Also used : DynamicView(com.structurizr.view.DynamicView) Test(org.junit.jupiter.api.Test)

Example 8 with DynamicView

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

the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithSoftwareSystemScopeAndKeyAndDescription.

@Test
void test_parse_CreatesADynamicViewWithSoftwareSystemScopeAndKeyAndDescription() {
    DslContext context = context();
    IdentifiersRegister elements = new IdentifiersRegister();
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
    elements.register("softwaresystem", softwareSystem);
    context.setIdentifierRegister(elements);
    parser.parse(context, tokens("dynamic", "softwareSystem", "key", "Description"));
    List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
    assertEquals(1, views.size());
    assertEquals("key", views.get(0).getKey());
    assertEquals("Description", views.get(0).getDescription());
    assertSame(softwareSystem, views.get(0).getElement());
}
Also used : ArrayList(java.util.ArrayList) SoftwareSystem(com.structurizr.model.SoftwareSystem) DynamicView(com.structurizr.view.DynamicView) Test(org.junit.jupiter.api.Test)

Example 9 with DynamicView

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

the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithContainerScopeAndKeyAndDescription.

@Test
void test_parse_CreatesADynamicViewWithContainerScopeAndKeyAndDescription() {
    DslContext context = context();
    IdentifiersRegister elements = new IdentifiersRegister();
    Container container = model.addSoftwareSystem("Name", "Description").addContainer("Container", "Description", "Technology");
    elements.register("container", container);
    context.setIdentifierRegister(elements);
    parser.parse(context, tokens("dynamic", "container", "key", "Description"));
    List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
    assertEquals(1, views.size());
    assertEquals("key", views.get(0).getKey());
    assertEquals("Description", views.get(0).getDescription());
    assertSame(container, views.get(0).getElement());
}
Also used : Container(com.structurizr.model.Container) ArrayList(java.util.ArrayList) DynamicView(com.structurizr.view.DynamicView) Test(org.junit.jupiter.api.Test)

Example 10 with DynamicView

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

the class ViewParserTests method test_parseDescription_SetsTheTitleOfADynamicView.

@Test
void test_parseDescription_SetsTheTitleOfADynamicView() {
    DynamicView view = workspace.getViews().createDynamicView("key", "description");
    DynamicViewDslContext context = new DynamicViewDslContext(view);
    context.setWorkspace(workspace);
    assertEquals("description", view.getDescription());
    parser.parseDescription(context, tokens("description", "A new description"));
    assertEquals("A new description", view.getDescription());
}
Also used : DynamicView(com.structurizr.view.DynamicView) 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