Search in sources :

Example 11 with SoftwareSystem

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

the class ModelItemParserTests method test_parseUrl_SetsTheUrl_WhenAUrlIsSpecified.

@Test
void test_parseUrl_SetsTheUrl_WhenAUrlIsSpecified() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
    ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
    parser.parseUrl(context, tokens("url", "http://example.com"));
    assertEquals("http://example.com", softwareSystem.getUrl());
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 12 with SoftwareSystem

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

the class ModelItemParserTests method test_parsePerspective_AddsThePerspective_WhenAValueIsSpecified.

@Test
void test_parsePerspective_AddsThePerspective_WhenAValueIsSpecified() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
    ModelItemPerspectivesDslContext context = new ModelItemPerspectivesDslContext(softwareSystem);
    parser.parsePerspective(context, tokens("Security", "Description"));
    assertEquals("Description", softwareSystem.getPerspectives().stream().filter(p -> p.getName().equals("Security")).findFirst().get().getDescription());
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 13 with SoftwareSystem

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

the class ModelItemParserTests method test_parsePerspective_ThrowsAnException_WhenNoDescriptionIsSpecified.

@Test
void test_parsePerspective_ThrowsAnException_WhenNoDescriptionIsSpecified() {
    try {
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
        ModelItemPerspectivesDslContext context = new ModelItemPerspectivesDslContext(softwareSystem);
        parser.parsePerspective(context, tokens("name"));
        fail();
    } catch (Exception e) {
        assertEquals("Expected: <name> <description>", e.getMessage());
    }
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 14 with SoftwareSystem

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

the class ComponentParserTests method test_parse_CreatesAComponentWithADescription.

@Test
void test_parse_CreatesAComponentWithADescription() {
    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"));
    assertEquals(3, model.getElements().size());
    Component component = container.getComponentWithName("Name");
    assertNotNull(component);
    assertEquals("Description", component.getDescription());
    assertEquals(null, 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 15 with SoftwareSystem

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

the class ComponentParserTests method test_parse_CreatesAComponent.

@Test
void test_parse_CreatesAComponent() {
    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"));
    assertEquals(3, model.getElements().size());
    Component component = container.getComponentWithName("Name");
    assertNotNull(component);
    assertEquals("", component.getDescription());
    assertEquals(null, 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)

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