From 7ac6fd5ca0116bedcdcf4eb1ff84e939721c1ae4 Mon Sep 17 00:00:00 2001 From: gcornacchia Date: Thu, 7 Dec 2023 17:23:40 +0100 Subject: [PATCH] added rendering description field in Deployment_Node () --- .../export/plantuml/C4PlantUMLExporter.java | 7 ++++- .../C4PlantUMLDiagramExporterTests.java | 2 +- .../36141-DevelopmentDeployment.puml | 16 ++++++------ .../c4plantuml/36141-LiveDeployment.puml | 26 +++++++++---------- ...-AmazonWebServicesDeployment-WithTags.puml | 12 ++++----- ...azonWebServicesDeployment-WithoutTags.puml | 12 ++++----- .../printProperties-deploymentView.puml | 2 +- 7 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/structurizr/export/plantuml/C4PlantUMLExporter.java b/src/main/java/com/structurizr/export/plantuml/C4PlantUMLExporter.java index 1d7d87a..bf67727 100644 --- a/src/main/java/com/structurizr/export/plantuml/C4PlantUMLExporter.java +++ b/src/main/java/com/structurizr/export/plantuml/C4PlantUMLExporter.java @@ -386,13 +386,18 @@ protected void startDeploymentNodeBoundary(DeploymentView view, DeploymentNode d if (StringUtils.isNullOrEmpty(technology)) { technology = ""; } + String description = deploymentNode.getDescription(); + if (StringUtils.isNullOrEmpty(description)) { + description = ""; + } // Deployment_Node(alias, label, ?type, ?descr, ?sprite, ?tags, ?link) writer.writeLine( - format("Deployment_Node(%s, \"%s\", $type=\"%s\", $tags=\"%s\", $link=\"%s\") {", + format("Deployment_Node(%s, \"%s\", $type=\"%s\", $descr=\"%s\", $tags=\"%s\", $link=\"%s\") {", idOf(deploymentNode), deploymentNode.getName() + (!"1".equals(deploymentNode.getInstances()) ? " (x" + deploymentNode.getInstances() + ")" : ""), technology, + description, tagsOf(view, deploymentNode), url ) diff --git a/src/test/java/com/structurizr/export/plantuml/C4PlantUMLDiagramExporterTests.java b/src/test/java/com/structurizr/export/plantuml/C4PlantUMLDiagramExporterTests.java index 916af8e..a80ac46 100644 --- a/src/test/java/com/structurizr/export/plantuml/C4PlantUMLDiagramExporterTests.java +++ b/src/test/java/com/structurizr/export/plantuml/C4PlantUMLDiagramExporterTests.java @@ -378,7 +378,7 @@ public void test_renderInfrastructureNodeWithTechnology() { "!include \n" + "!include \n" + "\n" + - "Deployment_Node(Default.Deploymentnode, \"Deployment node\", $type=\"\", $tags=\"\", $link=\"\") {\n" + + "Deployment_Node(Default.Deploymentnode, \"Deployment node\", $type=\"\", $descr=\"\", $tags=\"\", $link=\"\") {\n" + " Deployment_Node(Default.Deploymentnode.Infrastructurenode, \"Infrastructure node\", $type=\"technology\", $descr=\"description\", $tags=\"\", $link=\"\")\n" + "}\n" + "\n" + diff --git a/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-DevelopmentDeployment.puml b/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-DevelopmentDeployment.puml index 44267d6..d3e9a8d 100644 --- a/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-DevelopmentDeployment.puml +++ b/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-DevelopmentDeployment.puml @@ -17,30 +17,30 @@ AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColo AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "") -Deployment_Node(Development.DeveloperLaptop, "Developer Laptop", $type="Microsoft Windows 10 or Apple macOS", $tags="Element", $link="") { - Deployment_Node(Development.DeveloperLaptop.DockerContainerWebServer, "Docker Container - Web Server", $type="Docker", $tags="Element", $link="") { - Deployment_Node(Development.DeveloperLaptop.DockerContainerWebServer.ApacheTomcat, "Apache Tomcat", $type="Apache Tomcat 8.x", $tags="Element", $link="") { +Deployment_Node(Development.DeveloperLaptop, "Developer Laptop", $type="Microsoft Windows 10 or Apple macOS", $descr="A developer laptop.", $tags="Element", $link="") { + Deployment_Node(Development.DeveloperLaptop.DockerContainerWebServer, "Docker Container - Web Server", $type="Docker", $descr="A Docker container.", $tags="Element", $link="") { + Deployment_Node(Development.DeveloperLaptop.DockerContainerWebServer.ApacheTomcat, "Apache Tomcat", $type="Apache Tomcat 8.x", $descr="An open source Java EE web server.", $tags="Element", $link="") { Container(Development.DeveloperLaptop.DockerContainerWebServer.ApacheTomcat.WebApplication_1, "Web Application", $techn="Java and Spring MVC", $descr="Delivers the static content and the Internet banking single page application.", $tags="Container", $link="") Container(Development.DeveloperLaptop.DockerContainerWebServer.ApacheTomcat.APIApplication_1, "API Application", $techn="Java and Spring MVC", $descr="Provides Internet banking functionality via a JSON/HTTPS API.", $tags="Container", $link="") } } - Deployment_Node(Development.DeveloperLaptop.DockerContainerDatabaseServer, "Docker Container - Database Server", $type="Docker", $tags="Element", $link="") { - Deployment_Node(Development.DeveloperLaptop.DockerContainerDatabaseServer.DatabaseServer, "Database Server", $type="Oracle 12c", $tags="Element", $link="") { + Deployment_Node(Development.DeveloperLaptop.DockerContainerDatabaseServer, "Docker Container - Database Server", $type="Docker", $descr="A Docker container.", $tags="Element", $link="") { + Deployment_Node(Development.DeveloperLaptop.DockerContainerDatabaseServer.DatabaseServer, "Database Server", $type="Oracle 12c", $descr="A development database.", $tags="Element", $link="") { ContainerDb(Development.DeveloperLaptop.DockerContainerDatabaseServer.DatabaseServer.Database_1, "Database", $techn="Oracle Database Schema", $descr="Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="Container,Database", $link="") } } - Deployment_Node(Development.DeveloperLaptop.WebBrowser, "Web Browser", $type="Chrome, Firefox, Safari, or Edge", $tags="Element", $link="") { + Deployment_Node(Development.DeveloperLaptop.WebBrowser, "Web Browser", $type="Chrome, Firefox, Safari, or Edge", $descr="", $tags="Element", $link="") { Container(Development.DeveloperLaptop.WebBrowser.SinglePageApplication_1, "Single-Page Application", $techn="JavaScript and Angular", $descr="Provides all of the Internet banking functionality to customers via their web browser.", $tags="Container,Web Browser", $link="") } } -Deployment_Node(Development.BigBankplc, "Big Bank plc", $type="Big Bank plc data center", $tags="Element", $link="") { - Deployment_Node(Development.BigBankplc.bigbankdev001, "bigbank-dev001", $type="", $tags="Element", $link="") { +Deployment_Node(Development.BigBankplc, "Big Bank plc", $type="Big Bank plc data center", $descr="", $tags="Element", $link="") { + Deployment_Node(Development.BigBankplc.bigbankdev001, "bigbank-dev001", $type="", $descr="", $tags="Element", $link="") { System(Development.BigBankplc.bigbankdev001.MainframeBankingSystem_1, "Mainframe Banking System", $descr="Stores all of the core banking information about customers, accounts, transactions, etc.", $tags="Software System,Existing System", $link="") } diff --git a/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-LiveDeployment.puml b/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-LiveDeployment.puml index 1f3cb8f..6a33ec4 100644 --- a/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-LiveDeployment.puml +++ b/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-LiveDeployment.puml @@ -21,45 +21,45 @@ AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295 AddRelTag("Failover", $textColor="#707070", $lineColor="#707070", $lineStyle = "") AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "") -Deployment_Node(Live.Customersmobiledevice, "Customer's mobile device", $type="Apple iOS or Android", $tags="Element", $link="") { +Deployment_Node(Live.Customersmobiledevice, "Customer's mobile device", $type="Apple iOS or Android", $descr="", $tags="Element", $link="") { Container(Live.Customersmobiledevice.MobileApp_1, "Mobile App", $techn="Xamarin", $descr="Provides a limited subset of the Internet banking functionality to customers via their mobile device.", $tags="Container,Mobile App", $link="") } -Deployment_Node(Live.Customerscomputer, "Customer's computer", $type="Microsoft Windows or Apple macOS", $tags="Element", $link="") { - Deployment_Node(Live.Customerscomputer.WebBrowser, "Web Browser", $type="Chrome, Firefox, Safari, or Edge", $tags="Element", $link="") { +Deployment_Node(Live.Customerscomputer, "Customer's computer", $type="Microsoft Windows or Apple macOS", $descr="", $tags="Element", $link="") { + Deployment_Node(Live.Customerscomputer.WebBrowser, "Web Browser", $type="Chrome, Firefox, Safari, or Edge", $descr="", $tags="Element", $link="") { Container(Live.Customerscomputer.WebBrowser.SinglePageApplication_1, "Single-Page Application", $techn="JavaScript and Angular", $descr="Provides all of the Internet banking functionality to customers via their web browser.", $tags="Container,Web Browser", $link="") } } -Deployment_Node(Live.BigBankplc, "Big Bank plc", $type="Big Bank plc data center", $tags="Element", $link="") { - Deployment_Node(Live.BigBankplc.bigbankprod001, "bigbank-prod001", $type="", $tags="Element", $link="") { +Deployment_Node(Live.BigBankplc, "Big Bank plc", $type="Big Bank plc data center", $descr="", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankprod001, "bigbank-prod001", $type="", $descr="", $tags="Element", $link="") { System(Live.BigBankplc.bigbankprod001.MainframeBankingSystem_1, "Mainframe Banking System", $descr="Stores all of the core banking information about customers, accounts, transactions, etc.", $tags="Software System,Existing System", $link="") } - Deployment_Node(Live.BigBankplc.bigbankweb, "bigbank-web*** (x4)", $type="Ubuntu 16.04 LTS", $tags="Element", $link="") { - Deployment_Node(Live.BigBankplc.bigbankweb.ApacheTomcat, "Apache Tomcat", $type="Apache Tomcat 8.x", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankweb, "bigbank-web*** (x4)", $type="Ubuntu 16.04 LTS", $descr="A web server residing in the web server farm, accessed via F5 BIG-IP LTMs.", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankweb.ApacheTomcat, "Apache Tomcat", $type="Apache Tomcat 8.x", $descr="An open source Java EE web server.", $tags="Element", $link="") { Container(Live.BigBankplc.bigbankweb.ApacheTomcat.WebApplication_1, "Web Application", $techn="Java and Spring MVC", $descr="Delivers the static content and the Internet banking single page application.", $tags="Container", $link="") } } - Deployment_Node(Live.BigBankplc.bigbankapi, "bigbank-api*** (x8)", $type="Ubuntu 16.04 LTS", $tags="Element", $link="") { - Deployment_Node(Live.BigBankplc.bigbankapi.ApacheTomcat, "Apache Tomcat", $type="Apache Tomcat 8.x", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankapi, "bigbank-api*** (x8)", $type="Ubuntu 16.04 LTS", $descr="A web server residing in the web server farm, accessed via F5 BIG-IP LTMs.", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankapi.ApacheTomcat, "Apache Tomcat", $type="Apache Tomcat 8.x", $descr="An open source Java EE web server.", $tags="Element", $link="") { Container(Live.BigBankplc.bigbankapi.ApacheTomcat.APIApplication_1, "API Application", $techn="Java and Spring MVC", $descr="Provides Internet banking functionality via a JSON/HTTPS API.", $tags="Container", $link="") } } - Deployment_Node(Live.BigBankplc.bigbankdb01, "bigbank-db01", $type="Ubuntu 16.04 LTS", $tags="Element", $link="") { - Deployment_Node(Live.BigBankplc.bigbankdb01.OraclePrimary, "Oracle - Primary", $type="Oracle 12c", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankdb01, "bigbank-db01", $type="Ubuntu 16.04 LTS", $descr="The primary database server.", $tags="Element", $link="") { + Deployment_Node(Live.BigBankplc.bigbankdb01.OraclePrimary, "Oracle - Primary", $type="Oracle 12c", $descr="The primary, live database server.", $tags="Element", $link="") { ContainerDb(Live.BigBankplc.bigbankdb01.OraclePrimary.Database_1, "Database", $techn="Oracle Database Schema", $descr="Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="Container,Database", $link="") } } - Deployment_Node(Live.BigBankplc.bigbankdb02, "bigbank-db02", $type="Ubuntu 16.04 LTS", $tags="Failover", $link="") { - Deployment_Node(Live.BigBankplc.bigbankdb02.OracleSecondary, "Oracle - Secondary", $type="Oracle 12c", $tags="Failover", $link="") { + Deployment_Node(Live.BigBankplc.bigbankdb02, "bigbank-db02", $type="Ubuntu 16.04 LTS", $descr="The secondary database server.", $tags="Failover", $link="") { + Deployment_Node(Live.BigBankplc.bigbankdb02.OracleSecondary, "Oracle - Secondary", $type="Oracle 12c", $descr="A secondary, standby database server, used for failover purposes only.", $tags="Failover", $link="") { ContainerDb(Live.BigBankplc.bigbankdb02.OracleSecondary.Database_2, "Database", $techn="Oracle Database Schema", $descr="Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="Container,Database,Failover", $link="") } diff --git a/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithTags.puml b/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithTags.puml index 09bd9d5..db81378 100644 --- a/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithTags.puml +++ b/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithTags.puml @@ -22,10 +22,10 @@ AddElementTag("Amazon Web Services - Cloud", $bgColor="#ffffff", $borderColor="# AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "") -Deployment_Node(Live.AmazonWebServices, "Amazon Web Services", $type="", $tags="Amazon Web Services - Cloud", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1, "US-East-1", $type="", $tags="Amazon Web Services - Region", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS, "Amazon RDS", $type="", $tags="Amazon Web Services - RDS", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS.MySQL, "MySQL", $type="", $tags="Amazon Web Services - RDS MySQL instance", $link="") { +Deployment_Node(Live.AmazonWebServices, "Amazon Web Services", $type="", $descr="", $tags="Amazon Web Services - Cloud", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1, "US-East-1", $type="", $descr="", $tags="Amazon Web Services - Region", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS, "Amazon RDS", $type="", $descr="", $tags="Amazon Web Services - RDS", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS.MySQL, "MySQL", $type="", $descr="", $tags="Amazon Web Services - RDS MySQL instance", $link="") { ContainerDb(Live.AmazonWebServices.USEast1.AmazonRDS.MySQL.Database_1, "Database", $techn="Relational database schema", $descr="Stores information regarding the veterinarians, the clients, and their pets.", $tags="Container,Database", $link="") } @@ -33,8 +33,8 @@ Deployment_Node(Live.AmazonWebServices, "Amazon Web Services", $type="", $tags=" Deployment_Node(Live.AmazonWebServices.USEast1.Route53, "Route 53", $type="", $descr="Highly available and scalable cloud DNS service.", $tags="Amazon Web Services - Route 53", $link="") Deployment_Node(Live.AmazonWebServices.USEast1.ElasticLoadBalancer, "Elastic Load Balancer", $type="", $descr="Automatically distributes incoming application traffic.", $tags="Amazon Web Services - Elastic Load Balancing", $link="") - Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup, "Autoscaling group", $type="", $tags="Amazon Web Services - Auto Scaling", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup.AmazonEC2, "Amazon EC2", $type="", $tags="Amazon Web Services - EC2", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup, "Autoscaling group", $type="", $descr="", $tags="Amazon Web Services - Auto Scaling", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup.AmazonEC2, "Amazon EC2", $type="", $descr="", $tags="Amazon Web Services - EC2", $link="") { Container(Live.AmazonWebServices.USEast1.Autoscalinggroup.AmazonEC2.WebApplication_1, "Web Application", $techn="Java and Spring Boot", $descr="Allows employees to view and manage information regarding the veterinarians, the clients, and their pets.", $tags="Container,Application", $link="") } diff --git a/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithoutTags.puml b/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithoutTags.puml index 938421f..f6a6505 100644 --- a/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithoutTags.puml +++ b/src/test/java/com/structurizr/export/plantuml/c4plantuml/54915-AmazonWebServicesDeployment-WithoutTags.puml @@ -9,10 +9,10 @@ left to right direction !include !include -Deployment_Node(Live.AmazonWebServices, "Amazon Web Services", $type="", $tags="", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1, "US-East-1", $type="", $tags="", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS, "Amazon RDS", $type="", $tags="", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS.MySQL, "MySQL", $type="", $tags="", $link="") { +Deployment_Node(Live.AmazonWebServices, "Amazon Web Services", $type="", $descr="", $tags="", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1, "US-East-1", $type="", $descr="", $tags="", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS, "Amazon RDS", $type="", $descr="", $tags="", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.AmazonRDS.MySQL, "MySQL", $type="", $descr="", $tags="", $link="") { ContainerDb(Live.AmazonWebServices.USEast1.AmazonRDS.MySQL.Database_1, "Database", $techn="Relational database schema", $descr="Stores information regarding the veterinarians, the clients, and their pets.", $tags="", $link="") } @@ -20,8 +20,8 @@ Deployment_Node(Live.AmazonWebServices, "Amazon Web Services", $type="", $tags=" Deployment_Node(Live.AmazonWebServices.USEast1.Route53, "Route 53", $type="", $descr="Highly available and scalable cloud DNS service.", $tags="", $link="") Deployment_Node(Live.AmazonWebServices.USEast1.ElasticLoadBalancer, "Elastic Load Balancer", $type="", $descr="Automatically distributes incoming application traffic.", $tags="", $link="") - Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup, "Autoscaling group", $type="", $tags="", $link="") { - Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup.AmazonEC2, "Amazon EC2", $type="", $tags="", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup, "Autoscaling group", $type="", $descr="", $tags="", $link="") { + Deployment_Node(Live.AmazonWebServices.USEast1.Autoscalinggroup.AmazonEC2, "Amazon EC2", $type="", $descr="", $tags="", $link="") { Container(Live.AmazonWebServices.USEast1.Autoscalinggroup.AmazonEC2.WebApplication_1, "Web Application", $techn="Java and Spring Boot", $descr="Allows employees to view and manage information regarding the veterinarians, the clients, and their pets.", $tags="", $link="") } diff --git a/src/test/java/com/structurizr/export/plantuml/c4plantuml/printProperties-deploymentView.puml b/src/test/java/com/structurizr/export/plantuml/c4plantuml/printProperties-deploymentView.puml index 801e058..f96e7c9 100644 --- a/src/test/java/com/structurizr/export/plantuml/c4plantuml/printProperties-deploymentView.puml +++ b/src/test/java/com/structurizr/export/plantuml/c4plantuml/printProperties-deploymentView.puml @@ -10,7 +10,7 @@ top to bottom direction WithoutPropertyHeader() AddProperty("Prop1","Value1") -Deployment_Node(Default.Deploymentnode, "Deployment node", $type="", $tags="", $link="") { +Deployment_Node(Default.Deploymentnode, "Deployment node", $type="", $descr="", $tags="", $link="") { WithoutPropertyHeader() AddProperty("Prop2","Value2") Deployment_Node(Default.Deploymentnode.Infrastructurenode, "Infrastructure node", $type="technology", $descr="description", $tags="", $link="")