use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewContentParserTests method test_parseInclude_AddsAllInstancesOfContainersWithTheSpecifiedTag.
@Test
void test_parseInclude_AddsAllInstancesOfContainersWithTheSpecifiedTag() {
SoftwareSystem ss = model.addSoftwareSystem("SS", "Description");
Container c1 = ss.addContainer("Container 1");
c1.addTags("Tag 1");
Container c2 = ss.addContainer("Container 2");
c2.addTags("Tag 2");
DeploymentNode dn = model.addDeploymentNode("Live", "Live", "Description", "Technology");
ContainerInstance c1Instance = dn.add(c1);
ContainerInstance c2Instance = dn.add(c2);
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 DeploymentViewParserTests method test_parse_CreatesADeploymentViewWithSoftwareSystemScopeAndKey.
@Test
void test_parse_CreatesADeploymentViewWithSoftwareSystemScopeAndKey() {
DslContext context = context();
context.getWorkspace().getModel().addDeploymentNode("Live", "Deployment Node", "Description", "Technology");
IdentifiersRegister elements = new IdentifiersRegister();
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
elements.register("softwaresystem", softwareSystem);
context.setIdentifierRegister(elements);
parser.parse(context, tokens("deployment", "softwareSystem", "Live", "key"));
List<DeploymentView> views = new ArrayList<>(this.views.getDeploymentViews());
assertEquals(1, views.size());
assertEquals("key", views.get(0).getKey());
assertEquals("", views.get(0).getDescription());
assertSame(softwareSystem, views.get(0).getSoftwareSystem());
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewParserTests method test_parse_CreatesADeploymentViewWithSoftwareSystemScopeAndKeyAndDescription.
@Test
void test_parse_CreatesADeploymentViewWithSoftwareSystemScopeAndKeyAndDescription() {
DslContext context = context();
context.getWorkspace().getModel().addDeploymentNode("Live", "Deployment Node", "Description", "Technology");
IdentifiersRegister elements = new IdentifiersRegister();
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
elements.register("softwaresystem", softwareSystem);
context.setIdentifierRegister(elements);
parser.parse(context, tokens("deployment", "softwareSystem", "Live", "key", "Description"));
List<DeploymentView> views = new ArrayList<>(this.views.getDeploymentViews());
assertEquals(1, views.size());
assertEquals("key", views.get(0).getKey());
assertEquals("Description", views.get(0).getDescription());
assertSame(softwareSystem, views.get(0).getSoftwareSystem());
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class DeploymentViewParserTests method test_parse_CreatesADeploymentViewWithSoftwareSystemScope.
@Test
void test_parse_CreatesADeploymentViewWithSoftwareSystemScope() {
DslContext context = context();
context.getWorkspace().getModel().addDeploymentNode("Live", "Deployment Node", "Description", "Technology");
IdentifiersRegister elements = new IdentifiersRegister();
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
elements.register("softwaresystem", softwareSystem);
context.setIdentifierRegister(elements);
parser.parse(context, tokens("deployment", "softwareSystem", "Live"));
List<DeploymentView> views = new ArrayList<>(this.views.getDeploymentViews());
assertEquals(1, views.size());
assertEquals("Name-Live-Deployment", views.get(0).getKey());
assertEquals("", views.get(0).getDescription());
assertSame(softwareSystem, views.get(0).getSoftwareSystem());
}
use of com.structurizr.view.DeploymentView in project dsl by structurizr.
the class AbstractExpressionParserTests method test_parseExpression_ReturnsElementInstances_WhenUsingAnElementTagExpression.
@Test
void test_parseExpression_ReturnsElementInstances_WhenUsingAnElementTagExpression() {
model.addPerson("User");
SoftwareSystem ss = model.addSoftwareSystem("Software System");
SoftwareSystemInstance ssi = model.addDeploymentNode("DN").add(ss);
DeploymentView view = views.createDeploymentView("key", "Description");
DeploymentViewDslContext context = new DeploymentViewDslContext(view);
context.setWorkspace(workspace);
context.setIdentifierRegister(new IdentifiersRegister());
Set<ModelItem> elements = parser.parseExpression("element.tag==Software System", context);
assertEquals(2, elements.size());
// this is tagged "Software System"
assertTrue(elements.contains(ss));
// this is not tagged "Software System", but the element it's based upon is
assertTrue(elements.contains(ssi));
}
Aggregations