use of com.structurizr.model.SoftwareSystem 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.model.SoftwareSystem 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.model.SoftwareSystem in project dsl by structurizr.
the class DynamicViewContentParserTests method test_parseRelationship_AddsTheRelationshipWithTheSpecifiedTechnologyToTheView_WhenItAlreadyExistsInTheModel.
@Test
void test_parseRelationship_AddsTheRelationshipWithTheSpecifiedTechnologyToTheView_WhenItAlreadyExistsInTheModel() {
Person user = model.addPerson("User", "Description");
SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
Relationship r1 = user.uses(softwareSystem, "Uses 1", "Tech 1");
Relationship r2 = user.uses(softwareSystem, "Uses 2", "Tech 2");
DynamicView view = views.createDynamicView("key", "Description");
DynamicViewDslContext context = new DynamicViewDslContext(view);
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("source", user);
elements.register("destination", softwareSystem);
context.setIdentifierRegister(elements);
parser.parseRelationship(context, tokens("source", "->", "destination", "Description", "Tech 2"));
assertEquals(1, view.getRelationships().size());
RelationshipView rv = view.getRelationships().iterator().next();
assertSame(r2, rv.getRelationship());
assertSame(user, rv.getRelationship().getSource());
assertSame(softwareSystem, rv.getRelationship().getDestination());
assertEquals("Description", rv.getDescription());
assertEquals("1", rv.getOrder());
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class DynamicViewContentParserTests method test_parseRelationship_AddsTheRelationshipToTheView_WhenItAlreadyExistsInTheModel.
@Test
void test_parseRelationship_AddsTheRelationshipToTheView_WhenItAlreadyExistsInTheModel() {
Person user = model.addPerson("User", "Description");
SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
user.uses(softwareSystem, "Uses");
DynamicView view = views.createDynamicView("key", "Description");
DynamicViewDslContext context = new DynamicViewDslContext(view);
IdentifiersRegister elements = new IdentifiersRegister();
elements.register("source", user);
elements.register("destination", softwareSystem);
context.setIdentifierRegister(elements);
parser.parseRelationship(context, tokens("source", "->", "destination"));
assertEquals(1, view.getRelationships().size());
RelationshipView rv = view.getRelationships().iterator().next();
assertSame(user, rv.getRelationship().getSource());
assertSame(softwareSystem, rv.getRelationship().getDestination());
assertEquals("", rv.getDescription());
assertEquals("1", rv.getOrder());
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelDslContextTests method end_MarksAllOtherSoftwareSystemsAsExternal_WhenSomeSoftwareSystemsAreMarkedAsInternal.
@Test
void end_MarksAllOtherSoftwareSystemsAsExternal_WhenSomeSoftwareSystemsAreMarkedAsInternal() {
ModelDslContext context = new ModelDslContext();
context.setWorkspace(workspace);
workspace.getModel().setEnterprise(new Enterprise("Name"));
SoftwareSystem softwareSystem1 = workspace.getModel().addSoftwareSystem("Name 1");
SoftwareSystem softwareSystem2 = workspace.getModel().addSoftwareSystem("Name 2");
softwareSystem1.setLocation(Location.Internal);
assertEquals(Location.Internal, softwareSystem1.getLocation());
assertEquals(Location.Unspecified, softwareSystem2.getLocation());
context.end();
assertEquals(Location.Internal, softwareSystem1.getLocation());
assertEquals(Location.External, softwareSystem2.getLocation());
}
Aggregations