From 1d6cda2334252d2f6b0aaf0fa5b9d9564c443b10 Mon Sep 17 00:00:00 2001 From: Simon Brown <1009874+simonbrowndotje@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:24:57 +0000 Subject: [PATCH] Fixes #362. --- changelog.md | 4 ++++ gradle.properties | 2 +- .../src/main/java/com/structurizr/model/Model.java | 7 +++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index a949f37e..e3a3806d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## 3.2.1 (10th December 2024) + +- structurizr-core: Fixes https://github.com/structurizr/java/issues/362 (Ordering of replicated relationships in deployment environment is non-deterministic). + ## 3.2.0 (6th December 2024) - structurizr-dsl: Adds support for `element!=` expressions. diff --git a/gradle.properties b/gradle.properties index 8af3d8f3..c1670d1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ signing.secretKeyRingFile=/some/path ossrhUsername=username ossrhPassword=password -version=3.2.0 \ No newline at end of file +version=3.2.1 \ No newline at end of file diff --git a/structurizr-core/src/main/java/com/structurizr/model/Model.java b/structurizr-core/src/main/java/com/structurizr/model/Model.java index 111d124c..57d947b2 100644 --- a/structurizr-core/src/main/java/com/structurizr/model/Model.java +++ b/structurizr-core/src/main/java/com/structurizr/model/Model.java @@ -902,12 +902,11 @@ private void replicateElementRelationships(StaticStructureElementInstance elemen StaticStructureElement element = elementInstance.getElement(); // find all StaticStructureElementInstance objects in the same deployment environment and deployment group - Set elementInstances = getElements().stream() + TreeSet elementInstances = getElements().stream() .filter(e -> e instanceof StaticStructureElementInstance) - .map(e -> (StaticStructureElementInstance)e) + .map(e -> (StaticStructureElementInstance) e) .filter(ssei -> ssei.getEnvironment().equals(elementInstance.getEnvironment())) - .filter(ssei -> ssei.inSameDeploymentGroup(elementInstance)) - .collect(Collectors.toSet()); + .filter(ssei -> ssei.inSameDeploymentGroup(elementInstance)).collect(Collectors.toCollection(TreeSet::new)); // and replicate the relationships to/from the element instance for (StaticStructureElementInstance ssei : elementInstances) {