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());
}
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());
}
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());
}
}
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());
}
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());
}
Aggregations