Search in sources :

Example 56 with SoftwareSystem

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

the class ModelItemParserTests method test_parseTags_AddsTheTags_WhenTagsAreSpecified.

@Test
void test_parseTags_AddsTheTags_WhenTagsAreSpecified() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
    ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
    parser.parseTags(context, tokens("tags", "Tag 1"));
    assertEquals(3, softwareSystem.getTagsAsSet().size());
    assertTrue(softwareSystem.getTagsAsSet().contains("Tag 1"));
    parser.parseTags(context, tokens("tags", "Tag 1, Tag 2, Tag 3"));
    assertEquals(5, softwareSystem.getTagsAsSet().size());
    assertTrue(softwareSystem.getTagsAsSet().contains("Tag 2"));
    assertTrue(softwareSystem.getTagsAsSet().contains("Tag 3"));
    parser.parseTags(context, tokens("tags", "Tag 3", "Tag 4", "Tag 5"));
    assertEquals(7, softwareSystem.getTagsAsSet().size());
    assertTrue(softwareSystem.getTagsAsSet().contains("Tag 4"));
    assertTrue(softwareSystem.getTagsAsSet().contains("Tag 5"));
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 57 with SoftwareSystem

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

the class ModelItemParserTests method test_parseDescription_SetsTheDescription_WhenADescriptionIsSpecified.

@Test
void test_parseDescription_SetsTheDescription_WhenADescriptionIsSpecified() {
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "");
    ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
    parser.parseDescription(context, tokens("description", "Description"));
    assertEquals("Description", softwareSystem.getDescription());
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 58 with SoftwareSystem

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

the class ModelItemParserTests method test_parseTags_ThrowsAnException_WhenNoTagsAreSpecified.

@Test
void test_parseTags_ThrowsAnException_WhenNoTagsAreSpecified() {
    try {
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
        ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
        parser.parseTags(context, tokens("tags"));
        fail();
    } catch (Exception e) {
        assertEquals("Expected: tags <tags> [tags]", e.getMessage());
    }
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) Test(org.junit.jupiter.api.Test)

Example 59 with SoftwareSystem

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

the class ModelItemParserTests method test_parseUrl_ThrowsAnException_WhenNoUrlIsSpecified.

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

Example 60 with SoftwareSystem

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

the class PropertyParserTests method test_parseProperty_ThrowsAnException_WhenNoValueIsSpecified.

@Test
void test_parseProperty_ThrowsAnException_WhenNoValueIsSpecified() {
    try {
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
        PropertiesDslContext context = new PropertiesDslContext(softwareSystem);
        new PropertyParser().parse(context, tokens("name"));
        fail();
    } catch (Exception e) {
        assertEquals("Expected: <name> <value>", e.getMessage());
    }
}
Also used : SoftwareSystem(com.structurizr.model.SoftwareSystem) 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