From 890412dda47259b0df6ffa1c6e787066e5639b8e Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 2 Nov 2023 10:10:56 +0100 Subject: [PATCH 01/10] update versions --- .../entity/CompositionRelationshipsTest.java | 154 ++++++++++++-- .../resources/CompositionRelationships.jsl | 5 + ...ppedTransferCompositonAggregationTest.java | 188 +++++++++++++++++- .../MappedTransferCompositonAggregation.jsl | 14 ++ pom.xml | 4 +- 5 files changed, 338 insertions(+), 27 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java index 0ce93378..a4ca8bca 100644 --- a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java +++ b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java @@ -21,9 +21,10 @@ */ import com.google.inject.Inject; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.composition.Composition; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.composition.CompositionDao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entitya.EntityA; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entitya.EntityADao; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entitya.EntityAIdentifier; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entitya.EntityAMask; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityb.EntityB; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityb.EntityBDao; @@ -45,15 +46,8 @@ import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityf4.EntityF4; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityf4.EntityF4Dao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityg.EntityG; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityg.EntityGDao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityh.EntityH; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityh.EntityHDao; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.transfera.TransferA; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.transfera.TransferADao; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.transferc.TransferC; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.transferc.TransferCDao; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.transferd.TransferD; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.transferd.TransferDDao; import hu.blackbelt.judo.psm.generator.sdk.core.test.guice.CompositionRelationshipsDaoModules; import hu.blackbelt.judo.requirement.report.annotation.Requirement; import hu.blackbelt.judo.runtime.core.exception.ValidationException; @@ -111,13 +105,7 @@ public class CompositionRelationshipsTest { EntityHDao entityHDao; @Inject - TransferADao transferADao; - - @Inject - TransferCDao transferCDao; - - @Inject - TransferDDao transferDDao; + CompositionDao compositionDao; EntityA entityA; EntityC singleConA; @@ -501,6 +489,7 @@ void testDeepCopyCreate() { @Test void testDeepCopyUpdate() { + EntityA a2 = entityADao.create(EntityA.builder().withSingleRequiredConA(EntityC.builder().build()).build()); assertEquals(Optional.empty(), a2.getSingleConA()); assertEquals(0, a2.getCollectionConA().size()); @@ -568,4 +557,139 @@ void testDeepCopyUpdate() { () -> entityADao.update(a5) ); } + + @Test + void testAddAndRemoveOnCollections() { + EntityC c2 = entityCDao.create(EntityC.builder().withStringC("C2").build()); + EntityC c3 = entityCDao.create(EntityC.builder().withStringC("C3").build()); + EntityA entityA1 = entityADao.create(EntityA.builder() + .withSingleRequiredConA(EntityC.builder().withStringC("C1").build()) + .withCollectionConA(List.of(c2, c3)) + .build()); + + assertEquals("C1", entityA1.getSingleRequiredConA().getStringC().orElseThrow()); + assertEquals(2, entityA1.getCollectionConA().size()); + assertEquals("C2", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C2")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C3", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).findFirst().orElseThrow().getStringC().orElseThrow()); + + EntityC c4 = EntityC.builder().withStringC("C4").build(); + EntityC c5 = EntityC.builder().withStringC("C5").build(); + EntityC c6 = EntityC.builder().withStringC("C6").build(); + entityA1.addToCollectionConA(c4); + entityA1.addToCollectionConA(c5, c6); + + assertEquals("C1", entityA1.getSingleRequiredConA().getStringC().orElseThrow()); + assertEquals(5, entityA1.getCollectionConA().size()); + assertEquals("C2", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C2")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C3", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C4", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C5", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C5")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C6", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C6")).findFirst().orElseThrow().getStringC().orElseThrow()); + + entityA1.addToCollectionConA(null); + assertEquals(6, entityA1.getCollectionConA().size()); + EntityC c7 = EntityC.builder().withStringC("C7").build(); + entityA1.addToCollectionConA(null, c7); + assertEquals("C6", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C6")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C7", entityA1.getCollectionConA().stream() + .filter(c -> c != null && c.getStringC().orElseThrow().equals("C7")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(8, entityA1.getCollectionConA().size()); + + // The ID of c3 was changed after entity A1 was created + entityA1.removeFromCollectionConA(c3,c4); + assertEquals(7, entityA1.getCollectionConA().size()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c != null && c.getStringC().orElseThrow().equals("C3")).count()); + assertEquals(0, entityA1.getCollectionConA().stream().filter(c -> c != null && c.getStringC().orElseThrow().equals("C4")).count()); + + entityA1.removeFromCollectionConA(c6); + assertEquals(6, entityA1.getCollectionConA().size()); + assertEquals(0, entityA1.getCollectionConA().stream().filter(c -> c != null && c.getStringC().orElseThrow().equals("C6")).count()); + + c5.setStringC("C5Updated"); + entityA1.removeFromCollectionConA(c5); + + assertEquals(5, entityA1.getCollectionConA().size()); + assertEquals(0, entityA1.getCollectionConA().stream().filter(c -> c != null && c.getStringC().orElseThrow().equals("C5")).count()); + assertEquals(0, entityA1.getCollectionConA().stream().filter(c -> c != null && c.getStringC().orElseThrow().equals("C5Updated")).count()); + + EntityC c8 = EntityC.builder().withStringC("C8").build(); + EntityC c9 = EntityC.builder().withStringC("C9").build(); + EntityC c10 = EntityC.builder().withStringC("C10").build(); + EntityA entityA2 = EntityA.builder().withStringA("A2").withSingleRequiredConA(EntityC.builder().build()).build(); + EntityA entityA3 = EntityA.builder().withStringA("A3").withSingleRequiredConA(EntityC.builder().build()).build(); + EntityA entityA4 = EntityA.builder().withStringA("A4").withSingleRequiredConA(EntityC.builder().build()).build(); + Composition composition = Composition.builder().build(); + entityA2.addToCollectionConA(c9, c10); + entityA3.addToCollectionConA(c3, c4); + entityA4.addToCollectionConA(c7, c8); + composition.setEntityA(entityA2); + composition.addToEntityAs(entityA3, entityA4); + + assertEquals(2, composition.getEntityAs().size()); + + entityA2 = composition.getEntityA().orElseThrow(); + entityA3 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + entityA4 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + assertEquals("A2", entityA2.getStringA().orElseThrow()); + assertEquals("A3", entityA3.getStringA().orElseThrow()); + assertEquals("A4", entityA4.getStringA().orElseThrow()); + assertEquals("C3", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C4", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C7", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C7")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C8", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C9", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C9")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C10", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).findFirst().orElseThrow().getStringC().orElseThrow()); + + entityA3.removeFromCollectionConA(c3); + composition.getEntityA().orElseThrow().removeFromCollectionConA(c9); + + assertEquals(0, entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C9")).count()); + assertEquals(0, entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).count()); + + composition = compositionDao.create(composition); + + assertEquals(2, composition.getEntityAs().size()); + + entityA2 = composition.getEntityA().orElseThrow(); + entityA3 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + entityA4 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + assertEquals("A2", entityA2.getStringA().orElseThrow()); + assertEquals("A3", entityA3.getStringA().orElseThrow()); + assertEquals("A4", entityA4.getStringA().orElseThrow()); + assertEquals("C4", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C7", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C7")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C8", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C10", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).findFirst().orElseThrow().getStringC().orElseThrow()); + + EntityA entityA5 = EntityA.builder().withStringA("AA").withSingleRequiredConA(EntityC.builder().withStringC("CC").build()).build(); + entityA5.addToCollectionConA(EntityC.builder().withStringC("C12").build()); + composition.addToEntityAs(entityA5); + EntityC c11 = EntityC.builder().withStringC("C11").build(); + entityA2.addToCollectionConA(c11); + c7 = entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow(); + entityA4.removeFromCollectionConA(c7); + + composition = compositionDao.update(composition); + + assertEquals(3, composition.getEntityAs().size()); + + entityA2 = composition.getEntityA().orElseThrow(); + entityA3 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + entityA4 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + entityA5 = composition.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("AA")).findFirst().orElseThrow(); + assertEquals("A2", entityA2.getStringA().orElseThrow()); + assertEquals("A3", entityA3.getStringA().orElseThrow()); + assertEquals("A4", entityA4.getStringA().orElseThrow()); + assertEquals("A4", entityA4.getStringA().orElseThrow()); + assertEquals("AA", entityA5.getStringA().orElseThrow()); + assertEquals("C4", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C8", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("C10", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals("CC", entityA5.getSingleRequiredConA().getStringC().orElseThrow()); + assertEquals("C12", entityA5.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C12")).findFirst().orElseThrow().getStringC().orElseThrow()); + + EntityA entityA = entityADao.create(EntityA.builder().withSingleRequiredConA(EntityC.builder().build()).build()); + + entityA.setCollectionConA(List.of(EntityC.builder().withStringC("C1").build(), EntityC.builder().withStringC("C2").build())); + } } diff --git a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/resources/CompositionRelationships.jsl b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/resources/CompositionRelationships.jsl index d7aaf34d..d27aa9cb 100644 --- a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/resources/CompositionRelationships.jsl +++ b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/resources/CompositionRelationships.jsl @@ -2,6 +2,11 @@ model CompositionRelationships; type string String min-size:0 max-size:128; +entity Composition { + field EntityA entityA; + field EntityA[] entityAs; +} + entity EntityA { field String stringA; field EntityC singleConA; diff --git a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java index 0098bf64..1961441c 100644 --- a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java +++ b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java @@ -21,8 +21,10 @@ */ import com.google.inject.Inject; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityc.EntityC; -import hu.blackbelt.judo.psm.generator.sdk.core.test.api.compositionrelationships.compositionrelationships.entityd.EntityD; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.composition.Composition; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.composition.CompositionDao; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.composition.CompositionIdentifier; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.entitya.EntityA; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.entitya.EntityADao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.entitya.EntityAIdentifier; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.entityb.EntityB; @@ -35,6 +37,8 @@ import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transferb.TransferBDao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transferc.TransferC; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transferc.TransferCDao; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transfercomposition.TransferComposition; +import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transfercomposition.TransferCompositionDao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transferd.TransferD; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transferd.TransferDDao; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.mappedtransfercompositonaggregation.mappedtransfercompositonaggregation.transfere.TransferE; @@ -56,6 +60,7 @@ import hu.blackbelt.judo.runtime.core.exception.ValidationException; import hu.blackbelt.judo.runtime.core.jsl.fixture.JudoRuntimeExtension; import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -110,6 +115,11 @@ public class MappedTransferCompositonAggregationTest { TransferJDao transferJDao; @Inject TransferKDao transferKDao; + @Inject + TransferCompositionDao transferCompositionDao; + + @Inject + CompositionDao compositionDao; /** * The test checks the aggregation mapped single field with entity type work well on transfer object. @@ -456,11 +466,11 @@ void testDeepCopyUpdate() { assertEquals(Optional.empty(), a4.getSingleJonH()); assertEquals(0, a4.getCollectionJonH().size()); - TransferJ c5 = transferJDao.create(TransferJ.builder().withStringJ("C5").build()); - TransferJ c6 = transferJDao.create(TransferJ.builder().withStringJ("C6").withMultipleKonI(List.of(TransferK.builder().withStringK("D4").build())).build()); + TransferJ b5 = transferJDao.create(TransferJ.builder().withStringJ("C5").build()); + TransferJ b6 = transferJDao.create(TransferJ.builder().withStringJ("C6").withMultipleKonI(List.of(TransferK.builder().withStringK("D4").build())).build()); - a4.setSingleJonH(c5); - a4.setCollectionJonH(List.of(c6)); + a4.setSingleJonH(b5); + a4.setCollectionJonH(List.of(b6)); final TransferH a5 = transferHDao.update(a4); assertEquals(12, transferJDao.countAll()); @@ -470,11 +480,11 @@ void testDeepCopyUpdate() { assertEquals("C6", a5.getCollectionJonH().get(0).getStringJ().orElseThrow()); assertEquals("D4", a5.getCollectionJonH().get(0).getMultipleKonI().get(0).getStringK().orElseThrow()); - TransferJ c7 = transferJDao.create(TransferJ.builder().withStringJ("C7").build()); - TransferJ c8 = transferJDao.create(TransferJ.builder().withStringJ("C8").withMultipleKonI(List.of(TransferK.builder().withStringK("D5").build())).build()); + TransferJ b7 = transferJDao.create(TransferJ.builder().withStringJ("C7").build()); + TransferJ b8 = transferJDao.create(TransferJ.builder().withStringJ("C8").withMultipleKonI(List.of(TransferK.builder().withStringK("D5").build())).build()); - a5.setSingleJonH(c7); - a5.setCollectionJonH(List.of(c8)); + a5.setSingleJonH(b7); + a5.setCollectionJonH(List.of(b8)); IllegalStateException thrown = assertThrows( IllegalStateException.class, @@ -483,4 +493,162 @@ void testDeepCopyUpdate() { } + @Test + void testAddAndRemoveOnCollections() { + TransferB b2 = transferBDao.create(TransferB.builder().withNameB("B2").build()); + TransferB b3 = transferBDao.create(TransferB.builder().withNameB("B3").build()); + TransferA transferA1 = transferADao.create(TransferA.builder() + .withSingleEntityB(TransferB.builder().withNameB("B1").build()) + .withMultiEntityB(List.of(b2, b3)) + .build()); + + assertEquals("B1", transferA1.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals(2, transferA1.getMultiEntityB().size()); + assertEquals("B2", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B2")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B3", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).findFirst().orElseThrow().getNameB().orElseThrow()); + + TransferB b4 = TransferB.builder().withNameB("B4").build(); + TransferB b5 = TransferB.builder().withNameB("B5").build(); + TransferB b6 = TransferB.builder().withNameB("B6").build(); + transferA1.addToMultiEntityB(b4); + transferA1.addToMultiEntityB(b5, b6); + + assertEquals("B1", transferA1.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals(5, transferA1.getMultiEntityB().size()); + assertEquals("B2", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B2")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B3", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B4", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B5", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B5")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B6", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B6")).findFirst().orElseThrow().getNameB().orElseThrow()); + + transferA1.addToMultiEntityB(null); + assertEquals(6, transferA1.getMultiEntityB().size()); + TransferB b7 = TransferB.builder().withNameB("B7").build(); + transferA1.addToMultiEntityB(null, b7); + assertEquals("B6", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B6")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B7", transferA1.getMultiEntityB().stream() + .filter(c -> c != null && c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(8, transferA1.getMultiEntityB().size()); + + // The ID of b3 was changed after entity A1 was created + transferA1.removeFromMultiEntityB(b3,b4); + assertEquals(7, transferA1.getMultiEntityB().size()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c != null && c.getNameB().orElseThrow().equals("B3")).count()); + assertEquals(0, transferA1.getMultiEntityB().stream().filter(c -> c != null && c.getNameB().orElseThrow().equals("B4")).count()); + + transferA1.removeFromMultiEntityB(b6); + assertEquals(6, transferA1.getMultiEntityB().size()); + assertEquals(0, transferA1.getMultiEntityB().stream().filter(c -> c != null && c.getNameB().orElseThrow().equals("B6")).count()); + + b5.setNameB("B5Updated"); + transferA1.removeFromMultiEntityB(b5); + + assertEquals(5, transferA1.getMultiEntityB().size()); + assertEquals(0, transferA1.getMultiEntityB().stream().filter(c -> c != null && c.getNameB().orElseThrow().equals("B5")).count()); + assertEquals(0, transferA1.getMultiEntityB().stream().filter(c -> c != null && c.getNameB().orElseThrow().equals("B5Updated")).count()); + + TransferB b8 = TransferB.builder().withNameB("B8").build(); + TransferB b9 = TransferB.builder().withNameB("B9").build(); + TransferB b10 = TransferB.builder().withNameB("B10").build(); + TransferA transferA2 = TransferA.builder().withStringA("A2").withSingleEntityB(TransferB.builder().build()).build(); + TransferA transferA3 = TransferA.builder().withStringA("A3").withSingleEntityB(TransferB.builder().build()).build(); + TransferA transferA4 = TransferA.builder().withStringA("A4").withSingleEntityB(TransferB.builder().build()).build(); + TransferComposition composition = TransferComposition.builder().build(); + transferA2.addToMultiEntityB(b9, b10); + transferA3.addToMultiEntityB(b3, b4); + transferA4.addToMultiEntityB(b7, b8); + composition.setTransferA(transferA2); + composition.addToTransferAs(transferA3, transferA4); + + assertEquals(2, composition.getTransferAs().size()); + + transferA2 = composition.getTransferA().orElseThrow(); + transferA3 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + transferA4 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + assertEquals("A2", transferA2.getStringA().orElseThrow()); + assertEquals("A3", transferA3.getStringA().orElseThrow()); + assertEquals("A4", transferA4.getStringA().orElseThrow()); + assertEquals("B3", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B4", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B7", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B8", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B9", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B9")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B10", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + + transferA3.removeFromMultiEntityB(b3); + composition.getTransferA().orElseThrow().removeFromMultiEntityB(b9); + + assertEquals(0, transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B9")).count()); + assertEquals(0, transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).count()); + + composition = transferCompositionDao.create(composition); + + transferA2 = composition.getTransferA().orElseThrow(); + transferA3 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + transferA4 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + assertEquals("A2", transferA2.getStringA().orElseThrow()); + assertEquals("A3", transferA3.getStringA().orElseThrow()); + assertEquals("A4", transferA4.getStringA().orElseThrow()); + assertEquals("B4", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B7", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B8", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B10", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + + Composition compositionEntity = compositionDao.getById(composition.adaptTo(CompositionIdentifier.class)).orElseThrow(); + + EntityA entityA2 = compositionEntity.getEntityA().orElseThrow(); + EntityA entityA3 = compositionEntity.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + EntityA entityA4 = compositionEntity.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + assertEquals("A2", entityA2.getStringA().orElseThrow()); + assertEquals("A3", entityA3.getStringA().orElseThrow()); + assertEquals("A4", entityA4.getStringA().orElseThrow()); + assertEquals("B4", entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B7", entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B8", entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B10", entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + + TransferA transferA5 = TransferA.builder().withStringA("AA").withSingleEntityB(TransferB.builder().withNameB("BB").build()).build(); + transferA5.addToMultiEntityB(TransferB.builder().withNameB("B12").build()); + composition.addToTransferAs(transferA5); + TransferB b11 = TransferB.builder().withNameB("B11").build(); + transferA2.addToMultiEntityB(b11); + b7 = transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow(); + transferA4.removeFromMultiEntityB(b7); + + composition = transferCompositionDao.update(composition); + + assertEquals(3, composition.getTransferAs().size()); + + transferA2 = composition.getTransferA().orElseThrow(); + transferA3 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + transferA4 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + transferA5 = composition.getTransferAs().stream().filter(a -> a.getStringA().orElseThrow().equals("AA")).findFirst().orElseThrow(); + assertEquals("A2", transferA2.getStringA().orElseThrow()); + assertEquals("A3", transferA3.getStringA().orElseThrow()); + assertEquals("A4", transferA4.getStringA().orElseThrow()); + assertEquals("A4", transferA4.getStringA().orElseThrow()); + assertEquals("AA", transferA5.getStringA().orElseThrow()); + assertEquals("B4", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B8", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B10", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("BB", transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals("B12", transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).findFirst().orElseThrow().getNameB().orElseThrow()); + + compositionEntity = compositionDao.getById(composition.adaptTo(CompositionIdentifier.class)).orElseThrow(); + + entityA2 = compositionEntity.getEntityA().orElseThrow(); + entityA3 = compositionEntity.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A3")).findFirst().orElseThrow(); + entityA4 = compositionEntity.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("A4")).findFirst().orElseThrow(); + EntityA entityA5 = compositionEntity.getEntityAs().stream().filter(a -> a.getStringA().orElseThrow().equals("AA")).findFirst().orElseThrow(); + assertEquals("A2", entityA2.getStringA().orElseThrow()); + assertEquals("A3", entityA3.getStringA().orElseThrow()); + assertEquals("A4", entityA4.getStringA().orElseThrow()); + assertEquals("AA", entityA5.getStringA().orElseThrow()); + assertEquals("B4", entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B8", entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("B10", entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals("BB", transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals("B12", transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).findFirst().orElseThrow().getNameB().orElseThrow()); + } + } diff --git a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl index f054e8c6..df79c910 100644 --- a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl +++ b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl @@ -2,8 +2,21 @@ model MappedTransferCompositonAggregation; import judo::types; +entity Composition { + field EntityA entityA; + field EntityA[] entityAs; +} + +transfer TransferComposition (Composition comp) { + @Embedded + relation TransferA transferA <=> comp.entityA; + @Embedded + relation TransferA[] transferAs <=> comp.entityAs; +} + // not required Single and Multi entity EntityA { + field String stringA; field EntityB singleEntityB; field EntityB[] multiEntityB; } @@ -17,6 +30,7 @@ transfer TransferA (EntityA a) { relation TransferB singleEntityB <=> a.singleEntityB; @Embedded relation TransferB[] multiEntityB <=> a.multiEntityB; + field String stringA <=> a.stringA; } transfer TransferB (EntityB b) { diff --git a/pom.xml b/pom.xml index 08f5d782..a617913c 100644 --- a/pom.xml +++ b/pom.xml @@ -41,8 +41,8 @@ 1.1.4.20231019_040537_063b1857_develop - 1.0.6.20231018_225832_e7a4b040_develop - 1.0.0.20231010_041041_34c65c9e_develop + 1.0.6.20231102_083158_fbdb09c3_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.0.20231102_082912_dd9dca4c_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231010_040556_b7a6fa07_develop From 6cd8ab68fc0057bca4ae1bf86b11b0f918929988 Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 2 Nov 2023 10:45:48 +0100 Subject: [PATCH 02/10] update versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a617913c..05aabb3a 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,8 @@ javax.resource;version="[1.6,2)" - 1.1.4.20231019_040537_063b1857_develop - 1.0.6.20231102_083158_fbdb09c3_feature_JNG_4220_support_add_and_remove_for_collections + 1.1.4.20231102_093522_efbfed59_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.6.20231102_091220_16b97472_feature_JNG_4220_support_add_and_remove_for_collections 1.0.0.20231102_082912_dd9dca4c_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231010_040556_b7a6fa07_develop From 743b64f567d77bd1667a5498d0fda2fbbcd632cf Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 2 Nov 2023 11:55:47 +0100 Subject: [PATCH 03/10] update versions --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 05aabb3a..da23d65b 100644 --- a/pom.xml +++ b/pom.xml @@ -40,9 +40,9 @@ javax.resource;version="[1.6,2)" - 1.1.4.20231102_093522_efbfed59_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.6.20231102_091220_16b97472_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.0.20231102_082912_dd9dca4c_feature_JNG_4220_support_add_and_remove_for_collections + 1.1.4.20231102_104307_2f6a20d7_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.6.20231102_103603_195f545f_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.0.20231102_102801_5cbb2727_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231010_040556_b7a6fa07_develop From a148ee6d42398c3f20a393b8c94fd52cf3ab2dc7 Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 2 Nov 2023 11:59:22 +0100 Subject: [PATCH 04/10] fix --- .../MappedTransferCompositonAggregationTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java index 1961441c..6b331149 100644 --- a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java +++ b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java @@ -466,11 +466,11 @@ void testDeepCopyUpdate() { assertEquals(Optional.empty(), a4.getSingleJonH()); assertEquals(0, a4.getCollectionJonH().size()); - TransferJ b5 = transferJDao.create(TransferJ.builder().withStringJ("C5").build()); - TransferJ b6 = transferJDao.create(TransferJ.builder().withStringJ("C6").withMultipleKonI(List.of(TransferK.builder().withStringK("D4").build())).build()); + TransferJ c5 = transferJDao.create(TransferJ.builder().withStringJ("C5").build()); + TransferJ c6 = transferJDao.create(TransferJ.builder().withStringJ("C6").withMultipleKonI(List.of(TransferK.builder().withStringK("D4").build())).build()); - a4.setSingleJonH(b5); - a4.setCollectionJonH(List.of(b6)); + a4.setSingleJonH(c5); + a4.setCollectionJonH(List.of(c6)); final TransferH a5 = transferHDao.update(a4); assertEquals(12, transferJDao.countAll()); @@ -480,11 +480,11 @@ void testDeepCopyUpdate() { assertEquals("C6", a5.getCollectionJonH().get(0).getStringJ().orElseThrow()); assertEquals("D4", a5.getCollectionJonH().get(0).getMultipleKonI().get(0).getStringK().orElseThrow()); - TransferJ b7 = transferJDao.create(TransferJ.builder().withStringJ("C7").build()); - TransferJ b8 = transferJDao.create(TransferJ.builder().withStringJ("C8").withMultipleKonI(List.of(TransferK.builder().withStringK("D5").build())).build()); + TransferJ c7 = transferJDao.create(TransferJ.builder().withStringJ("C7").build()); + TransferJ c8 = transferJDao.create(TransferJ.builder().withStringJ("C8").withMultipleKonI(List.of(TransferK.builder().withStringK("D5").build())).build()); - a5.setSingleJonH(b7); - a5.setCollectionJonH(List.of(b8)); + a5.setSingleJonH(c7); + a5.setCollectionJonH(List.of(c8)); IllegalStateException thrown = assertThrows( IllegalStateException.class, From 12efd5755126ffb9485370c684ac86cd9acb336b Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 9 Nov 2023 08:40:36 +0100 Subject: [PATCH 05/10] update versions --- .../entity/CompositionRelationshipsTest.java | 49 ++++++------- ...ppedTransferCompositonAggregationTest.java | 69 +++++++++---------- pom.xml | 6 +- 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java index a4ca8bca..c0a6e768 100644 --- a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java +++ b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java @@ -59,6 +59,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -569,8 +570,8 @@ void testAddAndRemoveOnCollections() { assertEquals("C1", entityA1.getSingleRequiredConA().getStringC().orElseThrow()); assertEquals(2, entityA1.getCollectionConA().size()); - assertEquals("C2", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C2")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C3", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C2")).count()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).count()); EntityC c4 = EntityC.builder().withStringC("C4").build(); EntityC c5 = EntityC.builder().withStringC("C5").build(); @@ -580,19 +581,19 @@ void testAddAndRemoveOnCollections() { assertEquals("C1", entityA1.getSingleRequiredConA().getStringC().orElseThrow()); assertEquals(5, entityA1.getCollectionConA().size()); - assertEquals("C2", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C2")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C3", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C4", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C5", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C5")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C6", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C6")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C2")).count()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).count()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).count()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C5")).count()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C6")).count()); entityA1.addToCollectionConA(null); assertEquals(6, entityA1.getCollectionConA().size()); EntityC c7 = EntityC.builder().withStringC("C7").build(); entityA1.addToCollectionConA(null, c7); - assertEquals("C6", entityA1.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C6")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C7", entityA1.getCollectionConA().stream() - .filter(c -> c != null && c.getStringC().orElseThrow().equals("C7")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA1.getCollectionConA().stream().filter(c -> c != null && c.getStringC().orElseThrow().equals("C6")).count()); + assertEquals(1, entityA1.getCollectionConA().stream() + .filter(c -> c != null && c.getStringC().orElseThrow().equals("C7")).count()); assertEquals(8, entityA1.getCollectionConA().size()); // The ID of c3 was changed after entity A1 was created @@ -633,12 +634,12 @@ void testAddAndRemoveOnCollections() { assertEquals("A2", entityA2.getStringA().orElseThrow()); assertEquals("A3", entityA3.getStringA().orElseThrow()); assertEquals("A4", entityA4.getStringA().orElseThrow()); - assertEquals("C3", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C4", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C7", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C7")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C8", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C9", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C9")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C10", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C3")).count()); + assertEquals(1, entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).count()); + assertEquals(1, entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C7")).count()); + assertEquals(1, entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).count()); + assertEquals(1, entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C9")).count()); + assertEquals(1, entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).count()); entityA3.removeFromCollectionConA(c3); composition.getEntityA().orElseThrow().removeFromCollectionConA(c9); @@ -656,10 +657,10 @@ void testAddAndRemoveOnCollections() { assertEquals("A2", entityA2.getStringA().orElseThrow()); assertEquals("A3", entityA3.getStringA().orElseThrow()); assertEquals("A4", entityA4.getStringA().orElseThrow()); - assertEquals("C4", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C7", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C7")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C8", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C10", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).count()); + assertEquals(1, entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C7")).count()); + assertEquals(1, entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).count()); + assertEquals(1, entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).count()); EntityA entityA5 = EntityA.builder().withStringA("AA").withSingleRequiredConA(EntityC.builder().withStringC("CC").build()).build(); entityA5.addToCollectionConA(EntityC.builder().withStringC("C12").build()); @@ -682,11 +683,11 @@ void testAddAndRemoveOnCollections() { assertEquals("A4", entityA4.getStringA().orElseThrow()); assertEquals("A4", entityA4.getStringA().orElseThrow()); assertEquals("AA", entityA5.getStringA().orElseThrow()); - assertEquals("C4", entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C8", entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).findFirst().orElseThrow().getStringC().orElseThrow()); - assertEquals("C10", entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA3.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C4")).count()); + assertEquals(1, entityA4.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C8")).count()); + assertEquals(1, entityA2.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C10")).count()); assertEquals("CC", entityA5.getSingleRequiredConA().getStringC().orElseThrow()); - assertEquals("C12", entityA5.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C12")).findFirst().orElseThrow().getStringC().orElseThrow()); + assertEquals(1, entityA5.getCollectionConA().stream().filter(c -> c.getStringC().orElseThrow().equals("C12")).count()); EntityA entityA = entityADao.create(EntityA.builder().withSingleRequiredConA(EntityC.builder().build()).build()); diff --git a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java index 6b331149..bce55207 100644 --- a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java +++ b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java @@ -504,8 +504,8 @@ void testAddAndRemoveOnCollections() { assertEquals("B1", transferA1.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); assertEquals(2, transferA1.getMultiEntityB().size()); - assertEquals("B2", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B2")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B3", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B2")).count()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).count()); TransferB b4 = TransferB.builder().withNameB("B4").build(); TransferB b5 = TransferB.builder().withNameB("B5").build(); @@ -515,19 +515,19 @@ void testAddAndRemoveOnCollections() { assertEquals("B1", transferA1.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); assertEquals(5, transferA1.getMultiEntityB().size()); - assertEquals("B2", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B2")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B3", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B4", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B5", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B5")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B6", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B6")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B2")).count()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).count()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B5")).count()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B6")).count()); transferA1.addToMultiEntityB(null); assertEquals(6, transferA1.getMultiEntityB().size()); TransferB b7 = TransferB.builder().withNameB("B7").build(); transferA1.addToMultiEntityB(null, b7); - assertEquals("B6", transferA1.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B6")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B7", transferA1.getMultiEntityB().stream() - .filter(c -> c != null && c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA1.getMultiEntityB().stream().filter(c -> c != null && c.getNameB().orElseThrow().equals("B6")).count()); + assertEquals(1, transferA1.getMultiEntityB().stream() + .filter(c -> c != null && c.getNameB().orElseThrow().equals("B7")).count()); assertEquals(8, transferA1.getMultiEntityB().size()); // The ID of b3 was changed after entity A1 was created @@ -568,13 +568,12 @@ void testAddAndRemoveOnCollections() { assertEquals("A2", transferA2.getStringA().orElseThrow()); assertEquals("A3", transferA3.getStringA().orElseThrow()); assertEquals("A4", transferA4.getStringA().orElseThrow()); - assertEquals("B3", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B4", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B7", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B8", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B9", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B9")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B10", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); - + assertEquals(1, transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B3")).count()); + assertEquals(1, transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); + assertEquals(1, transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).count()); + assertEquals(1, transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); + assertEquals(1, transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B9")).count()); + assertEquals(1, transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); transferA3.removeFromMultiEntityB(b3); composition.getTransferA().orElseThrow().removeFromMultiEntityB(b9); @@ -589,10 +588,10 @@ void testAddAndRemoveOnCollections() { assertEquals("A2", transferA2.getStringA().orElseThrow()); assertEquals("A3", transferA3.getStringA().orElseThrow()); assertEquals("A4", transferA4.getStringA().orElseThrow()); - assertEquals("B4", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B7", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B8", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B10", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); + assertEquals(1, transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).count()); + assertEquals(1, transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); + assertEquals(1, transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); Composition compositionEntity = compositionDao.getById(composition.adaptTo(CompositionIdentifier.class)).orElseThrow(); @@ -602,10 +601,10 @@ void testAddAndRemoveOnCollections() { assertEquals("A2", entityA2.getStringA().orElseThrow()); assertEquals("A3", entityA3.getStringA().orElseThrow()); assertEquals("A4", entityA4.getStringA().orElseThrow()); - assertEquals("B4", entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B7", entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B8", entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B10", entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); + assertEquals(1, entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B7")).count()); + assertEquals(1, entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); + assertEquals(1, entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); TransferA transferA5 = TransferA.builder().withStringA("AA").withSingleEntityB(TransferB.builder().withNameB("BB").build()).build(); transferA5.addToMultiEntityB(TransferB.builder().withNameB("B12").build()); @@ -628,11 +627,11 @@ void testAddAndRemoveOnCollections() { assertEquals("A4", transferA4.getStringA().orElseThrow()); assertEquals("A4", transferA4.getStringA().orElseThrow()); assertEquals("AA", transferA5.getStringA().orElseThrow()); - assertEquals("B4", transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B8", transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B10", transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("BB", transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); - assertEquals("B12", transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); + assertEquals(1, transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); + assertEquals(1, transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); + assertEquals(1, transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).count()); compositionEntity = compositionDao.getById(composition.adaptTo(CompositionIdentifier.class)).orElseThrow(); @@ -644,11 +643,11 @@ void testAddAndRemoveOnCollections() { assertEquals("A3", entityA3.getStringA().orElseThrow()); assertEquals("A4", entityA4.getStringA().orElseThrow()); assertEquals("AA", entityA5.getStringA().orElseThrow()); - assertEquals("B4", entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B8", entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("B10", entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).findFirst().orElseThrow().getNameB().orElseThrow()); - assertEquals("BB", transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); - assertEquals("B12", transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).findFirst().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); + assertEquals(1, entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); + assertEquals(1, entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); + assertEquals(1, transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals(1, transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).count()); } } diff --git a/pom.xml b/pom.xml index da23d65b..61431d01 100644 --- a/pom.xml +++ b/pom.xml @@ -40,9 +40,9 @@ javax.resource;version="[1.6,2)" - 1.1.4.20231102_104307_2f6a20d7_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.6.20231102_103603_195f545f_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.0.20231102_102801_5cbb2727_feature_JNG_4220_support_add_and_remove_for_collections + 1.1.4.20231108_140557_34ee8a2b_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.6.20231108_135629_2bf286eb_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.0.20231108_135216_df34c488_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231010_040556_b7a6fa07_develop From add5aaa6bd56d159e4de7eb78308110594cd2f82 Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 9 Nov 2023 09:16:55 +0100 Subject: [PATCH 06/10] fix tests --- .../jsl/transfer/MappedTransferCompositonAggregationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java index bce55207..0d0c2963 100644 --- a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java +++ b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/transfer/MappedTransferCompositonAggregationTest.java @@ -630,7 +630,7 @@ void testAddAndRemoveOnCollections() { assertEquals(1, transferA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); assertEquals(1, transferA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); assertEquals(1, transferA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); - assertEquals(1, transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals("BB", transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); assertEquals(1, transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).count()); compositionEntity = compositionDao.getById(composition.adaptTo(CompositionIdentifier.class)).orElseThrow(); @@ -646,7 +646,7 @@ void testAddAndRemoveOnCollections() { assertEquals(1, entityA3.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B4")).count()); assertEquals(1, entityA4.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B8")).count()); assertEquals(1, entityA2.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B10")).count()); - assertEquals(1, transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); + assertEquals("BB", transferA5.getSingleEntityB().orElseThrow().getNameB().orElseThrow()); assertEquals(1, transferA5.getMultiEntityB().stream().filter(c -> c.getNameB().orElseThrow().equals("B12")).count()); } From dbb5a2ad89619e20ebdf42a0cd119aa389de37fb Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 16 Nov 2023 10:12:14 +0100 Subject: [PATCH 07/10] update versions --- .../core/jsl/entity/CompositionRelationshipsTest.java | 1 - pom.xml | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java index 377d056d..91afda07 100644 --- a/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java +++ b/judo-runtime-core-jsl-itest/models/EntityRelationshipsModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/CompositionRelationshipsTest.java @@ -59,7 +59,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Optional; diff --git a/pom.xml b/pom.xml index 05a327b6..cfd52ad1 100644 --- a/pom.xml +++ b/pom.xml @@ -40,9 +40,9 @@ javax.resource;version="[1.6,2)" - 1.1.4.20231111_041118_69c84651_develop - 1.0.6.20231108_135629_2bf286eb_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.0.20231108_135216_df34c488_feature_JNG_4220_support_add_and_remove_for_collections + 1.1.4.20231116_090711_f1f9b458_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.6.20231116_085859_f388ddf3_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.0.20231116_090212_e7b46e2b_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231107_041329_29cfda41_develop From 94024009b9cb055b193a252373094ccba9cc0cc4 Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 16 Nov 2023 10:19:53 +0100 Subject: [PATCH 08/10] fix jsl --- .../test/resources/MappedTransferCompositonAggregation.jsl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl index fa95477c..bb317580 100644 --- a/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl +++ b/judo-runtime-core-jsl-itest/models/TransferAggregationModel/src/test/resources/MappedTransferCompositonAggregation.jsl @@ -8,10 +8,8 @@ entity Composition { } transfer TransferComposition (Composition comp) { - @Embedded - relation TransferA transferA <=> comp.entityA; - @Embedded - relation TransferA[] transferAs <=> comp.entityAs; + relation TransferA transferA <= comp.entityA eager:true; + relation TransferA[] transferAs <= comp.entityAs eager:true; } // not required Single and Multi @@ -28,6 +26,7 @@ entity EntityB { transfer TransferA (EntityA a) { relation TransferB singleEntityB <= a.singleEntityB eager:true; relation TransferB[] multiEntityB <= a.multiEntityB eager:true; + field String stringA <= a.stringA input:true; } transfer TransferB (EntityB b) { From 6428b8a76343601a93b7c7c9f17359ba410e276c Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 16 Nov 2023 11:05:59 +0100 Subject: [PATCH 09/10] update versions --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index cfd52ad1..c091f86c 100644 --- a/pom.xml +++ b/pom.xml @@ -40,9 +40,9 @@ javax.resource;version="[1.6,2)" - 1.1.4.20231116_090711_f1f9b458_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.6.20231116_085859_f388ddf3_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.0.20231116_090212_e7b46e2b_feature_JNG_4220_support_add_and_remove_for_collections + 1.1.4.20231116_095937_2f709170_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.6.20231116_095003_38111dee_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.0.20231116_094716_5c070658_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231107_041329_29cfda41_develop From 9f7b14104e437dc115a6d31ddc8a02332aafe7c6 Mon Sep 17 00:00:00 2001 From: Madmat8 Date: Thu, 16 Nov 2023 14:08:14 +0100 Subject: [PATCH 10/10] update versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c091f86c..5825c588 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,8 @@ javax.resource;version="[1.6,2)" - 1.1.4.20231116_095937_2f709170_feature_JNG_4220_support_add_and_remove_for_collections - 1.0.6.20231116_095003_38111dee_feature_JNG_4220_support_add_and_remove_for_collections + 1.1.4.20231116_130159_f32552bd_feature_JNG_4220_support_add_and_remove_for_collections + 1.0.6.20231116_125339_1744a762_feature_JNG_4220_support_add_and_remove_for_collections 1.0.0.20231116_094716_5c070658_feature_JNG_4220_support_add_and_remove_for_collections 1.3.0.20231107_041329_29cfda41_develop