diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 4510d8905..32acde0c5 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -8,6 +8,8 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version == [Unreleased] +== [1.0.2] - 2023-10-01 + === Added - Create Metadata API project @@ -30,7 +32,7 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version - Remove exception at the delete methods at the repositories proxies - Add support to LIKE conditions parameterized at Repository methods annotated with `@Query` - Enhance the error message when the entity in the repository does not have the Entity annotation -- query specification doesnt allow for dashes in table names +- query specification does not allow for dashes in table names == [1.0.1] - 2023-7-31 diff --git a/README.adoc b/README.adoc index 230d45699..a65b62dd9 100644 --- a/README.adoc +++ b/README.adoc @@ -153,7 +153,7 @@ Eclipse JNoSQL offers a mapping implementation for Key-Value NoSQL types: org.eclipse.jnosql.mapping jnosql-mapping-key-value - 1.0.1 + 1.0.2 ---- @@ -278,7 +278,7 @@ Eclipse JNoSQL offers a mapping implementation for Column NoSQL types: org.eclipse.jnosql.mapping jnosql-mapping-column - 1.0.1 + 1.0.2 ---- @@ -375,7 +375,7 @@ Eclipse JNoSQL offers a mapping implementation for Document NoSQL types: org.eclipse.jnosql.mapping jnosql-mapping-document - 1.0.1 + 1.0.2 ---- @@ -473,7 +473,7 @@ Eclipse JNoSQL offers a mapping implementation for Graph NoSQL types: org.eclipse.jnosql.mapping jnosql-mapping-graph - 1.0.1 + 1.0.2 ---- diff --git a/jnosql-communication/jnosql-communication-column/pom.xml b/jnosql-communication/jnosql-communication-column/pom.xml index 8149d68f2..b7c25e6ba 100644 --- a/jnosql-communication/jnosql-communication-column/pom.xml +++ b/jnosql-communication/jnosql-communication-column/pom.xml @@ -23,7 +23,7 @@ org.eclipse.jnosql.communication jnosql-communication - 1.0.2-SNAPSHOT + 1.0.2 jnosql-communication-column diff --git a/jnosql-communication/jnosql-communication-core/pom.xml b/jnosql-communication/jnosql-communication-core/pom.xml index 608634712..c46fb7b07 100644 --- a/jnosql-communication/jnosql-communication-core/pom.xml +++ b/jnosql-communication/jnosql-communication-core/pom.xml @@ -22,7 +22,7 @@ org.eclipse.jnosql.communication jnosql-communication - 1.0.2-SNAPSHOT + 1.0.2 jnosql-communication-core diff --git a/jnosql-communication/jnosql-communication-document/pom.xml b/jnosql-communication/jnosql-communication-document/pom.xml index 7b3737938..b20e2becb 100644 --- a/jnosql-communication/jnosql-communication-document/pom.xml +++ b/jnosql-communication/jnosql-communication-document/pom.xml @@ -23,7 +23,7 @@ org.eclipse.jnosql.communication jnosql-communication - 1.0.2-SNAPSHOT + 1.0.2 jnosql-communication-document diff --git a/jnosql-communication/jnosql-communication-key-value/pom.xml b/jnosql-communication/jnosql-communication-key-value/pom.xml index 4b70eda83..fd13a97a7 100644 --- a/jnosql-communication/jnosql-communication-key-value/pom.xml +++ b/jnosql-communication/jnosql-communication-key-value/pom.xml @@ -23,7 +23,7 @@ org.eclipse.jnosql.communication jnosql-communication - 1.0.2-SNAPSHOT + 1.0.2 jnosql-communication-key-value diff --git a/jnosql-communication/jnosql-communication-query/pom.xml b/jnosql-communication/jnosql-communication-query/pom.xml index d34729779..1bb974d80 100644 --- a/jnosql-communication/jnosql-communication-query/pom.xml +++ b/jnosql-communication/jnosql-communication-query/pom.xml @@ -17,7 +17,7 @@ org.eclipse.jnosql.communication jnosql-communication - 1.0.2-SNAPSHOT + 1.0.2 jnosql-communication-query diff --git a/jnosql-communication/pom.xml b/jnosql-communication/pom.xml index cfbc539c0..8965bfb03 100644 --- a/jnosql-communication/pom.xml +++ b/jnosql-communication/pom.xml @@ -23,7 +23,7 @@ org.eclipse.jnosql jnosql-parent - 1.0.2-SNAPSHOT + 1.0.2 org.eclipse.jnosql.communication diff --git a/jnosql-mapping/jnosql-mapping-api-core/pom.xml b/jnosql-mapping/jnosql-mapping-api-core/pom.xml index cef164d9b..904dd2ff4 100644 --- a/jnosql-mapping/jnosql-mapping-api-core/pom.xml +++ b/jnosql-mapping/jnosql-mapping-api-core/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-api-core diff --git a/jnosql-mapping/jnosql-mapping-column/pom.xml b/jnosql-mapping/jnosql-mapping-column/pom.xml index bff5dddf2..940ba5a47 100644 --- a/jnosql-mapping/jnosql-mapping-column/pom.xml +++ b/jnosql-mapping/jnosql-mapping-column/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-column diff --git a/jnosql-mapping/jnosql-mapping-core/pom.xml b/jnosql-mapping/jnosql-mapping-core/pom.xml index d66579194..88e0ea50a 100644 --- a/jnosql-mapping/jnosql-mapping-core/pom.xml +++ b/jnosql-mapping/jnosql-mapping-core/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-core diff --git a/jnosql-mapping/jnosql-mapping-core/src/main/java/org/eclipse/jnosql/mapping/config/MicroProfileSettings.java b/jnosql-mapping/jnosql-mapping-core/src/main/java/org/eclipse/jnosql/mapping/config/MicroProfileSettings.java index 55ff79f95..425c7b712 100644 --- a/jnosql-mapping/jnosql-mapping-core/src/main/java/org/eclipse/jnosql/mapping/config/MicroProfileSettings.java +++ b/jnosql-mapping/jnosql-mapping-core/src/main/java/org/eclipse/jnosql/mapping/config/MicroProfileSettings.java @@ -96,7 +96,9 @@ public List prefix(String prefix) { Objects.requireNonNull(prefix, "prefix is required"); return StreamSupport.stream(config.getPropertyNames().spliterator(), false) .filter(p -> p.startsWith(prefix)) - .map(p -> config.getValue(p, String.class)) + .map(p -> config.getOptionalValue(p, String.class)) + .filter(Optional::isPresent) + .flatMap(Optional::stream) .collect(Collectors.toUnmodifiableList()); } @@ -132,7 +134,9 @@ public List prefix(Iterable prefixes) { return StreamSupport.stream(config.getPropertyNames().spliterator(), false) .filter(prefixCondition) .sorted() - .map(p -> config.getValue(p, String.class)) + .map(p -> config.getOptionalValue(p, String.class)) + .filter(Optional::isPresent) + .flatMap(Optional::stream) .collect(Collectors.toList()); } diff --git a/jnosql-mapping/jnosql-mapping-core/src/test/java/org/eclipse/jnosql/mapping/config/MicroProfileSettingsTest.java b/jnosql-mapping/jnosql-mapping-core/src/test/java/org/eclipse/jnosql/mapping/config/MicroProfileSettingsTest.java index 21a36be16..d9f6a3ccf 100644 --- a/jnosql-mapping/jnosql-mapping-core/src/test/java/org/eclipse/jnosql/mapping/config/MicroProfileSettingsTest.java +++ b/jnosql-mapping/jnosql-mapping-core/src/test/java/org/eclipse/jnosql/mapping/config/MicroProfileSettingsTest.java @@ -15,7 +15,9 @@ package org.eclipse.jnosql.mapping.config; import org.eclipse.jnosql.communication.Settings; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -33,10 +35,14 @@ import static org.junit.jupiter.api.Assertions.*; class MicroProfileSettingsTest { - @BeforeEach - public void beforeEach() { + @AfterAll + public static void afterAll() { System.clearProperty("jnosql.jnosql.key"); System.clearProperty("jnosql.jnosql.host"); + System.clearProperty("key.jnosql"); + System.clearProperty("jnosql.key"); + System.clearProperty("jnosql.key-number"); + System.clearProperty("jnosql.host"); System.clearProperty("jnosql.host.1"); System.clearProperty("jnosql.host.2"); System.clearProperty("jnosql.host.3"); @@ -45,6 +51,23 @@ public void beforeEach() { System.clearProperty("jnosql.server.2"); } + @BeforeAll + public static void beforeAll() { + System.setProperty("jnosql.jnosql.key", "value"); + System.setProperty("jnosql.jnosql.host", "host"); + System.setProperty("key.jnosql", "value"); + System.setProperty("jnosql.key", "value"); + System.setProperty("jnosql.key-number", "12"); + System.setProperty("jnosql.host", "host"); + System.setProperty("jnosql.host.1", "host-1"); + System.setProperty("jnosql.host.2", "host-2"); + System.setProperty("jnosql.host.3", "host-3"); + System.setProperty("jnosql.server", "server"); + System.setProperty("jnosql.server.1", "server-1"); + System.setProperty("jnosql.server.2", "server-2"); + } + + @Test public void shouldReturnNPEWhenInstanceIsNull() { assertThrows(NullPointerException.class, () -> Settings.of((Map) null)); @@ -65,7 +88,6 @@ public void shouldCreateFromMap() { @Test public void shouldContainsKeys() { - setProperty(singletonMap("jnosql.key", "value")); Settings settings = MicroProfileSettings.INSTANCE; assertTrue(settings.containsKey("jnosql.key")); assertFalse(settings.containsKey("key2")); @@ -74,7 +96,6 @@ public void shouldContainsKeys() { @Test public void shouldGetKeys() { - setProperty(singletonMap("key.jnosql", "value")); Settings settings = MicroProfileSettings.INSTANCE; assertThat(settings.keySet()).contains("jnosql.key"); } @@ -95,25 +116,22 @@ public void shouldIsEmpty() { @Test public void shouldGet() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - Optional value = settings.get("jnosql.key"); + Optional value = settings.get("jnosql.key-number"); Assertions.assertNotNull(value); Assertions.assertEquals("12", value.get()); } @Test public void shouldGetSupplier() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - Optional value = settings.get(() -> "jnosql.key"); + Optional value = settings.get(() -> "jnosql.key-number"); Assertions.assertNotNull(value); Assertions.assertEquals("12", value.get()); } @Test public void shouldNPEGet() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; Assertions.assertThrows(NullPointerException.class, () -> settings.get((String) null)); Assertions.assertThrows(NullPointerException.class, () -> settings.get((Supplier) null)); @@ -121,25 +139,22 @@ public void shouldNPEGet() { @Test public void shouldGetIterable() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - Optional value = settings.get(Collections.singleton("jnosql.key")); + Optional value = settings.get(Collections.singleton("jnosql.key-number")); Assertions.assertNotNull(value); Assertions.assertEquals("12", value.get()); } @Test public void shouldGetIterableSupplier() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - Optional value = settings.getSupplier(Collections.singleton(() -> "jnosql.key")); + Optional value = settings.getSupplier(Collections.singleton(() -> "jnosql.key-number")); Assertions.assertNotNull(value); Assertions.assertEquals("12", value.get()); } @Test public void shouldNPEGetIterable() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; Assertions.assertThrows(NullPointerException.class, () -> settings.get((Iterable) null)); Assertions.assertThrows(NullPointerException.class, () -> settings.getSupplier(null)); @@ -147,49 +162,39 @@ public void shouldNPEGetIterable() { @Test public void shouldGetValueClass() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - Integer value = settings.get("jnosql.key", Integer.class).get(); + Integer value = settings.get("jnosql.key-number", Integer.class).get(); assertEquals(Integer.valueOf(12), value); assertFalse(settings.get("jnosql.key2", Integer.class).isPresent()); } @Test public void shouldGetValueClassSupplier() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - Integer value = settings.get(() -> "jnosql.key", Integer.class).get(); + Integer value = settings.get(() -> "jnosql.key-number", Integer.class).get(); assertEquals(Integer.valueOf(12), value); assertFalse(settings.get(() -> "key2", Integer.class).isPresent()); } @Test public void shouldGetOrDefault() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - assertEquals("12", settings.getOrDefault("jnosql.key", "13")); + assertEquals("12", settings.getOrDefault("jnosql.key-number", "13")); assertEquals("13", settings.getOrDefault("key-1", "13")); } @Test public void shouldGetOrDefaultSupplier() { - setProperty(singletonMap("jnosql.key", "12")); Settings settings = MicroProfileSettings.INSTANCE; - assertEquals("12", settings.getOrDefault(() -> "jnosql.key", "13")); + assertEquals("12", settings.getOrDefault(() -> "jnosql.key-number", "13")); assertEquals("13", settings.getOrDefault(() -> "key-1", "13")); } @Test public void shouldReturnErrorWhenPrefixIsNull() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.host.2", "host-2", - "jnosql.host.3", "host-3"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; assertThrows(NullPointerException.class, () -> settings.prefix((String) null)); @@ -197,12 +202,6 @@ public void shouldReturnErrorWhenPrefixIsNull() { @Test public void shouldFindPrefix() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.host.2", "host-2", - "jnosql.host.3", "host-3"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; List hosts = settings.prefix("jnosql.host"); @@ -213,12 +212,6 @@ public void shouldFindPrefix() { @Test public void shouldFindPrefixSupplier() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.host.2", "host-2", - "jnosql.host.3", "host-3"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; List hosts = settings.prefix(() -> "jnosql.host"); @@ -229,12 +222,6 @@ public void shouldFindPrefixSupplier() { @Test public void shouldFindPrefixWithOrder() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.host.2", "host-2", - "jnosql.host.3", "host-3"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; List hosts = settings.prefix("jnosql.host"); assertThat(hosts).hasSize(4).contains("host", "host-1", "host-2", "host-3"); @@ -243,12 +230,6 @@ public void shouldFindPrefixWithOrder() { @Test public void shouldReturnErrorWhenPrefixesIsNull() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.host.2", "host-2", - "jnosql.host.3", "host-3"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; assertThrows(NullPointerException.class, () -> settings.prefix((Collection) null)); @@ -257,50 +238,29 @@ public void shouldReturnErrorWhenPrefixesIsNull() { @Test public void shouldFindPrefixes() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.server", "server", - "jnosql.server.1", "server-1"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; List hosts = settings.prefix(Arrays.asList("jnosql.host", "jnosql.server")); - assertThat(hosts).hasSize(4).contains("host", "host-1", "server", "server-1"); + assertThat(hosts).hasSize(7).contains("host", "host-1", "server", "server-1"); } @Test public void shouldFindPrefixesSupplier() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.server", "server", - "jnosql.server.1", "server-1"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; List hosts = settings.prefixSupplier(Arrays.asList(() -> "jnosql.host", () -> "jnosql.server")); - assertThat(hosts).hasSize(4).contains("host", "host-1", "server", "server-1"); + assertThat(hosts).hasSize(7).contains("host", "host-1", "server", "server-1"); } @Test public void shouldFindPrefixesSort() { - Map params = Map.of( - "jnosql.host", "host", - "jnosql.host.1", "host-1", - "jnosql.server", "server", - "jnosql.server.1", "server-1"); - setProperty(params); Settings settings = MicroProfileSettings.INSTANCE; List hosts = settings.prefix(Arrays.asList("jnosql.host", "jnosql.server")); - assertThat(hosts).hasSize(4).contains("host", "host-1", "server", "server-1"); + assertThat(hosts).hasSize(7).contains("host", "host-1", "server", "server-1"); } - private void setProperty(Map params) { - params.forEach((k, v) -> System.setProperty(k, v.toString())); - } } \ No newline at end of file diff --git a/jnosql-mapping/jnosql-mapping-document/pom.xml b/jnosql-mapping/jnosql-mapping-document/pom.xml index e85c644b9..9ce3d9082 100644 --- a/jnosql-mapping/jnosql-mapping-document/pom.xml +++ b/jnosql-mapping/jnosql-mapping-document/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-document diff --git a/jnosql-mapping/jnosql-mapping-graph/pom.xml b/jnosql-mapping/jnosql-mapping-graph/pom.xml index 1e0d47f72..26d082f3b 100644 --- a/jnosql-mapping/jnosql-mapping-graph/pom.xml +++ b/jnosql-mapping/jnosql-mapping-graph/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-graph diff --git a/jnosql-mapping/jnosql-mapping-key-value/pom.xml b/jnosql-mapping/jnosql-mapping-key-value/pom.xml index d72e83953..bb06b8b30 100644 --- a/jnosql-mapping/jnosql-mapping-key-value/pom.xml +++ b/jnosql-mapping/jnosql-mapping-key-value/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-key-value diff --git a/jnosql-mapping/jnosql-mapping-reflection/pom.xml b/jnosql-mapping/jnosql-mapping-reflection/pom.xml index cd09d8a1e..cbb0eb429 100644 --- a/jnosql-mapping/jnosql-mapping-reflection/pom.xml +++ b/jnosql-mapping/jnosql-mapping-reflection/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jnosql.mapping jnosql-mapping-parent - 1.0.2-SNAPSHOT + 1.0.2 jnosql-mapping-reflection diff --git a/jnosql-mapping/pom.xml b/jnosql-mapping/pom.xml index 78548a1f9..aac0a2c2c 100644 --- a/jnosql-mapping/pom.xml +++ b/jnosql-mapping/pom.xml @@ -22,7 +22,7 @@ org.eclipse.jnosql jnosql-parent - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/pom.xml b/pom.xml index daba92ab2..102fe3ff7 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.eclipse.jnosql jnosql-parent - 1.0.2-SNAPSHOT + 1.0.2 pom Eclipse JNoSQL The Eclipse JNoSQL is a framework to help developers create enterprise-grade applications using Java @@ -77,12 +77,12 @@ UTF-8 ../target/jacoco.exec 3.9.1.2184 - 2.13.0 + 2.14.0 **/jnosql/query/grammar/** 5.1.1.SP2 3.0.3 3.0.3 - 3.3.4 + 3.4.0 10.12.0 1.6