Search in sources :

Example 1 with InfrastructureNode

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

the class InfrastructureNodeParserTests method test_parse_CreatesAnInfrastructureNodeWithADescriptionAndTechnology.

@Test
void test_parse_CreatesAnInfrastructureNodeWithADescriptionAndTechnology() {
    DeploymentNode deploymentNode = model.addDeploymentNode("Live", "Deployment Node", "Description", "Technology");
    DeploymentNodeDslContext context = new DeploymentNodeDslContext(deploymentNode);
    parser.parse(context, tokens("infrastructureNode", "Name", "Description", "Technology"));
    assertEquals(2, model.getElements().size());
    assertEquals(1, deploymentNode.getInfrastructureNodes().size());
    InfrastructureNode infrastructureNode = deploymentNode.getInfrastructureNodeWithName("Name");
    assertNotNull(infrastructureNode);
    assertEquals("Description", infrastructureNode.getDescription());
    assertEquals("Technology", infrastructureNode.getTechnology());
    assertEquals("Element,Infrastructure Node", infrastructureNode.getTags());
    assertEquals("Live", infrastructureNode.getEnvironment());
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) InfrastructureNode(com.structurizr.model.InfrastructureNode) Test(org.junit.jupiter.api.Test)

Example 2 with InfrastructureNode

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

the class InfrastructureNodeParserTests method test_parseTechnology_SetsTheDescription_WhenADescriptionIsSpecified.

@Test
void test_parseTechnology_SetsTheDescription_WhenADescriptionIsSpecified() {
    InfrastructureNode infrastructureNode = model.addDeploymentNode("Deployment Node").addInfrastructureNode("Infrastructure Node");
    InfrastructureNodeDslContext context = new InfrastructureNodeDslContext(infrastructureNode);
    parser.parseTechnology(context, tokens("technology", "Technology"));
    assertEquals("Technology", infrastructureNode.getTechnology());
}
Also used : InfrastructureNode(com.structurizr.model.InfrastructureNode) Test(org.junit.jupiter.api.Test)

Example 3 with InfrastructureNode

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

the class InfrastructureNodeParserTests method test_parseTechnology_ThrowsAnException_WhenThereAreTooManyTokens.

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

Example 4 with InfrastructureNode

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

the class InfrastructureNodeParserTests method test_parse_CreatesAnInfrastructureNode.

@Test
void test_parse_CreatesAnInfrastructureNode() {
    DeploymentNode deploymentNode = model.addDeploymentNode("Live", "Deployment Node", "Description", "Technology");
    DeploymentNodeDslContext context = new DeploymentNodeDslContext(deploymentNode);
    parser.parse(context, tokens("infrastructureNode", "Name"));
    assertEquals(2, model.getElements().size());
    assertEquals(1, deploymentNode.getInfrastructureNodes().size());
    InfrastructureNode infrastructureNode = deploymentNode.getInfrastructureNodeWithName("Name");
    assertNotNull(infrastructureNode);
    assertEquals("", infrastructureNode.getDescription());
    assertEquals("", infrastructureNode.getTechnology());
    assertEquals("Element,Infrastructure Node", infrastructureNode.getTags());
    assertEquals("Live", infrastructureNode.getEnvironment());
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) InfrastructureNode(com.structurizr.model.InfrastructureNode) Test(org.junit.jupiter.api.Test)

Example 5 with InfrastructureNode

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

the class InfrastructureNodeParserTests method test_parse_CreatesAnInfrastructureNodeWithADescription.

@Test
void test_parse_CreatesAnInfrastructureNodeWithADescription() {
    DeploymentNode deploymentNode = model.addDeploymentNode("Live", "Deployment Node", "Description", "Technology");
    DeploymentNodeDslContext context = new DeploymentNodeDslContext(deploymentNode);
    parser.parse(context, tokens("infrastructureNode", "Name", "Description"));
    assertEquals(2, model.getElements().size());
    assertEquals(1, deploymentNode.getInfrastructureNodes().size());
    InfrastructureNode infrastructureNode = deploymentNode.getInfrastructureNodeWithName("Name");
    assertNotNull(infrastructureNode);
    assertEquals("Description", infrastructureNode.getDescription());
    assertEquals("", infrastructureNode.getTechnology());
    assertEquals("Element,Infrastructure Node", infrastructureNode.getTags());
    assertEquals("Live", infrastructureNode.getEnvironment());
}
Also used : DeploymentNode(com.structurizr.model.DeploymentNode) InfrastructureNode(com.structurizr.model.InfrastructureNode) Test(org.junit.jupiter.api.Test)

Aggregations

InfrastructureNode (com.structurizr.model.InfrastructureNode)9 Test (org.junit.jupiter.api.Test)7 DeploymentNode (com.structurizr.model.DeploymentNode)5 Element (com.structurizr.model.Element)1 StaticStructureElementInstance (com.structurizr.model.StaticStructureElementInstance)1 ArrayList (java.util.ArrayList)1