Search in sources :

Example 1 with DeploymentNode

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

the class DeploymentNodeParserTests method test_parse_CreatesADeploymentNodeWithADescriptionAndTechnology.

@Test
void test_parse_CreatesADeploymentNodeWithADescriptionAndTechnology() {
    DeploymentEnvironmentDslContext context = new DeploymentEnvironmentDslContext("Live");
    context.setWorkspace(workspace);
    parser.parse(context, tokens("deploymentNode", "Name", "Description", "Technology"));
    assertEquals(1, model.getElements().size());
    DeploymentNode deploymentNode = model.getDeploymentNodeWithName("Name", "Live");
    assertNotNull(deploymentNode);
    assertEquals("Description", deploymentNode.getDescription());
    assertEquals("Technology", deploymentNode.getTechnology());
    assertEquals("Element,Deployment Node", deploymentNode.getTags());
    assertEquals(1, deploymentNode.getInstances());
    assertEquals("Live", deploymentNode.getEnvironment());
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) Test(org.junit.jupiter.api.Test)

Example 2 with DeploymentNode

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

the class DeploymentNodeParserTests method test_parse_CreatesADeploymentNodeWithADescriptionAndTechnologyAndTagsAndInstances.

@Test
void test_parse_CreatesADeploymentNodeWithADescriptionAndTechnologyAndTagsAndInstances() {
    DeploymentEnvironmentDslContext context = new DeploymentEnvironmentDslContext("Live");
    context.setWorkspace(workspace);
    parser.parse(context, tokens("deploymentNode", "Name", "Description", "Technology", "Tag 1, Tag 2", "8"));
    assertEquals(1, model.getElements().size());
    DeploymentNode deploymentNode = model.getDeploymentNodeWithName("Name", "Live");
    assertNotNull(deploymentNode);
    assertEquals("Description", deploymentNode.getDescription());
    assertEquals("Technology", deploymentNode.getTechnology());
    assertEquals("Element,Deployment Node,Tag 1,Tag 2", deploymentNode.getTags());
    assertEquals(8, deploymentNode.getInstances());
    assertEquals("Live", deploymentNode.getEnvironment());
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) Test(org.junit.jupiter.api.Test)

Example 3 with DeploymentNode

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

the class DeploymentNodeParserTests method test_parse_CreatesAChildDeploymentNode.

@Test
void test_parse_CreatesAChildDeploymentNode() {
    DeploymentNode parent = model.addDeploymentNode("Live", "Parent", "Description", "Technology");
    DeploymentNodeDslContext context = new DeploymentNodeDslContext(parent);
    context.setWorkspace(workspace);
    parser.parse(context, tokens("deploymentNode", "Name"));
    assertEquals(2, model.getElements().size());
    DeploymentNode deploymentNode = parent.getDeploymentNodeWithName("Name");
    assertNotNull(deploymentNode);
    assertEquals("", deploymentNode.getDescription());
    assertEquals("", deploymentNode.getTechnology());
    assertEquals("Element,Deployment Node", deploymentNode.getTags());
    assertEquals(1, deploymentNode.getInstances());
    assertEquals("Live", deploymentNode.getEnvironment());
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) Test(org.junit.jupiter.api.Test)

Example 4 with DeploymentNode

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

the class DeploymentNodeParserTests method test_parseTechnology_ThrowsAnException_WhenNoDescriptionIsSpecified.

@Test
void test_parseTechnology_ThrowsAnException_WhenNoDescriptionIsSpecified() {
    try {
        DeploymentNode deploymentNode = model.addDeploymentNode("Deployment Node");
        DeploymentNodeDslContext context = new DeploymentNodeDslContext(deploymentNode);
        parser.parseTechnology(context, tokens("technology"));
        fail();
    } catch (Exception e) {
        assertEquals("Expected: technology <technology>", e.getMessage());
    }
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) Test(org.junit.jupiter.api.Test)

Example 5 with DeploymentNode

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

the class DeploymentNodeParserTests method test_parseTechnology_ThrowsAnException_WhenThereAreTooManyTokens.

@Test
void test_parseTechnology_ThrowsAnException_WhenThereAreTooManyTokens() {
    try {
        DeploymentNode deploymentNode = model.addDeploymentNode("Deployment Node");
        DeploymentNodeDslContext context = new DeploymentNodeDslContext(deploymentNode);
        parser.parseTechnology(context, tokens("technology", "technology", "extra"));
        fail();
    } catch (Exception e) {
        assertEquals("Too many tokens, expected: technology <technology>", e.getMessage());
    }
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) Test(org.junit.jupiter.api.Test)

Aggregations

DeploymentNode (com.structurizr.model.DeploymentNode)18 Test (org.junit.jupiter.api.Test)13 InfrastructureNode (com.structurizr.model.InfrastructureNode)5 SoftwareSystem (com.structurizr.model.SoftwareSystem)3 Workspace (com.structurizr.Workspace)2 Container (com.structurizr.model.Container)2 Model (com.structurizr.model.Model)2 DeploymentView (com.structurizr.view.DeploymentView)2 Styles (com.structurizr.view.Styles)2 ViewSet (com.structurizr.view.ViewSet)2 Enterprise (com.structurizr.model.Enterprise)1 Person (com.structurizr.model.Person)1 SystemLandscapeView (com.structurizr.view.SystemLandscapeView)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1