From cfc761b66052f7a31374e19de2637b9050cd29a9 Mon Sep 17 00:00:00 2001 From: Bence Gelei Date: Thu, 12 Dec 2024 14:27:55 +0100 Subject: [PATCH 1/4] JNG-5544 Initial feature commit [ci skip] From c3a27309e256413d30cb7d609e6687d8df4a1127 Mon Sep 17 00:00:00 2001 From: Bence Gelei Date: Thu, 12 Dec 2024 14:31:30 +0100 Subject: [PATCH 2/4] test enabled --- .../runtime/core/jsl/entity/TernaryTest.java | 25 +++++++++++-------- .../src/test/resources/TernaryTest.jsl | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java b/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java index 9dbdf175..5c910603 100644 --- a/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java +++ b/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java @@ -20,6 +20,10 @@ * #L% */ +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + import com.google.inject.Inject; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.ternarytest.ternarytest.aaa.AAA; import hu.blackbelt.judo.psm.generator.sdk.core.test.api.ternarytest.ternarytest.aaa.AAADao; @@ -29,17 +33,16 @@ import hu.blackbelt.judo.requirement.report.annotation.Requirement; import hu.blackbelt.judo.runtime.core.jsl.fixture.JudoRuntimeExtension; import lombok.extern.slf4j.Slf4j; +import org.hamcrest.CoreMatchers; +import org.hamcrest.MatcherAssert; +import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.*; +import static org.junit.jupiter.api.Assertions.*; @Slf4j public class TernaryTest { @@ -70,7 +73,7 @@ public void testTernaries() { final String stringValue = "STRING"; final Integer integerValue = 10; - final Double doubleValue = 3.14159265; + final double doubleValue = 3.14159265; final LocalDate dateValue = LocalDate.of(2020, 10, 20); final LocalDateTime timestampValue = LocalDateTime.of(2020, 10, 20, 16, 30, 5, 0); @@ -93,6 +96,7 @@ public void testTernaries() { assertThat(a.getDate().orElseThrow(), equalTo(dateValue)); assertThat(a.getTimestamp().orElseThrow(), equalTo(timestampValue)); assertThat(a.getUnknownCondition().orElseThrow(), equalTo(stringValue)); + assertThat(a.getEnum1().orElseThrow(), equalTo(Enum.Literal1)); assertEquals("true", a.getTs().orElseThrow()); @@ -117,7 +121,7 @@ public void testTernaries() { .withBooleanR(false) .withDateR(dateValue) .withTimestampR(timestampValue) - .withEnumR(Enum.Literal2) + .withEnumO(Enum.Literal2) .build() ); @@ -131,6 +135,7 @@ public void testTernaries() { assertTrue(a1.getDate().isEmpty()); assertTrue(a1.getTimestamp().isEmpty()); assertThat(a1.getUnknownCondition().orElseThrow(), equalTo(stringValue)); + assertThat(a1.getEnum1().orElseThrow(), equalTo(Enum.Literal2)); // TODO https://blackbelt.atlassian.net/browse/JNG-5543 diff --git a/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/resources/TernaryTest.jsl b/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/resources/TernaryTest.jsl index fb21b61d..e88be7ce 100644 --- a/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/resources/TernaryTest.jsl +++ b/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/resources/TernaryTest.jsl @@ -50,7 +50,7 @@ entity AAA { field Enum enumR; field Enum enumO; - //field Enum enum1 <= self.booleanR ? self.enumR : self.enumO; // TODO JNG-5544 error in runtime + field Enum enum1 <= self.booleanR ? self.enumR : self.enumO; field String FirstLetterIsUpper; field String FirstLetterIsUpperWithDefault default: "Hello"; From 2c6c2c43ac611d9833387fe5ead1f25b4e525484 Mon Sep 17 00:00:00 2001 From: Bence Gelei Date: Thu, 12 Dec 2024 14:49:11 +0100 Subject: [PATCH 3/4] JNG-5544 [Release] Updating versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 17eba05c..1b059df8 100644 --- a/pom.xml +++ b/pom.xml @@ -43,8 +43,8 @@ javax.resource;version="[1.6,2)" - 1.1.4.20241211_160519_93bf866b_feature_JNG_6021_SQL_Error_on_filter_with_count - 1.0.6.20241211_154309_7e8dda02_feature_JNG_6021_SQL_Error_on_filter_with_count + 1.1.4.20241212_134634_e1bccdcc_feature_JNG_5544_Fix_enumeration_switch_expressions + 1.0.6.20241212_134241_404ab490_feature_JNG_5544_Fix_enumeration_switch_expressions 1.0.0.20241202_042521_49b75de5_develop 1.3.0.20241202_042213_d30645b4_develop From cf4946dc7b57ef12c0af59ecc9513038eaae618a Mon Sep 17 00:00:00 2001 From: Bence Gelei Date: Thu, 12 Dec 2024 15:14:17 +0100 Subject: [PATCH 4/4] review fix --- .../judo/runtime/core/jsl/entity/TernaryTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java b/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java index 5c910603..016b336d 100644 --- a/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java +++ b/judo-runtime-core-jsl-itest/models/TernaryTestModel/src/test/java/hu/blackbelt/judo/runtime/core/jsl/entity/TernaryTest.java @@ -72,15 +72,15 @@ public class TernaryTest { public void testTernaries() { final String stringValue = "STRING"; - final Integer integerValue = 10; - final double doubleValue = 3.14159265; + final int integerValue = 10; + final BigDecimal doubleValue = BigDecimal.valueOf(3.14159265); final LocalDate dateValue = LocalDate.of(2020, 10, 20); final LocalDateTime timestampValue = LocalDateTime.of(2020, 10, 20, 16, 30, 5, 0); AAA a = aDao.create(AAAForCreate.builder() .withStringR(stringValue) .withIntegerR(integerValue) - .withDoubleR(BigDecimal.valueOf(doubleValue)) + .withDoubleR(doubleValue) .withBooleanR(true) .withDateR(dateValue) .withTimestampR(timestampValue) @@ -91,7 +91,7 @@ public void testTernaries() { assertThat(a.getConstantString().orElseThrow(), equalTo("X")); assertThat(a.getString().orElseThrow(), equalTo(stringValue)); assertThat(a.getInteger().orElseThrow(), equalTo(integerValue)); - assertThat(a.getDouble_().orElseThrow(), equalTo(BigDecimal.valueOf(doubleValue))); + assertThat(a.getDouble_().orElseThrow(), equalTo(doubleValue)); assertThat(a.getBoolean_().orElseThrow(), equalTo(true)); assertThat(a.getDate().orElseThrow(), equalTo(dateValue)); assertThat(a.getTimestamp().orElseThrow(), equalTo(timestampValue)); @@ -117,7 +117,7 @@ public void testTernaries() { AAA a1 = aDao.create(AAAForCreate.builder() .withStringR(stringValue) .withIntegerR(integerValue) - .withDoubleR(BigDecimal.valueOf(doubleValue)) + .withDoubleR(doubleValue) .withBooleanR(false) .withDateR(dateValue) .withTimestampR(timestampValue)