Skip to content

Commit

Permalink
Update Docs and prepare version 13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskn committed Dec 8, 2024
1 parent d680491 commit cb894df
Show file tree
Hide file tree
Showing 24 changed files with 829 additions and 1,434 deletions.
328 changes: 201 additions & 127 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = "io.github.chriskn"
version = "0.12.1"
version = "0.13.1"
java.sourceCompatibility = JavaVersion.VERSION_17

repositories {
Expand Down
2 changes: 1 addition & 1 deletion docs/container_example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/deployment_example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/dynamic_example_nested.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,237 changes: 0 additions & 1,237 deletions docs/dynamic_example_nested.svg

This file was deleted.

2 changes: 1 addition & 1 deletion docs/dynamic_example_nested_as_sequence.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,9 @@ internal object StyleWriter {
if (scaleString.isBlank()) {
""""$url""""
} else {
""""$url,$scaleString""""
""""$url{$scaleString}""""
}
}

else -> throw IllegalArgumentException("Unknown sprite type ${this::class}")
}

private fun spriteString(
Expand Down
496 changes: 495 additions & 1 deletion src/main/resources/sprites/k8s_stdlib_sprites.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.github.chriskn.structurizrextension.api.view.layout.DependencyConfigu
import com.github.chriskn.structurizrextension.api.view.layout.Direction.Right
import com.github.chriskn.structurizrextension.api.view.layout.Layout.LeftToRight
import com.github.chriskn.structurizrextension.api.view.sprite.library.SpriteLibrary
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.PlantUmlSprite
import com.github.chriskn.structurizrextension.assertExpectedDiagramWasWrittenForView
import com.structurizr.Workspace
import com.structurizr.model.Container
Expand Down Expand Up @@ -97,33 +98,39 @@ class DeploymentViewTest {
"Web App POD"
).deploymentNode(
"Web App container",
sprite = SpriteLibrary.spriteByName("logos-docker-icon"),
sprite = SpriteLibrary.spriteByName("logos-docker-img"),
hostsContainers = listOf(webApplication)
)
val jaegerSprite = (
SpriteLibrary.spriteByName("tupadr3-devicons2-jaegertracing") as PlantUmlSprite
).copy(color = "lightblue")
val jaegerSidecar = webAppPod.infrastructureNode(
"Jaeger Sidecar",
"Jaeger sidecar sending Traces",
sprite = SpriteLibrary.spriteByName("tupadr3-devicons2-jaegertracing")
sprite = jaegerSprite
)
model.deploymentNode(
val aws2 = model.deploymentNode(
"Another AWS Account",
sprite = SpriteLibrary.spriteByName("aws-groups-AWSCloudAlt")
).deploymentNode(
"Jaeger Container",
)
val jaegerContainer = aws2.deploymentNode(
name = "Jaeger Container",
sprite = SpriteLibrary.spriteByName("logos-docker-img"),
usedBy = listOf(
Dependency(
jaegerSidecar,
"writes traces to",
interactionStyle = Asynchronous,
sprite = SpriteLibrary.spriteByName("logos-kafka-icon"),
link = "https://www.jaegertracing.io/",
sprite = SpriteLibrary.spriteByName("k8s-KubernetesCronjob"),
properties = C4Properties(
header = listOf("key", "value"),
values = listOf(listOf("ip", "10.234.12.13"))
)
)
)
).infrastructureNode("Jaeger")
)
jaegerContainer.infrastructureNode("Jaeger", sprite = jaegerSprite)
val appleDevice = model.deploymentNode(
"Apple Device",
sprite = SpriteLibrary.spriteByName("tupadr3-devicons-apple"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.github.chriskn.structurizrextension.view

import com.github.chriskn.structurizrextension.api.model.C4Properties
import com.github.chriskn.structurizrextension.api.model.C4Type
import com.github.chriskn.structurizrextension.api.model.C4Type.DATABASE
import com.github.chriskn.structurizrextension.api.model.C4Type.QUEUE
import com.github.chriskn.structurizrextension.api.model.Dependency
import com.github.chriskn.structurizrextension.api.model.component
import com.github.chriskn.structurizrextension.api.model.container
Expand All @@ -18,6 +19,7 @@ import com.github.chriskn.structurizrextension.api.view.layout.Direction.Right
import com.github.chriskn.structurizrextension.api.view.layout.Mode.Neighbor
import com.github.chriskn.structurizrextension.api.view.showExternalBoundaries
import com.github.chriskn.structurizrextension.api.view.sprite.library.SpriteLibrary
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.ImageSprite
import com.github.chriskn.structurizrextension.assertExpectedDiagramWasWrittenForView
import com.structurizr.Workspace
import com.structurizr.model.InteractionStyle.Asynchronous
Expand Down Expand Up @@ -89,9 +91,9 @@ class DynamicViewTest {
fun `DynamicWithLayout is written to plant uml as expected`(asSequenceDiagram: Boolean) {
val diagramKey = determineDiagramPath("DynamicWithLayout", asSequenceDiagram)
val dynamicView: DynamicView = workspace.views.dynamicView(
customerInformationSystem,
diagramKey,
"This diagram shows what happens when a customer updates their details",
system = customerInformationSystem,
key = diagramKey,
description = "This diagram shows what happens when a customer updates their details",
layout = C4PlantUmlLayout(
dependencyConfigurations = listOf(
DependencyConfiguration(
Expand All @@ -101,12 +103,46 @@ class DynamicViewTest {
DependencyConfiguration(
filter = { it.source == customerService && it.destination == customerFrontend },
direction = Left
),
DependencyConfiguration(
filter = { it.source == customer },
direction = Right
),
DependencyConfiguration(
filter = { it.destination == customer },
direction = Left
)
)
)
)

configureWithNestedParallelNumbering(dynamicView)
dynamicView.add(source = customer, destination = customerFrontend, description = "Uses")
dynamicView.add(
source = customerFrontend,
destination = customerService,
description = "Updates customer information using"
)
dynamicView.add(source = customerService, destination = customerDatabase, description = "Stores data in")
dynamicView.add(
source = customerService,
destination = messageBus,
description = "Sends customer update events to"
)
with(dynamicView.startNestedParallelSequence()) {
add(source = messageBus, destination = reportingService, description = "Sends customer update events to")
with(this.startNestedParallelSequence()) {
add(source = reportingService, destination = reportingDatabase, description = "Stores data in")
endParallelSequence()
}
add(source = messageBus, destination = auditingService, description = "Sends customer update events to")
with(this.startNestedParallelSequence()) {
add(source = auditingService, destination = auditStore, description = "Stores events in")
endParallelSequence()
}
add(source = customerService, destination = customerFrontend, description = "Confirms update to")
endParallelSequence()
}
dynamicView.add(source = customerFrontend, destination = customer, description = "Sends feedback to")
dynamicView.renderAsSequenceDiagram = asSequenceDiagram

assertExpectedDiagramWasWrittenForView(workspace, pathToExpectedDiagrams, diagramKey)
Expand Down Expand Up @@ -282,14 +318,17 @@ class DynamicViewTest {
"Customer Database",
"Stores customer information",
technology = "Oracle",
c4Type = C4Type.DATABASE,
sprite = SpriteLibrary.spriteByName("tupadr3-devicons2-oracle-original"),
c4Type = DATABASE,
usedBy = listOf(Dependency(customerService, "", technology = "JDBC", link = "www.google.com"))
)
val rabbitMqSprite = SpriteLibrary.spriteByName("logos-rabbitmq-icon-img") as ImageSprite
private val messageBus = customerInformationSystem.container(
"Message Bus",
"Transport for business events.",
technology = "RabbitMQ",
c4Type = C4Type.QUEUE,
c4Type = QUEUE,
sprite = rabbitMqSprite.copy(scale = 0.3),
usedBy = listOf(
Dependency(
customerService,
Expand All @@ -312,8 +351,9 @@ class DynamicViewTest {
"Reporting Database",
"Stores a normalised version of all business data for ad hoc reporting purposes",
technology = "MySql",
c4Type = C4Type.DATABASE,
usedBy = listOf(Dependency(reportingService, "", sprite = SpriteLibrary.spriteByName("tupadr3-devicons-mysql")))
c4Type = DATABASE,
sprite = SpriteLibrary.spriteByName("tupadr3-devicons-mysql"),
usedBy = listOf(Dependency(reportingService, ""))
)
private val auditingService = customerInformationSystem.container(
"Auditing Service",
Expand All @@ -325,7 +365,7 @@ class DynamicViewTest {
"Audit Store",
"Stores information about events that have happened",
technology = "Event Store",
c4Type = C4Type.DATABASE,
c4Type = DATABASE,
usedBy = listOf(Dependency(auditingService, ""))
)
private val reportingController = reportingService.component(
Expand All @@ -337,6 +377,8 @@ class DynamicViewTest {
"Reporting Repository",
"Reporting repository",
technology = "JDBC",
usedBy = listOf(Dependency(reportingController, ""))
usedBy = listOf(
Dependency(reportingController, "", sprite = SpriteLibrary.spriteByName("tupadr3-devicons2-openapi"))
)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class StyleIntegrationTest {
technology = "REST",
c4Shape = ROUNDED_BOX,
sprite = OpenIconicSprite("&compass"),
legendSprite = OpenIconicSprite("&compass"),
legendSprite = OpenIconicSprite("&compass", scale = 1.1, color = "red"),
legendText = "this is a legend text"
)
private val androidSprite = SpriteLibrary.spriteByName(
Expand Down
15 changes: 8 additions & 7 deletions src/test/resources/expected/view/deployment/Deployment.puml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@startuml(id=Deployment)
!define GILBARBARA_PNG_URL https://raw.githubusercontent.com/plantuml-stdlib/gilbarbara-plantuml-sprites/v1.1/pngs
!includeurl https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
!includeurl <awslib14/AWSCommon>
!includeurl <k8s/Common>
!includeurl <awslib14/Containers/EKSCloud>
!includeurl <awslib14/Database/AuroraPostgreSQLInstance>
!includeurl <awslib14/Groups/AWSCloudAlt>
!includeurl <logos/docker-icon>
!includeurl <logos/kafka-icon>
!includeurl <k8s/OSS/KubernetesCronjob>
!includeurl <logos/nginx>
!includeurl <logos/postgresql>
!includeurl <logos/spring>
Expand Down Expand Up @@ -35,8 +36,8 @@ Node(Default.AWS, "AWS", "", "Production AWS environment", $sprite="AWSCloudAlt,
}
Node(Default.AWS.EKScluster, "EKS cluster", "", "", $sprite="EKSCloud,color=#ed7100") {
Node(Default.AWS.EKScluster.mywebapp, "my.web.app", "", "Web App POD", "") {
Node(Default.AWS.EKScluster.mywebapp.WebAppcontainer, "Web App container", "", "", $sprite="docker-icon") {
Node(Default.AWS.EKScluster.mywebapp.WebAppcontainer.JaegerSidecar, "Jaeger Sidecar", "", "Jaeger sidecar sending Traces", $sprite="jaegertracing")
Node(Default.AWS.EKScluster.mywebapp.WebAppcontainer, "Web App container", "", "", $sprite="img:GILBARBARA_PNG_URL/docker.png") {
Node(Default.AWS.EKScluster.mywebapp.WebAppcontainer.JaegerSidecar, "Jaeger Sidecar", "", "Jaeger sidecar sending Traces", $sprite="jaegertracing,color=#add8e6")
Container(Default.AWS.EKScluster.mywebapp.WebAppcontainer.WebApplication_1, "Web Application", "Java and Spring MVC", "Spring Boot web application", $sprite="spring")
}
}
Expand All @@ -46,8 +47,8 @@ Node(Default.AWS, "AWS", "", "Production AWS environment", $sprite="AWSCloudAlt,
}
}
Node(Default.AnotherAWSAccount, "Another AWS Account", "", "", $sprite="AWSCloudAlt,color=#232f3e") {
Node(Default.AnotherAWSAccount.JaegerContainer, "Jaeger Container", "", "", "") {
Node(Default.AnotherAWSAccount.JaegerContainer.Jaeger, "Jaeger", "", "", "")
Node(Default.AnotherAWSAccount.JaegerContainer, "Jaeger Container", "", "", $sprite="img:GILBARBARA_PNG_URL/docker.png") {
Node(Default.AnotherAWSAccount.JaegerContainer.Jaeger, "Jaeger", "", "", $sprite="jaegertracing,color=#add8e6")
}
}
Node(Default.AppleDevice, "Apple Device", "", "", $sprite="apple") {
Expand All @@ -57,7 +58,7 @@ Rel(Default.AppleDevice, Default.AWS.EKScluster.LoadBalancer, "requests data fro
Rel_R(Default.AWS.AWSRDS.Database_1, Default.AWS.AWSRDS.FailoverDatabase_1, "replicates data to")
SetPropertyHeader("key", "value")
AddProperty("ip", "10.234.12.13")
Rel(Default.AWS.EKScluster.mywebapp.WebAppcontainer.JaegerSidecar, Default.AnotherAWSAccount.JaegerContainer, "writes traces to", $sprite="kafka-icon", $link="https://www.jaegertracing.io/", $tags="async relationship")
Rel(Default.AWS.EKScluster.mywebapp.WebAppcontainer.JaegerSidecar, Default.AnotherAWSAccount.JaegerContainer, "writes traces to", $sprite="KubernetesCronjob,color=#66abdd", $link="https://www.jaegertracing.io/", $tags="async relationship")
Rel_R(Default.AWS.EKScluster.LoadBalancer, Default.AWS.EKScluster.mywebapp.WebAppcontainer, "forwards requests to")
Rel(Default.AWS.EKScluster.mywebapp.WebAppcontainer.WebApplication_1, Default.AWS.AWSRDS.Database_1, "stores data in", "JDBC")

Expand Down
10 changes: 6 additions & 4 deletions src/test/resources/expected/view/dynamic/DynamicView.puml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@startuml(id=DynamicView)
!define GILBARBARA_PNG_URL https://raw.githubusercontent.com/plantuml-stdlib/gilbarbara-plantuml-sprites/v1.1/pngs
!includeurl https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml
!includeurl <tupadr3/devicons/mysql>
!includeurl <tupadr3/devicons2/oracle_original>

title Customer Information System - Dynamic
caption desc
Expand All @@ -13,10 +15,10 @@ AddRelTag("async relationship", $lineStyle=DashedLine(), $legendText=async relat
Person(Customer, "Customer", "A costumer", "")
Container(CustomerInformationSystem.CustomerFrontendApplication, "Customer Frontend Application", "Angular", "Allows customers to manage their profile", "")
Container(CustomerInformationSystem.CustomerService, "Customer Service", "Java and Spring Boot", "The point of access for customer information.", "")
ContainerDb(CustomerInformationSystem.CustomerDatabase, "Customer Database", "Oracle", "Stores customer information", "")
ContainerQueue(CustomerInformationSystem.MessageBus, "Message Bus", "RabbitMQ", "Transport for business events.", "")
ContainerDb(CustomerInformationSystem.CustomerDatabase, "Customer Database", "Oracle", "Stores customer information", $sprite="oracle_original")
ContainerQueue(CustomerInformationSystem.MessageBus, "Message Bus", "RabbitMQ", "Transport for business events.", $sprite="img:GILBARBARA_PNG_URL/rabbitmq-icon.png{scale=0.3}")
Container(CustomerInformationSystem.ReportingService, "Reporting Service", "Ruby", "Creates normalised data for reporting purposes.", "")
ContainerDb(CustomerInformationSystem.ReportingDatabase, "Reporting Database", "MySql", "Stores a normalised version of all business data for ad hoc reporting purposes", "")
ContainerDb(CustomerInformationSystem.ReportingDatabase, "Reporting Database", "MySql", "Stores a normalised version of all business data for ad hoc reporting purposes", $sprite="mysql")
Container(CustomerInformationSystem.AuditingService, "Auditing Service", "C#, Net", "Provides organisation-wide auditing facilities.", "")
ContainerDb(CustomerInformationSystem.AuditStore, "Audit Store", "Event Store", "Stores information about events that have happened", "")
RelIndex(1,Customer, CustomerInformationSystem.CustomerFrontendApplication, "Uses")
Expand All @@ -26,7 +28,7 @@ SetPropertyHeader("field", "value")
AddProperty("Event Type", "create")
RelIndex(4,CustomerInformationSystem.CustomerService, CustomerInformationSystem.MessageBus, "Sends customer update events to", $tags="async relationship")
RelIndex(5.1,CustomerInformationSystem.MessageBus, CustomerInformationSystem.ReportingService, "Sends customer update events to", $tags="async relationship")
RelIndex(5.1.1,CustomerInformationSystem.ReportingService, CustomerInformationSystem.ReportingDatabase, "Stores data in", $sprite="mysql")
RelIndex(5.1.1,CustomerInformationSystem.ReportingService, CustomerInformationSystem.ReportingDatabase, "Stores data in")
RelIndex(5.2,CustomerInformationSystem.MessageBus, CustomerInformationSystem.AuditingService, "Sends customer update events to", $tags="async relationship")
RelIndex(5.2.1,CustomerInformationSystem.AuditingService, CustomerInformationSystem.AuditStore, "Stores events in")
RelIndex(5.3,CustomerInformationSystem.CustomerService, CustomerInformationSystem.CustomerFrontendApplication, "Confirms update to", "WebSocket", $link="www.bing.com", $tags="async relationship")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@startuml(id=DynamicWithBoundary)
!includeurl https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml
!includeurl <tupadr3/devicons2/openapi>

title Reporting Service - Dynamic
caption This diagram shows what happens when a customer updates their details
Expand All @@ -8,12 +9,12 @@ SHOW_PERSON_OUTLINE()
LAYOUT_TOP_DOWN()

System_Boundary(CustomerInformationSystem, Customer Information System) {
Container_Boundary("CustomerInformationSystem.ReportingService_boundary", "Reporting Service") {
Container_Boundary("CustomerInformationSystem.ReportingService_boundary", "Reporting Service" ){
Component(CustomerInformationSystem.ReportingService.ReportingController, "Reporting Controller", "REST", "Reporting Controller", "")
Component(CustomerInformationSystem.ReportingService.ReportingRepository, "Reporting Repository", "JDBC", "Reporting repository", "")
}
}
RelIndex(1,CustomerInformationSystem.ReportingService.ReportingController, CustomerInformationSystem.ReportingService.ReportingRepository, "Stores entity")
RelIndex(1,CustomerInformationSystem.ReportingService.ReportingController, CustomerInformationSystem.ReportingService.ReportingRepository, "Stores entity", $sprite="openapi")

SHOW_LEGEND(true)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
@startuml(id=DynamicWithBoundarySequence)
!includeurl https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml
!includeurl <tupadr3/devicons2/openapi>

title Reporting Service - Dynamic
caption This diagram shows what happens when a customer updates their details

SHOW_PERSON_OUTLINE()

System_Boundary(CustomerInformationSystem, Customer Information System)
Container_Boundary("CustomerInformationSystem.ReportingService_boundary", "Reporting Service")
Container_Boundary("CustomerInformationSystem.ReportingService_boundary", "Reporting Service" )
Component(CustomerInformationSystem.ReportingService.ReportingController, "Reporting Controller", "REST", "Reporting Controller", "")
Component(CustomerInformationSystem.ReportingService.ReportingRepository, "Reporting Repository", "JDBC", "Reporting repository", "")
Boundary_End()
Boundary_End()
Rel(CustomerInformationSystem.ReportingService.ReportingController, CustomerInformationSystem.ReportingService.ReportingRepository, "1 Stores entity" )
Rel(CustomerInformationSystem.ReportingService.ReportingController, CustomerInformationSystem.ReportingService.ReportingRepository, "1 Stores entity" , $sprite="openapi")

SHOW_LEGEND(true)

Expand Down
Loading

0 comments on commit cb894df

Please sign in to comment.