use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseExclude_ThrowsAnException_WhenTheRelationshipSourceElementDoesNotExistInTheModel.
@Test
void test_parseExclude_ThrowsAnException_WhenTheRelationshipSourceElementDoesNotExistInTheModel() {
try {
SoftwareSystem ss1 = model.addSoftwareSystem("SS1", "Description");
SoftwareSystem ss2 = model.addSoftwareSystem("SS2", "Description");
Relationship rel = ss1.uses(ss2, "Uses");
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
dn.add(ss1);
dn.add(ss2);
DeploymentView view = views.createDeploymentView("key", "Description");
view.setEnvironment("Live");
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("ss2", ss2);
context.setIdentifierRegister(elements);
parser.parseExclude(context, tokens("exclude", "relationship.source==ss1 && relationship.destination==ss2"));
fail();
} catch (RuntimeException re) {
assertEquals("The element \"ss1\" does not exist", re.getMessage());
}
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsTheElement_WhenTheElementIsAContainerInstance.
@Test
void test_parseInclude_AddsTheElement_WhenTheElementIsAContainerInstance() {
DeploymentNode dn = model.addDeploymentNode("Live", "DN", "Description", "Technology");
SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System");
Container container = softwareSystem.addContainer("Container");
ContainerInstance containerInstance = dn.add(container);
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("element", containerInstance);
DeploymentView view = views.createDeploymentView("key", "Description");
view.setEnvironment("Live");
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
context.setIdentifierRegister(elements);
parser.parseInclude(context, tokens("include", "element"));
assertEquals(2, view.getElements().size());
assertNotNull(view.getElementView(dn));
assertNotNull(view.getElementView(containerInstance));
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsAllContainerInstancesWithTheSpecifiedTag.
@Test
void test_parseInclude_AddsAllContainerInstancesWithTheSpecifiedTag() {
SoftwareSystem ss = model.addSoftwareSystem("SS", "Description");
Container c1 = ss.addContainer("Container 1");
Container c2 = ss.addContainer("Container 2");
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
ContainerInstance c1Instance = dn.add(c1);
c1Instance.addTags("Tag 1");
ContainerInstance c2Instance = dn.add(c2);
c2Instance.addTags("Tag 2");
DeploymentView view = views.createDeploymentView("key", "Description");
view.setEnvironment("Live");
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
parser.parseInclude(context, tokens("include", "element.tag==Tag 1"));
assertEquals(2, view.getElements().size());
assertNotNull(view.getElementView(dn));
assertNotNull(view.getElementView(c1Instance));
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseExclude_ThrowsAnException_WhenTheRelationshipDestinationElementDoesNotExistInTheModel.
@Test
void test_parseExclude_ThrowsAnException_WhenTheRelationshipDestinationElementDoesNotExistInTheModel() {
try {
SoftwareSystem ss1 = model.addSoftwareSystem("SS1", "Description");
SoftwareSystem ss2 = model.addSoftwareSystem("SS2", "Description");
Relationship rel = ss1.uses(ss2, "Uses");
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
dn.add(ss1);
DeploymentView view = views.createDeploymentView("key", "Description");
view.setEnvironment("Live");
view.add(dn);
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("ss1", ss1);
context.setIdentifierRegister(elements);
parser.parseExclude(context, tokens("exclude", "relationship.source==ss1 && relationship.destination==ss2"));
fail();
} catch (RuntimeException re) {
assertEquals("The element \"ss2\" does not exist", re.getMessage());
}
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsTheElement_WhenTheElementIsAnInfrastructureNode.
@Test
void test_parseInclude_AddsTheElement_WhenTheElementIsAnInfrastructureNode() {
DeploymentNode dn = model.addDeploymentNode("Live", "DN", "Description", "Technology");
InfrastructureNode in = dn.addInfrastructureNode("IN", "Description", "Technology");
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("element", in);
DeploymentView view = views.createDeploymentView("key", "Description");
view.setEnvironment("Live");
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
context.setIdentifierRegister(elements);
parser.parseInclude(context, tokens("include", "element"));
assertEquals(2, view.getElements().size());
assertNotNull(view.getElementView(dn));
assertNotNull(view.getElementView(in));
}
Aggregations