Skip to content

Commit

Permalink
Jamespg network fix (#259)
Browse files Browse the repository at this point in the history
* #191 Update internal-network to network

* #191 Pick up new schema in translator build

* Fix translator to work with new network and interface

---------

Co-authored-by: Jim Gough <[email protected]>
Co-authored-by: Matthew Bain <[email protected]>
Co-authored-by: jpgough-ms <[email protected]>
  • Loading branch information
4 people authored Jun 3, 2024
1 parent 281929b commit 9f5bd27
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 60 deletions.
2 changes: 1 addition & 1 deletion calm/draft/2024-04/meta/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"system",
"service",
"database",
"internal-network",
"network",
"ldap",
"webclient"
]
Expand Down
2 changes: 1 addition & 1 deletion calm/samples/traderx/traderx.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
{
"unique-id": "internal-bank-network",
"node-type": "internal-network",
"node-type": "network",
"name": "Bank ABC Internal Network",
"description": "Internal network for Bank ABC",
"instance": "Internal Network"
Expand Down
2 changes: 1 addition & 1 deletion calm/samples/traderx/traderx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ nodes:
data-classification: Confidential
run-as: systemId
- unique-id: internal-bank-network
node-type: internal-network
node-type: network
name: Bank ABC Internal Network
description: Internal network for Bank ABC
instance: Internal Network
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/visualize/calmToDot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function(calm: CALMInstantiation, debug: boolean = false): string
function addNode(G: Digraph, node: CALMNode) {
if (node['node-type'] === 'actor') {
createNode(G, node, 'ellipse');
} else if (node['node-type'] === 'internal-network') {
} else if (node['node-type'] === 'network') {
// do not create node as this will be a subgraph later
} else {
createNode(G, node, 'box');
Expand Down
2 changes: 1 addition & 1 deletion cli/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export interface CALMInstantiation {
relationships: CALMRelationship[]
}

export type NodeType = 'actor' | 'system' | 'service' | 'database' | 'internal-network' | 'ldap' | 'dataclient';
export type NodeType = 'actor' | 'system' | 'service' | 'database' | 'network' | 'ldap' | 'dataclient';

export interface CALMNode {
name: string,
Expand Down
2 changes: 1 addition & 1 deletion cli/test_fixtures/calm/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"system",
"service",
"database",
"internal-network",
"network",
"ldap",
"webclient"
]
Expand Down
2 changes: 1 addition & 1 deletion cli/test_fixtures/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"system",
"service",
"database",
"internal-network",
"network",
"ldap",
"webclient"
]
Expand Down
2 changes: 1 addition & 1 deletion translator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<sourceDirectory>${project.basedir}/../calm/draft/2024-03/meta/</sourceDirectory>
<sourceDirectory>${project.basedir}/../calm/draft/2024-04/meta/</sourceDirectory>
<targetPackage>org.finos.calmtranslator.calm</targetPackage>
<generateBuilders>true</generateBuilders>
<removeOldOutput>true</removeOldOutput>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ else if (Objects.nonNull(relationshipType.getConnects())) {
private void addConnectsRelationship(Relationship relationship, final Core calmModel, final Model c4Model, final Map<String, String> nodeNameToC4Id) {
final RelationshipType relationshipType = relationship.getRelationshipType();
final ConnectsType connects = relationshipType.getConnects();
final Node sourceNode = getNodeFromUniqueName(calmModel, connects.getSource());
final Node destinationNode = getNodeFromUniqueName(calmModel, connects.getDestination());
final Node sourceNode = getNodeFromUniqueName(calmModel, connects.getSource().getNode());
final Node destinationNode = getNodeFromUniqueName(calmModel, connects.getDestination().getNode());

String srcC4Id = nodeNameToC4Id.get(sourceNode.getName());
if (Objects.isNull(srcC4Id)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void addCalmSystemAsC4System() {
assertThat(workspace.getModel().getSoftwareSystems())
.anyMatch(
softwareSystem -> softwareSystem.getDescription().equals("Simple Trading System") &&
softwareSystem.getName().equals("TraderX"))
softwareSystem.getName().equals("TraderX"))

;
}
Expand Down Expand Up @@ -123,5 +123,4 @@ void processMultipleSystems() {
.usingRecursiveFieldByFieldElementComparatorOnFields("description", "source.name", "destination.name", "source.description", "destination.description")
.containsAll(expectedRelationship);
}

}
18 changes: 13 additions & 5 deletions translator/src/test/resources/cross-communication.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-03/meta/calm.json",
"$schema": "../../../../calm/draft/2024-04/meta/calm.json",
"nodes": [
{
"unique-id": "system1",
Expand Down Expand Up @@ -67,8 +67,12 @@
"description": "Service 1 to Service 2",
"relationship-type": {
"connects": {
"source": "service1",
"destination": "service2"
"destination": {
"node": "service2"
},
"source": {
"node": "service1"
}
}
}
},
Expand All @@ -77,8 +81,12 @@
"description": "Service 2 to Service 3",
"relationship-type": {
"connects": {
"source": "service2",
"destination": "service3"
"destination": {
"node": "service3"
},
"source": {
"node": "service2"
}
}
}
}
Expand Down
Loading

0 comments on commit 9f5bd27

Please sign in to comment.