diff --git a/client/src/main/java/io/spine/client/Filters.java b/client/src/main/java/io/spine/client/Filters.java
index f4f01258af2..d410b5b4615 100644
--- a/client/src/main/java/io/spine/client/Filters.java
+++ b/client/src/main/java/io/spine/client/Filters.java
@@ -26,6 +26,7 @@
import io.spine.base.Field;
import io.spine.base.FieldPath;
import io.spine.client.CompositeFilter.CompositeOperator;
+import io.spine.core.Version;
import java.util.Collection;
@@ -63,6 +64,7 @@
* {@link #le <=}) supports only the following types:
*
* - {@link Timestamp com.google.protobuf.Timestamp};
+ *
- {@link Version io.spine.core.Version};
*
- Java primitive number types;
*
- {@code String}.
*
@@ -217,7 +219,7 @@ public static CompositeFilter either(Filter first, Filter... rest) {
static CompositeFilter all(Collection filters) {
checkNotNull(filters);
checkArgument(!filters.isEmpty(),
- "Composite filter must contain at least one simple filter in it");
+ "Composite filter must contain at least one simple filter in it.");
return composeFilters(filters, ALL);
}
@@ -247,9 +249,10 @@ private static void checkSupportedOrderingComparisonType(Class> cls) {
Class> dataType = Primitives.wrap(cls);
boolean supported = isSupportedNumber(dataType)
|| Timestamp.class.isAssignableFrom(dataType)
+ || Version.class.isAssignableFrom(dataType)
|| String.class.isAssignableFrom(dataType);
checkArgument(supported,
- "The type %s is not supported for the ordering comparison.",
+ "The type `%s` is not supported for the ordering comparison.",
dataType.getCanonicalName());
}
diff --git a/client/src/test/java/io/spine/client/FiltersTest.java b/client/src/test/java/io/spine/client/FiltersTest.java
index 24cf6eb5f06..65883fc8ed3 100644
--- a/client/src/test/java/io/spine/client/FiltersTest.java
+++ b/client/src/test/java/io/spine/client/FiltersTest.java
@@ -26,6 +26,8 @@
import com.google.protobuf.StringValue;
import com.google.protobuf.Timestamp;
import io.spine.client.Filter.Operator;
+import io.spine.core.Version;
+import io.spine.core.Versions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
@@ -56,7 +58,6 @@
import static io.spine.testing.Tests.assertHasPrivateParameterlessCtor;
import static java.lang.String.join;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@DisplayName("Filters utility should")
@@ -176,22 +177,46 @@ class CreateOrderingFilter {
@DisplayName("for numbers")
void forNumbers() {
double number = 3.14;
- Filter filter = le("doubleField", number);
- assertNotNull(filter);
- assertEquals(LESS_OR_EQUAL, filter.getOperator());
+ Filter filter = le("double_field", number);
+ assertThat(filter).isNotNull();
+ assertThat(filter.getOperator()).isEqualTo(LESS_OR_EQUAL);
+
DoubleValue value = unpack(filter.getValue(), DoubleValue.class);
- assertEquals(number, value.getValue());
+ assertThat(value.getValue()).isWithin(0.01).of(number);
}
@Test
@DisplayName("for strings")
void forStrings() {
String theString = "abc";
- Filter filter = gt("stringField", theString);
- assertNotNull(filter);
- assertEquals(GREATER_THAN, filter.getOperator());
+ Filter filter = gt("string_field", theString);
+ assertThat(filter).isNotNull();
+ assertThat(filter.getOperator()).isEqualTo(GREATER_THAN);
+
StringValue value = unpack(filter.getValue(), StringValue.class);
- assertEquals(theString, value.getValue());
+ assertThat(value.getValue()).isEqualTo(theString);
+ }
+
+ @Test
+ @DisplayName("for timestamps")
+ void forTimestamps() {
+ Timestamp timestamp = currentTime();
+ Filter filter = gt("timestamp_field", timestamp);
+ assertThat(filter).isNotNull();
+ assertThat(filter.getOperator()).isEqualTo(GREATER_THAN);
+ Timestamp value = unpack(filter.getValue(), Timestamp.class);
+ assertThat(value).isEqualTo(timestamp);
+ }
+
+ @Test
+ @DisplayName("for versions")
+ void forVersions() {
+ Version version = Versions.zero();
+ Filter filter = ge("version_field", version);
+ assertThat(filter).isNotNull();
+ assertThat(filter.getOperator()).isEqualTo(GREATER_OR_EQUAL);
+ Version value = unpack(filter.getValue(), Version.class);
+ assertThat(value).isEqualTo(version);
}
}
diff --git a/license-report.md b/license-report.md
index 5d9572ce472..7c9c46f712b 100644
--- a/license-report.md
+++ b/license-report.md
@@ -1,6 +1,6 @@
-# Dependencies of `io.spine:spine-client:1.2.3`
+# Dependencies of `io.spine:spine-client:1.2.4`
## Runtime
1. **Group:** com.google.api.grpc **Name:** proto-google-common-protos **Version:** 1.12.0
@@ -381,12 +381,12 @@
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:17 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:16 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine:spine-core:1.2.3`
+# Dependencies of `io.spine:spine-core:1.2.4`
## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
@@ -743,12 +743,12 @@ This report was generated on **Mon Nov 18 15:49:17 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:20 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:20 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine.tools:spine-model-assembler:1.2.3`
+# Dependencies of `io.spine.tools:spine-model-assembler:1.2.4`
## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
@@ -1144,12 +1144,12 @@ This report was generated on **Mon Nov 18 15:49:20 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:24 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:24 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine.tools:spine-model-verifier:1.2.3`
+# Dependencies of `io.spine.tools:spine-model-verifier:1.2.4`
## Runtime
1. **Group:** aopalliance **Name:** aopalliance **Version:** 1.0
@@ -1699,12 +1699,12 @@ This report was generated on **Mon Nov 18 15:49:24 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:29 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:29 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine:spine-server:1.2.3`
+# Dependencies of `io.spine:spine-server:1.2.4`
## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
@@ -2117,12 +2117,12 @@ This report was generated on **Mon Nov 18 15:49:29 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:36 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:33 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine:spine-testutil-client:1.2.3`
+# Dependencies of `io.spine:spine-testutil-client:1.2.4`
## Runtime
1. **Group:** com.google.api.grpc **Name:** proto-google-common-protos **Version:** 1.12.0
@@ -2536,12 +2536,12 @@ This report was generated on **Mon Nov 18 15:49:36 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:39 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:38 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine:spine-testutil-core:1.2.3`
+# Dependencies of `io.spine:spine-testutil-core:1.2.4`
## Runtime
1. **Group:** com.google.api.grpc **Name:** proto-google-common-protos **Version:** 1.12.0
@@ -2963,12 +2963,12 @@ This report was generated on **Mon Nov 18 15:49:39 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:42 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
+This report was generated on **Mon Nov 18 19:25:42 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
-# Dependencies of `io.spine:spine-testutil-server:1.2.3`
+# Dependencies of `io.spine:spine-testutil-server:1.2.4`
## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
@@ -3466,4 +3466,4 @@ This report was generated on **Mon Nov 18 15:49:42 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
-This report was generated on **Mon Nov 18 15:49:46 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
\ No newline at end of file
+This report was generated on **Mon Nov 18 19:25:49 EET 2019** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 82dc6cb514b..c8d40f24925 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@ all modules and does not describe the project structure per-subproject.
io.spine
spine-core-java
-1.2.3
+1.2.4
2015
diff --git a/server/src/main/java/io/spine/server/entity/storage/AbstractColumnMapping.java b/server/src/main/java/io/spine/server/entity/storage/AbstractColumnMapping.java
index e4291245910..8061894f93a 100644
--- a/server/src/main/java/io/spine/server/entity/storage/AbstractColumnMapping.java
+++ b/server/src/main/java/io/spine/server/entity/storage/AbstractColumnMapping.java
@@ -36,6 +36,10 @@
*
* Since entity columns are proto-based and have a limited amount of possible types, this class
* allows descendants to override concrete type mapping rules in a convenient way.
+ *
+ *
Some of the types are expected to be mapped in a way so they support the ordering comparison
+ * operators ("greater than", "less than or equals", etc.). For details, see
+ * {@link io.spine.client.Filters}.
*/
public abstract class AbstractColumnMapping implements ColumnMapping {
diff --git a/server/src/test/java/io/spine/server/type/EventClassTest.java b/server/src/test/java/io/spine/server/type/EventClassTest.java
index 702e780befb..38ca281c2f5 100644
--- a/server/src/test/java/io/spine/server/type/EventClassTest.java
+++ b/server/src/test/java/io/spine/server/type/EventClassTest.java
@@ -21,17 +21,22 @@
package io.spine.server.type;
import com.google.common.testing.NullPointerTester;
+import com.google.protobuf.Any;
+import io.spine.core.Event;
+import io.spine.protobuf.AnyPacker;
import io.spine.test.core.ProjectCreated;
import io.spine.test.core.ProjectId;
import io.spine.type.TypeUrl;
import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
+import static com.google.common.truth.Truth.assertThat;
+import static io.spine.base.Identifier.newUuid;
import static io.spine.testing.DisplayNames.NOT_ACCEPT_NULLS;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
-@DisplayName("EventClass should")
+@DisplayName("`EventClass` should")
class EventClassTest {
@Test
@@ -41,12 +46,37 @@ void passNullToleranceCheck() {
.testAllPublicStaticMethods(EventClass.class);
}
- @Test
- @DisplayName("be constructed from TypeUrl instance")
- void constructFromTypeUrl() {
- TypeUrl typeUrl = TypeUrl.from(ProjectCreated.getDescriptor());
- EventClass eventClass = EventClass.from(typeUrl);
- assertEquals(ProjectCreated.class, eventClass.value());
+ @Nested
+ @DisplayName("be constructed")
+ class BeConstructed {
+
+ @Test
+ @DisplayName("from `TypeUrl` instance")
+ void fromTypeUrl() {
+ TypeUrl typeUrl = TypeUrl.from(ProjectCreated.getDescriptor());
+ EventClass eventClass = EventClass.from(typeUrl);
+ assertThat(eventClass.value()).isEqualTo(ProjectCreated.class);
+ }
+
+ @Test
+ @DisplayName("from `Event` instance")
+ void fromEvent() {
+ ProjectId id = ProjectId
+ .newBuilder()
+ .setId(newUuid())
+ .build();
+ ProjectCreated projectCreated = ProjectCreated
+ .newBuilder()
+ .setProjectId(id)
+ .build();
+ Any any = AnyPacker.pack(projectCreated);
+ Event event = Event
+ .newBuilder()
+ .setMessage(any)
+ .build();
+ EventClass eventClass = EventClass.from(event);
+ assertThat(eventClass.value()).isEqualTo(ProjectCreated.class);
+ }
}
@SuppressWarnings({"CheckReturnValue", "ResultOfMethodCallIgnored"})
diff --git a/version.gradle b/version.gradle
index 230eb0459e1..e23d6b963bb 100644
--- a/version.gradle
+++ b/version.gradle
@@ -25,14 +25,14 @@
* as we want to manage the versions in a single source.
*/
-final def spineVersion = '1.2.3'
+final def spineVersion = '1.2.4'
ext {
// The version of the modules in this project.
versionToPublish = spineVersion
// Depend on `base` for the general definitions and a model compiler.
- spineBaseVersion = spineVersion
+ spineBaseVersion = '1.2.3'
// Depend on `time` for `ZoneId`, `ZoneOffset` and other date/time types and utilities.
spineTimeVersion = '1.2.1'