Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Fixes #24.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Brown committed Oct 27, 2022
1 parent 060e5e2 commit 438eb31
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.8.0 (unreleased to Maven Central)

- The C4-PlantUML export now mimics how the Structurizr renderer uses tags when a view set property named `c4plantuml.tags` is set to `true`.
- Fixes #24 (plantuml.sequenceDiagrams changes the export of static diagrams).

## 1.7.0 (3rd October 2022)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected boolean includeTitle(View view) {
}

protected boolean useSequenceDiagrams(View view) {
return "true".equalsIgnoreCase(view.getViewSet().getConfiguration().getProperties().getOrDefault(PLANTUML_SEQUENCE_DIAGRAMS_PROPERTY, "false"));
return view instanceof DynamicView && "true".equalsIgnoreCase(view.getViewSet().getConfiguration().getProperties().getOrDefault(PLANTUML_SEQUENCE_DIAGRAMS_PROPERTY, "false"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,4 +922,55 @@ public void testLegend() {
"@enduml", diagram.getLegend().getDefinition());
}

@Test
public void staticDiagramsAreUnchangedWhenSequenceDiagramsAreEnabled() {
Workspace workspace = new Workspace("Name", "Description");
Model model = workspace.getModel();

model.addSoftwareSystem("Software System").setGroup("Group");
SystemLandscapeView view = workspace.getViews().createSystemLandscapeView("key", "Description");
view.addAllElements();

StructurizrPlantUMLExporter exporter = new StructurizrPlantUMLExporter();
Diagram diagram;
String expected = "@startuml\n" +
"title System Landscape\n" +
"\n" +
"top to bottom direction\n" +
"\n" +
"skinparam {\n" +
" shadowing false\n" +
" arrowFontSize 10\n" +
" defaultTextAlignment center\n" +
" wrapWidth 200\n" +
" maxMessageSize 100\n" +
"}\n" +
"\n" +
"hide stereotype\n" +
"\n" +
"skinparam rectangle<<SoftwareSystem>> {\n" +
" BackgroundColor #dddddd\n" +
" FontColor #000000\n" +
" BorderColor #9a9a9a\n" +
"}\n" +
"\n" +
"package \"Group\\n[Group]\" <<group>> {\n" +
" skinparam PackageBorderColor<<group>> #cccccc\n" +
" skinparam PackageFontColor<<group>> #cccccc\n" +
"\n" +
" rectangle \"==Software System\\n<size:10>[Software System]</size>\" <<SoftwareSystem>> as SoftwareSystem\n" +
"}\n" +
"\n" +
"\n" +
"@enduml";

diagram = exporter.export(view);
assertEquals(expected, diagram.getDefinition());

workspace.getViews().getConfiguration().addProperty(StructurizrPlantUMLExporter.PLANTUML_SEQUENCE_DIAGRAMS_PROPERTY, "true");

diagram = exporter.export(view);
assertEquals(expected, diagram.getDefinition());
}

}

0 comments on commit 438eb31

Please sign in to comment.