Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ ext {
}

allprojects {
apply plugin: 'maven'
apply plugin: 'jacoco'
apply plugin: 'idea'
apply plugin: 'project-report'
Expand Down Expand Up @@ -105,6 +104,10 @@ subprojects {
apply from: deps.scripts.modelCompiler
apply from: deps.scripts.projectLicenseReport

modelCompiler {
generateValidation = true
}

// Specific setup for a Travis build,
// which prevents appearing of warning messages in build logs.
//
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/proto/spine/test/core/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ message TaskAssigned {

ProjectId project_id = 2 [(required) = true];

string user_name = 3 [(pattern).regex = ".{3,}"];
string user_name = 3 [(required) = true, (pattern).regex = ".{3,}"];
}
32 changes: 16 additions & 16 deletions license-report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


# Dependencies of `io.spine:spine-client:1.3.1`
# Dependencies of `io.spine:spine-client:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -401,12 +401,12 @@
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:56 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 **Sun Jan 05 13:26:34 EET 2020** 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.3.1`
# Dependencies of `io.spine:spine-core:1.3.2`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -763,12 +763,12 @@ This report was generated on **Tue Dec 24 15:51:56 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:57 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 **Sun Jan 05 13:26:35 EET 2020** 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.3.1`
# Dependencies of `io.spine.tools:spine-model-assembler:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -1164,12 +1164,12 @@ This report was generated on **Tue Dec 24 15:51:57 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:57 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 **Sun Jan 05 13:26:36 EET 2020** 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.3.1`
# Dependencies of `io.spine.tools:spine-model-verifier:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -1625,12 +1625,12 @@ This report was generated on **Tue Dec 24 15:51:57 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:57 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 **Sun Jan 05 13:26:37 EET 2020** 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.3.1`
# Dependencies of `io.spine:spine-server:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -2043,12 +2043,12 @@ This report was generated on **Tue Dec 24 15:51:57 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:58 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 **Sun Jan 05 13:26:37 EET 2020** 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.3.1`
# Dependencies of `io.spine:spine-testutil-client:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -2502,12 +2502,12 @@ This report was generated on **Tue Dec 24 15:51:58 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:58 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 **Sun Jan 05 13:26:40 EET 2020** 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.3.1`
# Dependencies of `io.spine:spine-testutil-core:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -2969,12 +2969,12 @@ This report was generated on **Tue Dec 24 15:51:58 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:58 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 **Sun Jan 05 13:26:41 EET 2020** 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.3.1`
# Dependencies of `io.spine:spine-testutil-server:1.3.2`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -3472,4 +3472,4 @@ This report was generated on **Tue Dec 24 15:51:58 EET 2019** using [Gradle-Lice
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Tue Dec 24 15:51:59 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 **Sun Jan 05 13:26:44 EET 2020** 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).
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ all modules and does not describe the project structure per-subproject.

<groupId>io.spine</groupId>
<artifactId>spine-core-java</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>

<inceptionYear>2015</inceptionYear>

Expand Down Expand Up @@ -70,25 +70,25 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-base</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-time</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-model-compiler</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-plugin-base</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -130,25 +130,25 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-testlib</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-testutil-time</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-mute-logging</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-plugin-testlib</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -210,12 +210,12 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-javadoc-filter</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>spine-protoc-plugin</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import io.spine.server.bus.EnvelopeValidator;
import io.spine.server.type.EventEnvelope;
import io.spine.validate.ConstraintViolation;
import io.spine.validate.MessageValidator;
import io.spine.validate.Validate;

import java.util.List;
import java.util.Optional;
Expand All @@ -42,7 +42,7 @@ final class ImportValidator implements EnvelopeValidator<EventEnvelope> {
public Optional<MessageInvalid> validate(EventEnvelope event) {
checkNotNull(event);
EventMessage eventMessage = event.message();
List<ConstraintViolation> violations = MessageValidator.validate(eventMessage);
List<ConstraintViolation> violations = Validate.violationsOf(eventMessage);
if (violations.isEmpty()) {
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import io.spine.server.route.DefaultCommandRoute;
import io.spine.server.type.CommandEnvelope;
import io.spine.validate.ConstraintViolation;
import io.spine.validate.MessageValidator;
import io.spine.validate.Validate;

import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -139,7 +139,7 @@ private ViolationCheck(CommandEnvelope commandEnvelope) {
*/
@Internal
private static List<ConstraintViolation> validateId(CommandId id) {
List<ConstraintViolation> violations = MessageValidator.validate(id);
List<ConstraintViolation> violations = Validate.violationsOf(id);
if (id.getUuid().isEmpty()) {
return ImmutableList.<ConstraintViolation>builder()
.addAll(violations)
Expand Down Expand Up @@ -172,7 +172,7 @@ private void validateMessage() {
if (isDefault(message)) {
addViolation("Non-default command message must be set.");
}
List<ConstraintViolation> messageViolations = MessageValidator.validate(message);
List<ConstraintViolation> messageViolations = Validate.violationsOf(message);
result.addAll(messageViolations);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import io.spine.server.entity.rejection.CannotModifyDeletedEntity;
import io.spine.string.Stringifiers;
import io.spine.validate.ConstraintViolation;
import io.spine.validate.MessageValidator;
import io.spine.validate.Validate;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;

import java.util.List;
Expand Down Expand Up @@ -246,7 +246,7 @@ final void updateState(S state) {
/**
* Verifies the new entity state and returns {@link ConstraintViolation}s, if any.
*
* <p>Default implementation uses the {@linkplain MessageValidator#validate(Message) message
* <p>Default implementation uses the {@linkplain Validate#violationsOf(Message) message
* validation}.
*
* @param newState
Expand All @@ -255,7 +255,7 @@ final void updateState(S state) {
*/
protected final List<ConstraintViolation> checkEntityState(S newState) {
checkNotNull(newState);
return MessageValidator.validate(newState);
return Validate.violationsOf(newState);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/io/spine/server/entity/IdField.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void initBuilder(B builder, I id) {
}
FieldDescriptor idField = declaration.descriptor();
@SuppressWarnings("Immutable") // all supported types of IDs are immutable.
Required<I> required = Required.create(false);
Required required = Required.create(false);
boolean isRequired = required.valueFrom(idField)
.orElse(true); // assume required, if not set to false
if (isRequired) {
Expand Down
12 changes: 5 additions & 7 deletions server/src/main/java/io/spine/server/entity/Repository.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;

import java.util.Collection;
import java.util.Iterator;
import java.util.Optional;
import java.util.function.Predicate;
Expand Down Expand Up @@ -384,13 +383,12 @@ public final boolean isOpen() {
* <p>An {@code IllegalStateException} is thrown otherwise.
*
* @param result the result of routing
* @param <R> the type of the result
*/
private <R> void checkMatchesIdType(R result) {
private void checkMatchesIdType(Object result) {
Class routingResultType = null;
if (result instanceof Collection) {
Collection<?> asCollection = (Collection) result;
Object element = getFirst(asCollection, null);
if (result instanceof Iterable) {
Iterable<?> asIterable = (Iterable<?>) result;
Object element = getFirst(asIterable, null);
if (element != null) {
routingResultType = element.getClass();
}
Expand Down Expand Up @@ -477,7 +475,7 @@ public EventFilter eventFilter() {
/**
* Enumeration of generic type parameters of this class.
*/
enum GenericParameter implements GenericTypeIndex<Repository> {
private enum GenericParameter implements GenericTypeIndex<Repository> {

/** The index of the generic type {@code <I>}. */
ID(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import io.spine.server.bus.EnvelopeValidator;
import io.spine.server.type.EventEnvelope;
import io.spine.validate.ConstraintViolation;
import io.spine.validate.MessageValidator;
import io.spine.validate.Validate;

import java.util.List;
import java.util.Optional;
Expand All @@ -43,7 +43,7 @@ final class EventValidator implements EnvelopeValidator<EventEnvelope> {
public Optional<MessageInvalid> validate(EventEnvelope event) {
checkNotNull(event);
Event outerObject = event.outerObject();
List<ConstraintViolation> violations = MessageValidator.validate(outerObject);
List<ConstraintViolation> violations = Validate.violationsOf(outerObject);
if (violations.isEmpty()) {
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import io.spine.base.Error;
import io.spine.type.TypeName;
import io.spine.validate.ConstraintViolation;
import io.spine.validate.MessageValidator;
import io.spine.validate.Validate;
import io.spine.validate.ValidationError;
import io.spine.validate.diags.ViolationText;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -142,7 +142,7 @@ private static void handleValidationResult(@Nullable InvalidRequestException exc
* @return an instance of exception or null if the request message is valid.
*/
private @Nullable InvalidRequestException validateMessage(M request) {
List<ConstraintViolation> violations = MessageValidator.validate(request);
List<ConstraintViolation> violations = Validate.violationsOf(request);
if (violations.isEmpty()) {
return null;
}
Expand Down
Loading