use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parseUrl_SetsTheUrl_WhenAUrlIsSpecified.
@Test
void test_parseUrl_SetsTheUrl_WhenAUrlIsSpecified() {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
parser.parseUrl(context, tokens("url", "http://example.com"));
assertEquals("http://example.com", softwareSystem.getUrl());
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parsePerspective_AddsThePerspective_WhenAValueIsSpecified.
@Test
void test_parsePerspective_AddsThePerspective_WhenAValueIsSpecified() {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
ModelItemPerspectivesDslContext context = new ModelItemPerspectivesDslContext(softwareSystem);
parser.parsePerspective(context, tokens("Security", "Description"));
assertEquals("Description", softwareSystem.getPerspectives().stream().filter(p -> p.getName().equals("Security")).findFirst().get().getDescription());
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parsePerspective_ThrowsAnException_WhenNoDescriptionIsSpecified.
@Test
void test_parsePerspective_ThrowsAnException_WhenNoDescriptionIsSpecified() {
try {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
ModelItemPerspectivesDslContext context = new ModelItemPerspectivesDslContext(softwareSystem);
parser.parsePerspective(context, tokens("name"));
fail();
} catch (Exception e) {
assertEquals("Expected: <name> <description>", e.getMessage());
}
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ComponentParserTests method test_parse_CreatesAComponentWithADescription.
@Test
void test_parse_CreatesAComponentWithADescription() {
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"));
assertEquals(3, model.getElements().size());
Component component = container.getComponentWithName("Name");
assertNotNull(component);
assertEquals("Description", component.getDescription());
assertEquals(null, component.getTechnology());
assertEquals("Element,Component", component.getTags());
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ComponentParserTests method test_parse_CreatesAComponent.
@Test
void test_parse_CreatesAComponent() {
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"));
assertEquals(3, model.getElements().size());
Component component = container.getComponentWithName("Name");
assertNotNull(component);
assertEquals("", component.getDescription());
assertEquals(null, component.getTechnology());
assertEquals("Element,Component", component.getTags());
}
Aggregations