diff --git a/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/SpecialCasesTest.java b/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/SpecialCasesTest.java
index 828edea2..c5630949 100644
--- a/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/SpecialCasesTest.java
+++ b/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/SpecialCasesTest.java
@@ -23,6 +23,13 @@
import com.google.inject.Inject;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.abstract_.Abstract;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.abstract_.AbstractDao;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.c.C;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.c.CBuilder;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.c.CDao;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.d.D;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.d.DDao;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.e.E;
+import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.e.EDao;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.entitya.EntityA;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.entitya.EntityADao;
import hu.blackbelt.judo.psm.generator.sdk.core.test.api.specialcases.specialcases.entitya.querysamename.EntityAQuerySameNameParameter;
@@ -41,6 +48,10 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -65,6 +76,7 @@ public class SpecialCasesTest {
@Inject
TestEntityDao testEntityDao;
+
/**
* This test checks the entities with the same query name declaration.
*
@@ -193,5 +205,55 @@ public void TestEntityThatHasJavaKeywordInItsPackageName() {
assertEquals(1, abstractDao.countAll());
}
+ @Inject
+ CDao cDao;
+
+ @Inject
+ DDao dDao;
+
+ @Inject
+ EDao eDao;
+
+ @Test
+ @TestCase("TestBuilderCopyTheCollectionRecursively")
+ @Requirement(reqs = {
+ "REQ-TYPE-001",
+ "REQ-ENT-001",
+ "REQ-ENT-002",
+ "REQ-ENT-004",
+ "REQ-ENT-007",
+ "REQ-MDL-001",
+ "REQ-MDL-002",
+ "REQ-MDL-003",
+ "REQ-SRV-002",
+ })
+ public void TestBuilderCopyTheCollectionRecursively() {
+
+ CBuilder cBuilder1 = C.builder()
+ .withCompD(List.of(D.builder()
+ .withCompE(List.of(E.builder().build(), E.builder().build()))
+ .build(),
+ D.builder().build())
+ );
+
+ CBuilder cBuilder2 = cBuilder1.withName("Name");
+
+ C c1 = cBuilder1.build();
+ C c11 = cBuilder1.build();
+ C c2 = cBuilder2.build();
+
+ c1.getCompD().get(0).getCompE().remove(c1.getCompD().get(0).getCompE().get(0));
+
+ assertEquals(1, c1.getCompD().get(0).getCompE().size());
+ assertEquals(2, c11.getCompD().get(0).getCompE().size());
+ assertEquals(2, c2.getCompD().get(0).getCompE().size());
+
+ c2.getCompD().get(0).getCompE().remove(c2.getCompD().get(0).getCompE().get(0));
+
+ assertEquals(1, c1.getCompD().get(0).getCompE().size());
+ assertEquals(2, c11.getCompD().get(0).getCompE().size());
+ assertEquals(1, c2.getCompD().get(0).getCompE().size());
+
+ }
}
diff --git a/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/resources/SpecialCases.jsl b/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/resources/SpecialCases.jsl
index 4bf1aa78..5a360da4 100644
--- a/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/resources/SpecialCases.jsl
+++ b/judo-runtime-core-jsl-itest/models/SpecialCasesModel/src/test/resources/SpecialCases.jsl
@@ -29,3 +29,19 @@ entity entityB {
@Query
relation ReferenceEntity querySameName(String name) <= ReferenceEntity!any();
}
+
+// Builder copy the collection recursively
+
+entity C {
+ field String name;
+ field D[] compD;
+}
+
+entity D {
+ field E[] compE;
+}
+
+entity E {
+
+}
+
diff --git a/pom.xml b/pom.xml
index a175a901..93368ab9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,9 +40,9 @@
javax.resource;version="[1.6,2)"
- 1.1.4.20231107_043414_de7314a5_develop
- 1.0.6.20231107_043031_831a45c5_develop
- 1.0.0.20231107_042218_ce601617_develop
+ 1.1.4.20231108_122951_030b2c1a_feature_JNG_4219_Builders_can_be_reusable
+ 1.0.6.20231108_122557_6fd7a3a8_feature_JNG_4219_Builders_can_be_reusable
+ 1.0.0.20231108_122327_9c7f6459_feature_JNG_4219_Builders_can_be_reusable
1.3.0.20231107_041329_29cfda41_develop