use of com.structurizr.view.DynamicView in project dsl by structurizr.
the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithContainerScopeAndKey.
@Test
void test_parse_CreatesADynamicViewWithContainerScopeAndKey() {
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", "key"));
List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
assertEquals(1, views.size());
assertEquals("key", views.get(0).getKey());
assertEquals("", views.get(0).getDescription());
assertSame(container, views.get(0).getElement());
}
use of com.structurizr.view.DynamicView in project dsl by structurizr.
the class DynamicViewParserTests method test_parse_GeneratesAKey_WhenTheKeyIsMissing.
@Test
void test_parse_GeneratesAKey_WhenTheKeyIsMissing() {
DslContext context = context();
DynamicView view = parser.parse(context, tokens("dynamic", "*"));
assertEquals("Dynamic-001", view.getKey());
}
use of com.structurizr.view.DynamicView in project dsl by structurizr.
the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithSoftwareSystemScopeAndKeyAndDescription.
@Test
void test_parse_CreatesADynamicViewWithSoftwareSystemScopeAndKeyAndDescription() {
DslContext context = context();
IdentifiersRegister elements = new IdentifiersRegister();
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
elements.register("softwaresystem", softwareSystem);
context.setIdentifierRegister(elements);
parser.parse(context, tokens("dynamic", "softwareSystem", "key", "Description"));
List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
assertEquals(1, views.size());
assertEquals("key", views.get(0).getKey());
assertEquals("Description", views.get(0).getDescription());
assertSame(softwareSystem, views.get(0).getElement());
}
use of com.structurizr.view.DynamicView in project dsl by structurizr.
the class DynamicViewParserTests method test_parse_CreatesADynamicViewWithContainerScopeAndKeyAndDescription.
@Test
void test_parse_CreatesADynamicViewWithContainerScopeAndKeyAndDescription() {
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", "key", "Description"));
List<DynamicView> views = new ArrayList<>(this.views.getDynamicViews());
assertEquals(1, views.size());
assertEquals("key", views.get(0).getKey());
assertEquals("Description", views.get(0).getDescription());
assertSame(container, views.get(0).getElement());
}
use of com.structurizr.view.DynamicView in project dsl by structurizr.
the class ViewParserTests method test_parseDescription_SetsTheTitleOfADynamicView.
@Test
void test_parseDescription_SetsTheTitleOfADynamicView() {
DynamicView view = workspace.getViews().createDynamicView("key", "description");
DynamicViewDslContext context = new DynamicViewDslContext(view);
context.setWorkspace(workspace);
assertEquals("description", view.getDescription());
parser.parseDescription(context, tokens("description", "A new description"));
assertEquals("A new description", view.getDescription());
}
Aggregations