Search in sources :

Example 41 with SoftwareSystem

use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.

the class ContainerParserTests method test_parse_CreatesAContainerWithADescriptionAndTechnology.

@Test
void test_parse_CreatesAContainerWithADescriptionAndTechnology() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
    SoftwareSystemDslContext context = new SoftwareSystemDslContext(softwareSystem);
    parser.parse(context, tokens("container", "Name", "Description", "Technology"));
    assertEquals(2, model.getElements().size());
    Container container = softwareSystem.getContainerWithName("Name");
    assertNotNull(container);
    assertEquals("Description", container.getDescription());
    assertEquals("Technology", container.getTechnology());
    assertEquals("Element,Container", container.getTags());
}
Also used : Container(com.structurizr.model.Container) SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 42 with SoftwareSystem

use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.

the class ContainerParserTests method test_parse_CreatesAContainerWithADescriptionAndTechnologyAndTags.

@Test
void test_parse_CreatesAContainerWithADescriptionAndTechnologyAndTags() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
    SoftwareSystemDslContext context = new SoftwareSystemDslContext(softwareSystem);
    parser.parse(context, tokens("container", "Name", "Description", "Technology", "Tag 1, Tag 2"));
    assertEquals(2, model.getElements().size());
    Container container = softwareSystem.getContainerWithName("Name");
    assertNotNull(container);
    assertEquals("Description", container.getDescription());
    assertEquals("Technology", container.getTechnology());
    assertEquals("Element,Container,Tag 1,Tag 2", container.getTags());
}
Also used : Container(com.structurizr.model.Container) SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 43 with SoftwareSystem

use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.

the class ComponentParserTests method test_parse_CreatesAComponentWithADescriptionAndTechnology.

@Test
void test_parse_CreatesAComponentWithADescriptionAndTechnology() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
    Container container = softwareSystem.addContainer("Container", "Description", "Technology");
    ContainerDslContext context = new ContainerDslContext(container);
    parser.parse(context, tokens("component", "Name", "Description", "Technology"));
    assertEquals(3, model.getElements().size());
    Component component = container.getComponentWithName("Name");
    assertNotNull(component);
    assertEquals("Description", component.getDescription());
    assertEquals("Technology", component.getTechnology());
    assertEquals("Element,Component", component.getTags());
}
Also used : Container(com.structurizr.model.Container) SoftwareSystem(com.structurizr.model.SoftwareSystem) Component(com.structurizr.model.Component) Test(org.junit.jupiter.api.Test)

Example 44 with SoftwareSystem

use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.

the class ComponentParserTests method test_parse_CreatesAComponentWithADescriptionAndTechnologyAndTags.

@Test
void test_parse_CreatesAComponentWithADescriptionAndTechnologyAndTags() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
    Container container = softwareSystem.addContainer("Container", "Description", "Technology");
    ContainerDslContext context = new ContainerDslContext(container);
    parser.parse(context, tokens("component", "Name", "Description", "Technology", "Tag 1, Tag 2"));
    assertEquals(3, model.getElements().size());
    Component component = container.getComponentWithName("Name");
    assertNotNull(component);
    assertEquals("Description", component.getDescription());
    assertEquals("Technology", component.getTechnology());
    assertEquals("Element,Component,Tag 1,Tag 2", component.getTags());
}
Also used : Container(com.structurizr.model.Container) SoftwareSystem(com.structurizr.model.SoftwareSystem) Component(com.structurizr.model.Component) Test(org.junit.jupiter.api.Test)

Example 45 with SoftwareSystem

use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.

the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithSoftwareSystemScope.

@Test
void test_parse_CreatesADynamicViewWithSoftwareSystemScope() {
    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"));
    List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
    assertEquals(1, views.size());
    assertEquals("Name-Dynamic-001", views.get(0).getKey());
    assertEquals("", 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)

Aggregations

SoftwareSystem (com.structurizr.model.SoftwareSystem)69 Test (org.junit.jupiter.api.Test)38 Container (com.structurizr.model.Container)23 Workspace (com.structurizr.Workspace)22 Test (org.junit.Test)17 Person (com.structurizr.model.Person)9 Component (com.structurizr.model.Component)8 DynamicView (com.structurizr.view.DynamicView)8 ArrayList (java.util.ArrayList)8 Model (com.structurizr.model.Model)7 DeploymentView (com.structurizr.view.DeploymentView)6 SystemContextView (com.structurizr.view.SystemContextView)6 ViewSet (com.structurizr.view.ViewSet)5 Element (com.structurizr.model.Element)4 Relationship (com.structurizr.model.Relationship)4 ContainerView (com.structurizr.view.ContainerView)4 RelationshipView (com.structurizr.view.RelationshipView)4 DeploymentNode (com.structurizr.model.DeploymentNode)3 ComponentView (com.structurizr.view.ComponentView)3 EncryptedWorkspace (com.structurizr.encryption.EncryptedWorkspace)2