diff --git a/examples/banking-plantuml/architecture.test.ts b/examples/banking-plantuml/architecture.test.ts index 8327f59..f64e1ee 100644 --- a/examples/banking-plantuml/architecture.test.ts +++ b/examples/banking-plantuml/architecture.test.ts @@ -95,7 +95,9 @@ describe("Architecture", () => { if ( items && !items.every((i: string) => - config.sections.some((s) => s.prod_value === i), + config.sections.some( + (s) => s.prod_value === unescapePlantUmlUrl(i), + ), ) ) { log = `${log}❌ ${relation.to.name} ${items}`; @@ -135,7 +137,9 @@ describe("Architecture", () => { ?.split(", ") .every( (i: string) => - i.startsWith("https://gateway.int.com:443/") || /-v\d$/.exec(i), + unescapePlantUmlUrl(i).startsWith( + "https://gateway.int.com:443/", + ) || /-v\d$/.exec(i), ) ) { log = `${log}❌ ${r.to.name}`; @@ -147,6 +151,10 @@ describe("Architecture", () => { expect(pass).toBeTruthy(); }); + function unescapePlantUmlUrl(url: string): string { + return url.replaceAll(/:~\/~?\//g, "://"); + } + function checkSections( config: DeployConfig, containerFromPuml: Container, @@ -157,13 +165,16 @@ describe("Architecture", () => { config.sections.every((section) => { const result = containerFromPuml.relations.some((r) => { + const technology = r.technology + ? unescapePlantUmlUrl(r.technology) + : undefined; let result = false; if (r.tags?.includes(AsyncTag)) - result = r.technology?.includes(section.prod_value) === true; + result = technology?.includes(section.prod_value) === true; if (!result && (!r.tags || r.tags.includes(RestTag))) result = r.to.name === section.name && - (r.technology?.includes(section.prod_value) || + (technology?.includes(section.prod_value) || r.to.type !== SystemExternalType); return result; }) || @@ -172,7 +183,10 @@ describe("Architecture", () => { (r) => r.to.name === config.name && section.prod_value && - r.technology?.includes(section.prod_value), + (r.technology + ? unescapePlantUmlUrl(r.technology) + : "" + ).includes(section.prod_value), ), ); if (!result && verbose) @@ -189,13 +203,16 @@ describe("Architecture", () => { ), ), ].every((relation) => { + const technology = relation.technology + ? unescapePlantUmlUrl(relation.technology) + : undefined; const result = relation.to.name.endsWith("_db") || config.sections.some( (configSection) => configSection.name === relation.to.name || (configSection.prod_value && - relation.technology?.includes(configSection.prod_value)), + technology?.includes(configSection.prod_value)), ); if (!result && verbose) diff --git a/resources/architecture/C4L2.puml b/resources/architecture/C4L2.puml index 65a6ad6..1de2a08 100644 --- a/resources/architecture/C4L2.puml +++ b/resources/architecture/C4L2.puml @@ -32,11 +32,11 @@ Boundary(our_system, "Our system"){ Rel(front, bff, "") Rel(bff, camunda, "") Rel(camunda, stock_acl, "") -Rel(stock_acl, stock, "", "https://gateway.int.com:443/stock/v1") +Rel(stock_acl, stock, "", "https:~/~/gateway.int.com:443/stock/v1") Rel(bff, goods_acl, "") -Rel(goods_acl, goods_repository, "", "https://gateway.int.com:443/goods/v1") -Rel(goods_acl, goods2_repository, "", "https://gateway.int.com:443/goods2/v1") +Rel(goods_acl, goods_repository, "", "https:~/~/gateway.int.com:443/goods/v1") +Rel(goods_acl, goods2_repository, "", "https:~/~/gateway.int.com:443/goods2/v1") Rel(bff, task_repository, "") Rel(task_repository, task_repository_db, "") @@ -51,7 +51,7 @@ Rel(camunda, invoice_repository, "") Rel(camunda, invoice_acl, "") Rel(invoice_source, invoice_acl, "", "orig-invoice-q8s-v1", $tags="async") Rel(invoice_acl, invoice_dest, "", "result-invoice-q8s-v1", $tags="async") -Rel(invoice_acl, ext_system, "", "https://gateway.int.com:443/ext/v1") +Rel(invoice_acl, ext_system, "", "https:~/~/gateway.int.com:443/ext/v1") 'Rel(invoice_acl, bff, "", "https://gateway.int.com:443/ext/v1") @enduml diff --git a/resources/architecture/Demo Tests.svg b/resources/architecture/Demo Tests.svg index 0e40aca..d507e16 100644 --- a/resources/architecture/Demo Tests.svg +++ b/resources/architecture/Demo Tests.svg @@ -1 +1 @@ -Our systemBFFGoods ACLCamundaTask RepositoryInvoice RepositoryInvoice ACLStock ACLDBDBStockExt SystemInvoice SourceInvoice ConsumerGoods RepositoryGoods2 RepositoryFront....[https:gateway.int.com:443/stock/v1]</size>//..[https:gateway.int.com:443/goods/v1]</size>//.[https:gateway.int.com:443/goods2/v1]</size>//........[orig-invoice-q8s-v1].[result-invoice-q8s-v1].[https:gateway.int.com:443/ext/v1]</size>//Legend personsystemcontainerexternal personexternal systemexternal container \ No newline at end of file +Our systemBFFGoods ACLCamundaTask RepositoryInvoice RepositoryInvoice ACLStock ACLDBDBStockExt SystemInvoice SourceInvoice ConsumerGoods RepositoryGoods2 RepositoryFront....[https://gateway.int.com:443/stock/v1]..[https://gateway.int.com:443/goods/v1].[https://gateway.int.com:443/goods2/v1]........[orig-invoice-q8s-v1].[result-invoice-q8s-v1].[https://gateway.int.com:443/ext/v1]Legend personsystemcontainerexternal personexternal systemexternal container \ No newline at end of file diff --git a/resources/architecture/generated.puml b/resources/architecture/generated.puml index 6008a7a..0791eae 100644 --- a/resources/architecture/generated.puml +++ b/resources/architecture/generated.puml @@ -33,12 +33,12 @@ Rel(camunda, task_repository, "") Rel(camunda, invoice_repository, "") Rel(camunda, invoice_acl, "") Rel(front, bff, "") -Rel(goods_acl, goods_repository, "", "https://gateway.int.com:443/goods/v1") -Rel(goods_acl, goods2_repository, "", "https://gateway.int.com:443/goods2/v1") +Rel(goods_acl, goods_repository, "", "https:~/~/gateway.int.com:443/goods/v1") +Rel(goods_acl, goods2_repository, "", "https:~/~/gateway.int.com:443/goods2/v1") Rel(invoice_acl, invoice_dest, "", "result-invoice-q8s-v1", $tags="async") -Rel(invoice_acl, ext_system, "", "https://gateway.int.com:443/ext/v1") +Rel(invoice_acl, ext_system, "", "https:~/~/gateway.int.com:443/ext/v1") Rel(invoice_repository, invoice_repository_db, "") Rel(invoice_source, invoice_acl, "", "orig-invoice-q8s-v1", $tags="async") -Rel(stock_acl, stock, "", "https://gateway.int.com:443/stock/v1") +Rel(stock_acl, stock, "", "https:~/~/gateway.int.com:443/stock/v1") Rel(task_repository, task_repository_db, "") @enduml \ No newline at end of file diff --git a/resources/architecture/generated.svg b/resources/architecture/generated.svg index ebf4e2b..ecece6d 100644 --- a/resources/architecture/generated.svg +++ b/resources/architecture/generated.svg @@ -1 +1 @@ -Our systemOur systemExt SystemFrontGoods RepositoryGoods2 RepositoryInvoice ConsumerInvoice SourceStockBFFGoods ACLCamundaTask RepositoryInvoice RepositoryInvoice ACLStock ACLDBDB..........[https:gateway.int.com:443/goods/v1]</size>//.[https:gateway.int.com:443/goods2/v1]</size>//.[result-invoice-q8s-v1].[https:gateway.int.com:443/ext/v1]</size>//..[orig-invoice-q8s-v1].[https:gateway.int.com:443/stock/v1]</size>//.Legend personsystemcontainerexternal personexternal systemexternal container \ No newline at end of file +Our systemOur systemExt SystemFrontGoods RepositoryGoods2 RepositoryInvoice ConsumerInvoice SourceStockBFFGoods ACLCamundaTask RepositoryInvoice RepositoryInvoice ACLStock ACLDBDB..........[https://gateway.int.com:443/goods/v1].[https://gateway.int.com:443/goods2/v1].[result-invoice-q8s-v1].[https://gateway.int.com:443/ext/v1]..[orig-invoice-q8s-v1].[https://gateway.int.com:443/stock/v1].Legend personsystemcontainerexternal personexternal systemexternal container \ No newline at end of file