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