Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into fix-migrations
  • Loading branch information
dmitrykuzmin committed Sep 2, 2020
2 parents 4fcf821 + 6ebebcc commit 06274d3
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 57 deletions.
14 changes: 13 additions & 1 deletion buildSrc/src/main/kotlin/io/spine/gradle/internal/deps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ object Versions {
val animalSniffer = "1.18"
val apiguardian = "1.1.0"
val javaxAnnotation = "1.3.2"
val klaxon = "5.4"
val ouathJwt = "3.10.3"
val bouncyCastlePkcs = "1.66"
val assertK = "0.22"

/**
* Version of the SLF4J library.
Expand Down Expand Up @@ -159,7 +163,7 @@ object Build {

object AutoService {
val annotations = "com.google.auto.service:auto-service-annotations:${Versions.autoService}"
val processor = "com.google.auto.service:auto-service:${Versions.autoService}"
val processor = "com.google.auto.service:auto-service:${Versions.autoService}"
}
}

Expand All @@ -168,6 +172,13 @@ object Gen {
val javaxAnnotation = "javax.annotation:javax.annotation-api:${Versions.javaxAnnotation}"
}

object Publishing {
val klaxon = "com.beust:klaxon:${Versions.klaxon}"
val oauthJwt = "com.auth0:java-jwt:${Versions.ouathJwt}"
val bouncyCastlePkcs = "org.bouncycastle:bcpkix-jdk15on:${Versions.bouncyCastlePkcs}"
val assertK = "com.willowtreeapps.assertk:assertk-jvm:${Versions.assertK}"
}

object Grpc {
val core = "io.grpc:grpc-core:${Versions.grpc}"
val stub = "io.grpc:grpc-stub:${Versions.grpc}"
Expand Down Expand Up @@ -275,6 +286,7 @@ object Deps {
val test = Test
val versions = Versions
val scripts = Scripts
val publishing = Publishing
}

object DependencyResolution {
Expand Down
2 changes: 1 addition & 1 deletion config
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-6.4.1-bin.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-6.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
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.5.27`
# Dependencies of `io.spine:spine-client:1.5.28`

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


This report was generated on **Mon Aug 31 12:45:57 EEST 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).
This report was generated on **Tue Sep 01 23:59:03 EEST 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.5.27`
# Dependencies of `io.spine:spine-core:1.5.28`

## Runtime
1. **Group:** com.google.code.findbugs **Name:** jsr305 **Version:** 3.0.2
Expand Down Expand Up @@ -777,12 +777,12 @@ This report was generated on **Mon Aug 31 12:45:57 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:45:57 EEST 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).
This report was generated on **Tue Sep 01 23:59:03 EEST 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.5.27`
# Dependencies of `io.spine.tools:spine-model-assembler:1.5.28`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -1183,12 +1183,12 @@ This report was generated on **Mon Aug 31 12:45:57 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:45:58 EEST 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).
This report was generated on **Tue Sep 01 23:59:04 EEST 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.5.27`
# Dependencies of `io.spine.tools:spine-model-verifier:1.5.28`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -1659,12 +1659,12 @@ This report was generated on **Mon Aug 31 12:45:58 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:45:59 EEST 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).
This report was generated on **Tue Sep 01 23:59:04 EEST 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.5.27`
# Dependencies of `io.spine:spine-server:1.5.28`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -2082,12 +2082,12 @@ This report was generated on **Mon Aug 31 12:45:59 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:45:59 EEST 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).
This report was generated on **Tue Sep 01 23:59:04 EEST 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.5.27`
# Dependencies of `io.spine:spine-testutil-client:1.5.28`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -2542,12 +2542,12 @@ This report was generated on **Mon Aug 31 12:45:59 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:46:01 EEST 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).
This report was generated on **Tue Sep 01 23:59:06 EEST 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.5.27`
# Dependencies of `io.spine:spine-testutil-core:1.5.28`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -3010,12 +3010,12 @@ This report was generated on **Mon Aug 31 12:46:01 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:46:02 EEST 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).
This report was generated on **Tue Sep 01 23:59:07 EEST 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.5.27`
# Dependencies of `io.spine:spine-testutil-server:1.5.28`

## Runtime
1. **Group:** com.google.android **Name:** annotations **Version:** 4.1.1.4
Expand Down Expand Up @@ -3514,4 +3514,4 @@ This report was generated on **Mon Aug 31 12:46:02 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Mon Aug 31 12:46:05 EEST 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).
This report was generated on **Tue Sep 01 23:59:08 EEST 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).
2 changes: 1 addition & 1 deletion 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.5.27</version>
<version>1.5.28</version>

<inceptionYear>2015</inceptionYear>

Expand Down
44 changes: 39 additions & 5 deletions server/src/main/java/io/spine/server/tuple/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package io.spine.server.tuple;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.protobuf.Message;
import io.spine.server.tuple.Element.AValue;
import io.spine.server.tuple.Element.BValue;
Expand Down Expand Up @@ -59,27 +60,50 @@ private Pair(A a, B b) {
* Creates a new pair of values.
*/
public static <A extends Message, B extends Message> Pair<A, B> of(A a, B b) {
Pair<A, B> result = new Pair<>(checkNotNullOrEmpty(Pair.class, a),
checkNotNullOrEmpty(Pair.class, b));
A safeA = checkNotNullOrEmpty(a);
B safeB = checkNotNullOrEmpty(b);
Pair<A, B> result = new Pair<>(safeA, safeB);
return result;
}

/**
* Creates a pair with optionally present second value.
*
* @see #withOptional(Message, Optional)
*/
public static <A extends Message, B extends Message>
Pair<A, Optional<B>> withNullable(A a, @Nullable B b) {
checkNotNullOrEmpty(Pair.class, a);
checkNotEmpty(Pair.class, b);
checkNotNullOrEmpty(a);
checkNotEmpty(b);
Pair<A, Optional<B>> result = new Pair<>(a, ofNullable(b));
return result;
}

/**
* Creates a pair with optionally present second value.
*
* @see #withNullable(Message, Message)
* @apiNote This method treats a special case of construction using already available
* instance of {@code Optional}. This avoids unwrapping of {@code Optional} which would
* have been required for passing an optional value to
* {@link #withNullable(Message, Message)}.
*/
public static <A extends Message, B extends Message>
Pair<A, Optional<B>> withOptional(
A a,
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") /* see @apiNote */ Optional<B> b
) {
checkNotNullOrEmpty(a);
checkNotNull(b);
Pair<A, Optional<B>> result = new Pair<>(a, b);
return result;
}

/**
* Creates a pair with the second element of a type descending from {@link Either}.
*/
public static <A extends Message, B extends Either> Pair<A, B> withEither(A a, B b) {
checkNotNullOrEmpty(Pair.class, a);
checkNotNullOrEmpty(a);
checkNotNull(b);
Pair<A, B> result = new Pair<>(a, b);
return result;
Expand All @@ -94,4 +118,14 @@ public A getA() {
public B getB() {
return value(this, 1);
}

@CanIgnoreReturnValue
private static <M extends Message> M checkNotNullOrEmpty(M value) {
return checkNotNullOrEmpty(Pair.class, value);
}

@CanIgnoreReturnValue
private static <M extends Message> @Nullable M checkNotEmpty(@Nullable M value) {
return checkNotEmpty(Pair.class, value);
}
}
35 changes: 28 additions & 7 deletions server/src/main/java/io/spine/server/tuple/Quartet.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package io.spine.server.tuple;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.protobuf.Message;
import io.spine.server.tuple.Element.AValue;
import io.spine.server.tuple.Element.BValue;
Expand Down Expand Up @@ -65,7 +66,7 @@ private Quartet(A a, B b, C c, D d) {
*/
public static <A extends Message, B extends Message, C extends Message, D extends Message>
Quartet<A, B, C, D> of(A a, B b, C c, D d) {
checkAllNotNullOrEmpty(Quartet.class, a, b, c, d);
checkAllNotNullOrEmpty(a, b, c, d);
Quartet<A, B, C, D> result = new Quartet<>(a, b, c, d);
return result;
}
Expand All @@ -75,8 +76,8 @@ Quartet<A, B, C, D> of(A a, B b, C c, D d) {
*/
public static <A extends Message, B extends Message, C extends Message, D extends Message>
Quartet<A, B, C, Optional<D>> withNullable(A a, B b, C c, @Nullable D d) {
checkAllNotNullOrEmpty(Quartet.class, a, b, c);
checkNotEmpty(Quartet.class, d);
checkAllNotNullOrEmpty(a, b, c);
checkNotEmpty(d);
Quartet<A, B, C, Optional<D>> result = new Quartet<>(a, b, c, ofNullable(d));
return result;
}
Expand All @@ -86,8 +87,8 @@ Quartet<A, B, C, Optional<D>> withNullable(A a, B b, C c, @Nullable D d) {
*/
public static <A extends Message, B extends Message, C extends Message, D extends Message>
Quartet<A, B, Optional<C>, Optional<D>> withNullable2(A a, B b, @Nullable C c, @Nullable D d) {
checkAllNotNullOrEmpty(Quartet.class, a, b);
checkAllNotEmpty(Quartet.class, c, d);
checkAllNotNullOrEmpty(a, b);
checkAllNotEmpty(c, d);
Quartet<A, B, Optional<C>, Optional<D>> result =
new Quartet<>(a, b, ofNullable(c), ofNullable(d));
return result;
Expand All @@ -99,8 +100,8 @@ Quartet<A, B, Optional<C>, Optional<D>> withNullable2(A a, B b, @Nullable C c, @
public static <A extends Message, B extends Message, C extends Message, D extends Message>
Quartet<A, Optional<B>, Optional<C>, Optional<D>>
withNullable3(A a, @Nullable B b, @Nullable C c, @Nullable D d) {
checkNotNullOrEmpty(Quartet.class, a);
checkAllNotEmpty(Quartet.class, b, c, d);
checkNotNullOrEmpty(a);
checkAllNotEmpty(b, c, d);
Quartet<A, Optional<B>, Optional<C>, Optional<D>> result =
new Quartet<>(a, ofNullable(b), ofNullable(c), ofNullable(d));
return result;
Expand All @@ -125,4 +126,24 @@ public C getC() {
public D getD() {
return value(this, 3);
}

@CanIgnoreReturnValue
private static <M extends Message> M checkNotNullOrEmpty(M value) {
return checkNotNullOrEmpty(Quartet.class, value);
}

@CanIgnoreReturnValue
private static <M extends Message> @Nullable M checkNotEmpty(@Nullable M value) {
return checkNotEmpty(Quartet.class, value);
}

@SuppressWarnings("OverloadedVarargsMethod") // to avoid repeated usage of this class name.
private static void checkAllNotNullOrEmpty(Message... values) {
checkAllNotNullOrEmpty(Quartet.class, values);
}

@SuppressWarnings("OverloadedVarargsMethod") // to avoid repeated usage of this class name.
private static void checkAllNotEmpty(Message... values) {
checkAllNotEmpty(Quartet.class, values);
}
}
Loading

0 comments on commit 06274d3

Please sign in to comment.