Skip to content

Commit

Permalink
Adds an example and test for the new dynamic view parallel sequences …
Browse files Browse the repository at this point in the history
…syntax.
  • Loading branch information
simonbrowndotje committed Sep 11, 2024
1 parent aef27cc commit 87b6ff5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions structurizr-dsl/src/test/java/com/structurizr/dsl/DslTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,21 @@ void test_parallel2() throws Exception {
assertEquals("3", relationships.get(3).getOrder());
}

@Test
void test_parallel3() throws Exception {
StructurizrDslParser parser = new StructurizrDslParser();
parser.parse(new File("src/test/resources/dsl/parallel3.dsl"));

assertFalse(parser.getWorkspace().isEmpty());
DynamicView view = parser.getWorkspace().getViews().getDynamicViews().iterator().next();
List<RelationshipView> relationships = new ArrayList<>(view.getRelationships());
assertEquals(4, relationships.size());
assertEquals("1", relationships.get(0).getOrder());
assertEquals("2", relationships.get(1).getOrder());
assertEquals("2", relationships.get(2).getOrder());
assertEquals("3", relationships.get(3).getOrder());
}

@Test
void test_groups() throws Exception {
StructurizrDslParser parser = new StructurizrDslParser();
Expand Down
28 changes: 28 additions & 0 deletions structurizr-dsl/src/test/resources/dsl/parallel3.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
workspace {

model {
a = softwareSystem "A"
b = softwareSystem "B"
c = softwareSystem "C"
d = softwareSystem "D"
e = softwareSystem "E"

a -> b
b -> c
b -> d
b -> e
}

views {

dynamic * {
1: a -> b "Makes a request to"
2: b -> c "Gets data from"
2: b -> d "Gets data from"
3: b -> e "Sends data to"

autoLayout
}
}

}

0 comments on commit 87b6ff5

Please sign in to comment.