use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsAllSoftwareSystemInstancesWithTheSpecifiedTag.
@Test
void test_parseInclude_AddsAllSoftwareSystemInstancesWithTheSpecifiedTag() {
SoftwareSystem ss1 = model.addSoftwareSystem("SS1", "Description");
SoftwareSystem ss2 = model.addSoftwareSystem("SS2", "Description");
ss1.uses(ss2, "Uses");
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
SoftwareSystemInstance ss1Instance = dn.add(ss1);
ss1Instance.addTags("Tag 1");
SoftwareSystemInstance ss2Instance = dn.add(ss2);
ss2Instance.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(ss1Instance));
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsAllDeploymentNodesWithTheSpecifiedTag.
@Test
void test_parseInclude_AddsAllDeploymentNodesWithTheSpecifiedTag() {
SoftwareSystem ss1 = model.addSoftwareSystem("SS1", "Description");
SoftwareSystem ss2 = model.addSoftwareSystem("SS2", "Description");
ss1.uses(ss2, "Uses");
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
DeploymentNode dn1 = dn.addDeploymentNode("DN 1");
dn1.addTags("Tag 1");
SoftwareSystemInstance ss1Instance = dn1.add(ss1);
DeploymentNode dn2 = dn.addDeploymentNode("DN 2");
SoftwareSystemInstance ss2Instance = dn2.add(ss2);
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(3, view.getElements().size());
assertNotNull(view.getElementView(dn));
assertNotNull(view.getElementView(dn1));
assertNotNull(view.getElementView(ss1Instance));
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseExclude_RemovesTheSpecifiedElement.
@Test
void test_parseExclude_RemovesTheSpecifiedElement() {
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");
view.addAllDeploymentNodes();
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
context.setIdentifierRegister(elements);
assertEquals(2, view.getElements().size());
assertTrue(view.getElements().stream().anyMatch(ev -> ev.getElement().equals(dn)));
assertTrue(view.getElements().stream().anyMatch(ev -> ev.getElement().equals(in)));
parser.parseExclude(context, tokens("exclude", "element"));
assertEquals(1, view.getElements().size());
assertTrue(view.getElements().stream().anyMatch(ev -> ev.getElement().equals(dn)));
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseExclude_RemovesTheRelationshipFromAView_WhenAnExpressionIsSpecifiedWithADestination.
@Test
void test_parseExclude_RemovesTheRelationshipFromAView_WhenAnExpressionIsSpecifiedWithADestination() {
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");
view.add(dn);
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("ss1", ss1);
elements.register("ss2", ss2);
context.setIdentifierRegister(elements);
parser.parseExclude(context, tokens("exclude", "relationship.destination==ss2"));
assertEquals(0, view.getRelationships().size());
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsAllInfrastructureNodesWithTheSpecifiedTag.
@Test
void test_parseInclude_AddsAllInfrastructureNodesWithTheSpecifiedTag() {
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
InfrastructureNode in1 = dn.addInfrastructureNode("Infrastructure Node 1");
in1.addTags("Tag 1");
InfrastructureNode in2 = dn.addInfrastructureNode("Infrastructure Node 2");
in2.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(in1));
}
Aggregations