use of com.structurizr.model.Container in project dsl by structurizr.
the class ComponentParserTests method test_parse_CreatesAComponentWithADescriptionAndTechnologyAndTags.
@Test
void test_parse_CreatesAComponentWithADescriptionAndTechnologyAndTags() {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "Description");
Container container = softwareSystem.addContainer("Container", "Description", "Technology");
ContainerDslContext context = new ContainerDslContext(container);
parser.parse(context, tokens("component", "Name", "Description", "Technology", "Tag 1, Tag 2"));
assertEquals(3, model.getElements().size());
Component component = container.getComponentWithName("Name");
assertNotNull(component);
assertEquals("Description", component.getDescription());
assertEquals("Technology", component.getTechnology());
assertEquals("Element,Component,Tag 1,Tag 2", component.getTags());
}
use of com.structurizr.model.Container in project dsl by structurizr.
the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithContainerScope.
@Test
void test_parse_CreatesADynamicViewWithContainerScope() {
DslContext context = context();
IdentifiersRegister elements = new IdentifiersRegister();
Container container = model.addSoftwareSystem("Name", "Description").addContainer("Container", "Description", "Technology");
elements.register("container", container);
context.setIdentifierRegister(elements);
parser.parse(context, tokens("dynamic", "container"));
List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
assertEquals(1, views.size());
assertEquals("Name-Container-Dynamic-001", views.get(0).getKey());
assertEquals("", views.get(0).getDescription());
assertSame(container, views.get(0).getElement());
}
use of com.structurizr.model.Container in project java by structurizr.
the class DefaultLayoutMergeStrategyTests method test_copyLayoutInformation_WhenAParentElementNameHasChanged.
@Test
public void test_copyLayoutInformation_WhenAParentElementNameHasChanged() {
Workspace workspace1 = new Workspace("1", "");
SoftwareSystem softwareSystem1 = workspace1.getModel().addSoftwareSystem("Software System");
Container container1 = softwareSystem1.addContainer("Container", "", "");
ContainerView view1 = workspace1.getViews().createContainerView(softwareSystem1, "key", "");
view1.add(container1);
view1.getElementView(container1).setX(123);
view1.getElementView(container1).setY(456);
Workspace workspace2 = new Workspace("2", "");
SoftwareSystem softwareSystem2 = workspace2.getModel().addSoftwareSystem("Software System with a new name");
Container container2 = softwareSystem2.addContainer("Container", "", "");
ContainerView view2 = workspace2.getViews().createContainerView(softwareSystem2, "key", "");
view2.add(container2);
DefaultLayoutMergeStrategy strategy = new DefaultLayoutMergeStrategy();
strategy.copyLayoutInformation(view1, view2);
assertEquals(123, view2.getElementView(container2).getX());
assertEquals(456, view2.getElementView(container2).getY());
}
use of com.structurizr.model.Container in project java by structurizr.
the class WorkspaceTests method test_countAndLogWarnings.
@Test
public void test_countAndLogWarnings() {
Workspace workspace = new Workspace("Name", "Description");
SoftwareSystem softwareSystem1 = workspace.getModel().addSoftwareSystem("Software System 1", null);
SoftwareSystem softwareSystem2 = workspace.getModel().addSoftwareSystem("Software System 2", " ");
Container container1 = softwareSystem1.addContainer("Name", "Description", null);
Container container2 = softwareSystem2.addContainer("Name", "Description", " ");
container1.uses(container2, null, null);
container2.uses(container1, " ", " ");
Component component1A = container1.addComponent("A", null, null);
Component component1B = container1.addComponent("B", "", "");
component1A.uses(component1B, null);
component1B.uses(component1A, "");
assertEquals(10, workspace.countAndLogWarnings());
}
Aggregations