From 347a9a937fc3ebdf50c0f36eeb50e0a2858a0cae Mon Sep 17 00:00:00 2001 From: Dean Wette Date: Wed, 7 Sep 2022 13:09:50 -0500 Subject: [PATCH 01/12] ci: version to 6.0.0 Micronaut 4.0.0-SNAPSHOT githubCoreBranch=4.0.x (#318) * use buildSrc scripts to avoid unnecessary duplication --- build.gradle | 5 + buildSrc/build.gradle | 3 + ...cronaut.build.internal.redis-module.gradle | 8 + config/accepted-api-changes.json | 37 ++++ gradle.properties | 6 +- redis-lettuce/build.gradle | 2 +- .../lettuce/AbstractRedisClientFactory.java | 13 -- .../configuration/lettuce/RedisSetting.java | 8 +- .../lettuce/cache/AsyncCacheCommands.java | 98 ----------- .../lettuce/cache/SyncCacheCommands.java | 93 ---------- .../lettuce/session/RedisSessionCommands.java | 164 ------------------ .../lettuce/test/EmbeddedRedisServer.java | 119 ------------- .../lettuce/test/package-info.java | 22 --- .../lettuce/cache/SyncCacheSpec.groovy | 6 +- 14 files changed, 61 insertions(+), 523 deletions(-) create mode 100644 buildSrc/build.gradle create mode 100644 buildSrc/src/main/groovy/io.micronaut.build.internal.redis-module.gradle create mode 100644 config/accepted-api-changes.json delete mode 100644 redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AsyncCacheCommands.java delete mode 100644 redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/SyncCacheCommands.java delete mode 100644 redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionCommands.java delete mode 100644 redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/EmbeddedRedisServer.java delete mode 100644 redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/package-info.java diff --git a/build.gradle b/build.gradle index cf34f01f..f7a13198 100644 --- a/build.gradle +++ b/build.gradle @@ -3,3 +3,8 @@ plugins { id "io.micronaut.build.internal.dependency-updates" id "io.micronaut.build.internal.quality-reporting" } + +repositories { + mavenCentral() + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..67840524 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,3 @@ +plugins { + id 'groovy-gradle-plugin' +} diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.redis-module.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.redis-module.gradle new file mode 100644 index 00000000..beae5c47 --- /dev/null +++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.redis-module.gradle @@ -0,0 +1,8 @@ +plugins { + id "io.micronaut.build.internal.module" +} + +repositories { + mavenCentral() + maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" } +} diff --git a/config/accepted-api-changes.json b/config/accepted-api-changes.json new file mode 100644 index 00000000..1e22ee43 --- /dev/null +++ b/config/accepted-api-changes.json @@ -0,0 +1,37 @@ +[ + { + "type": "io.micronaut.configuration.lettuce.RedisSetting", + "member": "Field REDIS_EMBEDDED", + "reason": "Removed deprecated field for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Field $ANNOTATION_METADATA", + "reason": "Removed deprecated field for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Constructor io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference()", + "reason": "Removed deprecated class for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Field $ANNOTATION_METADATA", + "reason": "Removed deprecated class for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Constructor io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference()", + "reason": "Removed deprecated class for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer", + "member": "Constructor io.micronaut.configuration.lettuce.test.EmbeddedRedisServer(io.micronaut.configuration.lettuce.test.EmbeddedRedisServer$Configuration)", + "reason": "Removed deprecated class for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer$Configuration", + "member": "Constructor io.micronaut.configuration.lettuce.test.EmbeddedRedisServer$Configuration()", + "reason": "Removed deprecated class for Micronaut 4.0.x" + } +] diff --git a/gradle.properties b/gradle.properties index fe74906c..142d2447 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ -projectVersion=5.3.1-SNAPSHOT +projectVersion=6.0.0-SNAPSHOT projectGroup=io.micronaut.redis micronautDocsVersion=2.0.0 -micronautVersion=3.5.4 +micronautVersion=4.0.0-SNAPSHOT micronautTestVersion=3.4.0 groovyVersion=3.0.12 @@ -14,7 +14,7 @@ projectUrl=https://micronaut.io githubSlug=micronaut-projects/micronaut-redis developers=Graeme Rocher -githubCoreBranch=3.6.x +githubCoreBranch=4.0.x bomProperty=micronautRedisVersion bomProperties=lettuceVersion diff --git a/redis-lettuce/build.gradle b/redis-lettuce/build.gradle index 9479d841..1c9c1f66 100644 --- a/redis-lettuce/build.gradle +++ b/redis-lettuce/build.gradle @@ -1,5 +1,5 @@ plugins { - id "io.micronaut.build.internal.module" + id("io.micronaut.build.internal.redis-module") } dependencies { diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java index 71c14df9..d74d70f9 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java @@ -65,19 +65,6 @@ public RedisClient redisClient(AbstractRedisConfiguration config, .orElseGet(() -> RedisClient.create(clientResources, config)); } - /** - * Creates the {@link RedisClient} from the configuration. - * - * @param config The configuration - * @param optionalClientResources The ClientResources - * @deprecated use {@link #redisClient(AbstractRedisConfiguration, ClientResources, List)} instead - * @return The {@link RedisClient} - */ - @Deprecated - public RedisClient redisClient(AbstractRedisConfiguration config, @Nullable ClientResources optionalClientResources) { - return this.redisClient(config, optionalClientResources, Collections.emptyList()); - } - /** * Creates the {@link StatefulRedisConnection} from the {@link RedisClient}. * diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/RedisSetting.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/RedisSetting.java index f4f91362..9d0c3e65 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/RedisSetting.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/RedisSetting.java @@ -37,13 +37,7 @@ public interface RedisSetting { * The named redis servers. */ String REDIS_SERVERS = PREFIX + ".servers"; - /** - * Embedded Redis configuration. - * - * @deprecated since 5.3.0, use TestContainers RedisContainer instead. - */ - @Deprecated - String REDIS_EMBEDDED = PREFIX + ".embedded"; + /** * Default configuration for Redis caches. */ diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AsyncCacheCommands.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AsyncCacheCommands.java deleted file mode 100644 index dfc64995..00000000 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AsyncCacheCommands.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2017-2020 original authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micronaut.configuration.lettuce.cache; - -import io.lettuce.core.RedisFuture; -import io.lettuce.core.dynamic.Commands; -import io.lettuce.core.dynamic.annotation.Command; -import io.lettuce.core.dynamic.annotation.Param; - -import java.util.List; - -/** - * The asynchronous operations required by {@link RedisCache}. - * - * @author Graeme Rocher - * @since 1.0 - */ -@Deprecated -public interface AsyncCacheCommands extends Commands { - - /** - * See https://redis.io/commands/get. - * - * @param key The key to retrieve - * @return result of completion - */ - @Command("GET :key") - RedisFuture get(@Param("key") byte[] key); - - /** - * See https://redis.io/commands/del. - * - * @param key The key to delete - * @return result of completion - */ - @Command("DEL :key") - RedisFuture remove(@Param("key") byte[] key); - - /** - * See https://redis.io/commands/set. - * - * @param key The key - * @param value The value - * @return result of completion - */ - @Command("SET :key :value") - RedisFuture put(@Param("key") byte[] key, @Param("value") byte[] value); - - /** - * See https://redis.io/commands/set. - * - * @param key The key - * @param value The value - * @param timeout The timeout - * @return result of completion - */ - @Command("SET :key :value PX :timeout") - RedisFuture put(@Param("key") byte[] key, @Param("value") byte[] value, @Param("timeout") long timeout); - - /** - * See https://redis.io/commands/pexpire. - * - * @param key The key to expire - * @param timeout The timeout - * @return result of completion - */ - @Command("PEXPIRE :key :timeout") - RedisFuture expire(@Param("key") byte[] key, @Param("timeout") long timeout); - - /** - * Find all keys matching the given pattern. - * - * @param pattern the pattern type: patternkey (pattern) - * @return List<K> array-reply list of keys matching {@code pattern}. - */ - RedisFuture> keys(byte[] pattern); - - /** - * Delete one or more keys. - * - * @param keys the keys - * @return Long integer-reply The number of keys that were removed. - */ - RedisFuture del(byte[]... keys); -} diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/SyncCacheCommands.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/SyncCacheCommands.java deleted file mode 100644 index f4c94c2d..00000000 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/SyncCacheCommands.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2017-2020 original authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micronaut.configuration.lettuce.cache; - -import io.lettuce.core.dynamic.Commands; -import io.lettuce.core.dynamic.annotation.Command; -import io.lettuce.core.dynamic.annotation.Param; - -import java.util.List; - -/** - * The synchronous operations required by {@link RedisCache}. - * - * @author Graeme Rocher - * @since 1.0 - */ -@Deprecated -public interface SyncCacheCommands extends Commands { - - /** - * See https://redis.io/commands/get. - * - * @param key The key to retrieve - * @return key as byte array - */ - @Command("GET :key") - byte[] get(@Param("key") byte[] key); - - /** - * See https://redis.io/commands/del. - * - * @param key The key to delete - */ - @Command("DEL :key") - void remove(@Param("key") byte[] key); - - /** - * See https://redis.io/commands/set. - * - * @param key The key - * @param value The value - */ - @Command("SET :key :value") - void put(@Param("key") byte[] key, @Param("value") byte[] value); - - /** - * See https://redis.io/commands/set. - * - * @param key The key - * @param value The value - * @param timeout The timeout - */ - @Command("SET :key :value PX :timeout") - void put(@Param("key") byte[] key, @Param("value") byte[] value, @Param("timeout") long timeout); - - /** - * See https://redis.io/commands/pexpire. - * - * @param key The key to expire - * @param timeout The timeout - */ - @Command("PEXPIRE :key :timeout") - void expire(@Param("key") byte[] key, @Param("timeout") long timeout); - - /** - * Delete one or more keys. - * - * @param keys the keys - * @return Long integer-reply The number of keys that were removed. - */ - Long del(byte[]... keys); - - /** - * Find all keys matching the given pattern. - * - * @param pattern the pattern type: patternkey (pattern) - * @return List<K> array-reply list of keys matching {@code pattern}. - */ - List keys(byte[] pattern); -} diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionCommands.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionCommands.java deleted file mode 100644 index 00103f22..00000000 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionCommands.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2017-2020 original authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micronaut.configuration.lettuce.session; - -import io.lettuce.core.Range; -import io.lettuce.core.dynamic.Commands; -import io.lettuce.core.dynamic.annotation.Command; -import io.lettuce.core.dynamic.annotation.Param; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * Commands for storing and retrieving {@link io.micronaut.session.Session} instances. - * - * @author Graeme Rocher - * @since 1.0 - */ -@Deprecated -public interface RedisSessionCommands extends Commands { - - /** - * Set multiple hash fields to multiple values. - * - * @param sessionId The session ID - * @param attributes The attributes - * @return String simple-string-reply - */ - @Command("HMSET :sessionId :attributes") - CompletableFuture saveSessionData(@Param("sessionId") byte[] sessionId, @Param("value") Map attributes); - - /** - * Set a single attribute of a session. - * - * @param sessionId The session ID - * @param attribute The attribute - * @param value The value - * @return String simple-string-reply - */ - @Command("HSET :sessionId :attribute :value") - CompletableFuture setAttribute(@Param("sessionId") byte[] sessionId, @Param("attribute") byte[] attribute, @Param("value") byte[] value); - - /** - * Removes a single attribute of a session. - * - * @param sessionId The session ID - * @param attributes The attributes to delete - * @return String simple-string-reply - */ - @Command("HDEL :sessionId :attributes") - CompletableFuture deleteAttributes(@Param("sessionId") byte[] sessionId, @Param("attributes") byte[]... attributes); - - /** - * Get all the fields and values in a hash. - * - * @param sessionId The session ID - * @return Map<K,V> array-reply list of fields and their values stored in the hash, or an empty list when {@code key} - * does not exist. - */ - @Command("HGETALL") - CompletableFuture> findSessionData(byte[] sessionId); - - /** - * Save an expiry. - * - * @param expiryKey The expiry key - * @param seconds The seconds until expiration - * @return A future - */ - @Command("SET :expiryKey :seconds EX :seconds") - CompletableFuture saveExpiry(@Param("expiryKey") byte[] expiryKey, @Param("seconds") byte[] seconds); - - /** - * Delete a key. - * - * @param key The key to delete - * @return the future - */ - CompletableFuture del(byte[] key); - - /** - * Remove an item from the given sorted set. - * - * @param key The key of the set - * @param member The member to remove - * @return the future - */ - CompletableFuture zrem(byte[] key, byte[] member); - - /** - * Touch one or more keys. Touch sets the last accessed time for a key. Non-exsitent keys wont get created. - * - * @param key The key to get - * @return Long integer-reply the number of found keys. - */ - CompletableFuture get(@Param("key") byte[] key); - - /** - * Return a range of members in a sorted set, by score. - * - * @param key The key - * @param range The range - * @return List<V> array-reply list of elements in the specified score range. - * @since 4.3 - */ - CompletableFuture> zrangebyscore(byte[] key, Range range); - - /** - * Add one or more members to a sorted set, or update its score if it already exists. - * - * @param key The key - * @param score The score - * @param member The member - * @return Long integer-reply specifically: - *

- * The number of elements added to the sorted sets, not including elements already existing for which the score was - * updated. - */ - CompletableFuture zadd(byte[] key, double score, byte[] member); - - /** - * Set a key's time to live in seconds. - * - * @param key The key - * @param seconds The seconds type: long - * @return Boolean integer-reply specifically: - *

- * {@literal true} if the timeout was set. {@literal false} if {@code key} does not exist or the timeout could not - * be set. - */ - CompletableFuture expire(byte[] key, long seconds); - - /** - * Post a message to a channel. - * - * @param channel The channel type: key - * @param message The message type: value - * @return Long integer-reply the number of clients that received the message. - */ - CompletableFuture publish(byte[] channel, byte[] message); - - /** - * Set a configuration parameter to the given value. - * - * @param parameter The parameter name - * @param value The parameter value - * @return String simple-string-reply: {@code OK} when the configuration was set properly. Otherwise an error is returned. - */ - String configSet(String parameter, String value); -} diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/EmbeddedRedisServer.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/EmbeddedRedisServer.java deleted file mode 100644 index b19b251e..00000000 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/EmbeddedRedisServer.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2017-2020 original authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.micronaut.configuration.lettuce.test; - -import io.lettuce.core.RedisURI; -import io.micronaut.configuration.lettuce.AbstractRedisConfiguration; -import io.micronaut.configuration.lettuce.RedisSetting; -import io.micronaut.context.annotation.ConfigurationBuilder; -import io.micronaut.context.annotation.ConfigurationProperties; -import io.micronaut.context.annotation.Factory; -import io.micronaut.context.annotation.Requires; -import io.micronaut.context.event.BeanCreatedEvent; -import io.micronaut.context.event.BeanCreatedEventListener; -import io.micronaut.core.io.socket.SocketUtils; -import io.micronaut.core.util.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import redis.embedded.RedisServer; -import redis.embedded.RedisServerBuilder; -import redis.embedded.exceptions.RedisBuildingException; - -import javax.annotation.PreDestroy; -import java.io.Closeable; -import java.io.IOException; -import java.util.Optional; - -/** - * A bean for an embedded Redis server. - * - * @author Graeme Rocher - * @since 1.0 - * - * @deprecated since 5.3.0, use TestContainers RedisContainer instead. - */ -@Requires(classes = RedisServer.class) -@Requires(beans = AbstractRedisConfiguration.class) -@Factory -@Deprecated -public class EmbeddedRedisServer implements BeanCreatedEventListener, Closeable { - - private static final Logger LOGGER = LoggerFactory.getLogger(EmbeddedRedisServer.class); - - private static final String DEFAULT_MAXMEMORY_SETTING = "maxmemory 256M"; - private static final String DEFAULT_BIND_SETTING = "bind 127.0.0.1 ::1"; - - private final Configuration embeddedConfiguration; - private RedisServer redisServer; - - /** - * Constructor. - * - * @param embeddedConfiguration embeddedConfiguration - */ - public EmbeddedRedisServer(Configuration embeddedConfiguration) { - this.embeddedConfiguration = embeddedConfiguration; - } - - @Override - public AbstractRedisConfiguration onCreated(BeanCreatedEvent event) { - AbstractRedisConfiguration configuration = event.getBean(); - Optional uri = configuration.getUri(); - int port = configuration.getPort(); - String host = configuration.getHost(); - if (uri.isPresent()) { - RedisURI redisURI = uri.get(); - port = redisURI.getPort(); - host = redisURI.getHost(); - } - if (StringUtils.isNotEmpty(host) && host.equals("localhost") && SocketUtils.isTcpPortAvailable(port)) { - RedisServerBuilder builder = embeddedConfiguration.builder; - builder.port(port); - try { - builder.setting(DEFAULT_MAXMEMORY_SETTING); - builder.setting(DEFAULT_BIND_SETTING); - } catch (RedisBuildingException e) { - LOGGER.debug("Embedded settings failed as config file is present"); - } - redisServer = builder.build(); - redisServer.start(); - } - return configuration; - } - - @Override - @PreDestroy - public void close() throws IOException { - if (redisServer != null) { - redisServer.stop(); - } - } - - /** - * Configuration properties for embedded Redis. - * - * @deprecated since 5.3.0, use TestContainers RedisContainer instead. - */ - @ConfigurationProperties(RedisSetting.REDIS_EMBEDDED) - @Requires(classes = RedisServerBuilder.class) - @Deprecated - public static class Configuration { - @ConfigurationBuilder( - prefixes = "" - ) - RedisServerBuilder builder = new RedisServerBuilder().port(SocketUtils.findAvailableTcpPort()); - } -} diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/package-info.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/package-info.java deleted file mode 100644 index ce074095..00000000 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/test/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2017-2020 original authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Embedded Redis Server classes. - * - * @author graemerocher - * @since 1.0 - */ -package io.micronaut.configuration.lettuce.test; diff --git a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/SyncCacheSpec.groovy b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/SyncCacheSpec.groovy index c2eee513..972a126c 100644 --- a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/SyncCacheSpec.groovy +++ b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/SyncCacheSpec.groovy @@ -1,7 +1,7 @@ package io.micronaut.configuration.lettuce.cache import io.micronaut.context.ApplicationContext -import io.micronaut.core.io.socket.SocketUtils +import io.micronaut.redis.test.RedisContainerUtils import reactor.core.publisher.Flux import reactor.core.publisher.Mono import spock.lang.AutoCleanup @@ -15,7 +15,7 @@ import spock.lang.Specification class SyncCacheSpec extends Specification{ @Shared @AutoCleanup ApplicationContext applicationContext = ApplicationContext.run( - 'redis.uri':"redis://localhost:${SocketUtils.findAvailableTcpPort()}", + 'redis.uri':"redis://localhost:${RedisContainerUtils.getRedisPort()}", 'redis.caches.counter.enabled':'true', 'redis.caches.counter2.enabled':'true' ) @@ -59,7 +59,7 @@ class SyncCacheSpec extends Specification{ counterService.reset("test") then: counterService.futureValue("test").get() == 0 - + when: counterService.set("test", 3) From c0761ee8f205127e89664605d02cd3304aeff942 Mon Sep 17 00:00:00 2001 From: Dean Wette Date: Mon, 28 Nov 2022 00:19:19 -0600 Subject: [PATCH 02/12] ci: build to 6.0.1, test to 4.0.0-SNAPSHOT, groovy to 4.0.6, spock to 2.3-groovy-4.0, github workflows to Java 17 (#323) --- .github/workflows/central-sync.yml | 2 +- .github/workflows/graalvm.yml | 2 +- .github/workflows/gradle.yml | 6 ++-- .github/workflows/publish-snapshot.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/sonarqube.yml | 2 +- build.gradle | 1 - gradle.properties | 6 ++-- .../lettuce/cache/RedisCache.java | 2 +- .../cache/RedisConnectionPoolCache.java | 2 +- .../lettuce/session/RedisSessionStore.java | 34 ++++++++++++++----- settings.gradle | 2 +- 12 files changed, 40 insertions(+), 23 deletions(-) diff --git a/.github/workflows/central-sync.yml b/.github/workflows/central-sync.yml index 3d550abb..add5cc43 100644 --- a/.github/workflows/central-sync.yml +++ b/.github/workflows/central-sync.yml @@ -23,7 +23,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Publish to Sonatype OSSRH env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/.github/workflows/graalvm.yml b/.github/workflows/graalvm.yml index 2fa66fa3..b7278470 100644 --- a/.github/workflows/graalvm.yml +++ b/.github/workflows/graalvm.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: ['11', '17'] + java: ['17'] graalvm: ['latest', 'dev'] steps: # https://github.com/actions/virtual-environments/issues/709 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e1e63f97..1e37c151 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: ['8', '11', '17'] + java: ['17'] steps: # https://github.com/actions/virtual-environments/issues/709 - name: Free disk space @@ -72,7 +72,7 @@ jobs: name: binary-compatibility-reports path: "**/build/reports/binary-compatibility-*.html" - name: Publish to Sonatype Snapshots - if: success() && github.event_name == 'push' && matrix.java == '11' + if: success() && github.event_name == 'push' && matrix.java == '17' env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} @@ -88,7 +88,7 @@ jobs: if_true: "micronaut-projects/micronaut-docs" if_false: ${{ github.repository }} - name: Publish to Github Pages - if: success() && github.event_name == 'push' && matrix.java == '11' + if: success() && github.event_name == 'push' && matrix.java == '17' uses: micronaut-projects/github-pages-deploy-action@master env: TARGET_REPOSITORY: ${{ steps.docs_target.outputs.value }} diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 8b70c7e4..5c8bd293 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -21,7 +21,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Publish to Sonatype Snapshots if: success() env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13dcbbca..8d933603 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Set the current release version id: release_version run: echo ::set-output name=release_version::${GITHUB_REF:11} diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 93ae8a94..4ed20609 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -38,7 +38,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: 11 + java-version: 17 - name: Optional setup step env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} diff --git a/build.gradle b/build.gradle index f7a13198..5ea08f11 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ plugins { id "io.micronaut.build.internal.docs" - id "io.micronaut.build.internal.dependency-updates" id "io.micronaut.build.internal.quality-reporting" } diff --git a/gradle.properties b/gradle.properties index 142d2447..f682fc52 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ projectGroup=io.micronaut.redis micronautDocsVersion=2.0.0 micronautVersion=4.0.0-SNAPSHOT -micronautTestVersion=3.4.0 +micronautTestVersion=4.0.0-SNAPSHOT -groovyVersion=3.0.12 -spockVersion=2.1-groovy-3.0 +groovyVersion=4.0.6 +spockVersion=2.3-groovy-4.0 title=Micronaut Redis projectDesc=Integration between Micronaut and Redis diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java index 10938d94..11023a6d 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java @@ -31,8 +31,8 @@ import io.micronaut.core.convert.ConversionService; import io.micronaut.core.type.Argument; import io.micronaut.core.util.StringUtils; +import jakarta.annotation.PreDestroy; -import javax.annotation.PreDestroy; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java index 35ccd044..32031ed2 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java @@ -31,10 +31,10 @@ import io.micronaut.core.convert.ConversionService; import io.micronaut.core.type.Argument; import io.micronaut.core.util.StringUtils; +import jakarta.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PreDestroy; import java.util.Collections; import java.util.List; import java.util.Optional; diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java index ffae505b..909b7406 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java @@ -19,8 +19,14 @@ import io.lettuce.core.RedisFuture; import io.lettuce.core.api.StatefulConnection; import io.lettuce.core.api.StatefulRedisConnection; -import io.lettuce.core.api.async.*; -import io.lettuce.core.api.sync.*; +import io.lettuce.core.api.async.BaseRedisAsyncCommands; +import io.lettuce.core.api.async.RedisAsyncCommands; +import io.lettuce.core.api.async.RedisHashAsyncCommands; +import io.lettuce.core.api.async.RedisKeyAsyncCommands; +import io.lettuce.core.api.async.RedisSortedSetAsyncCommands; +import io.lettuce.core.api.async.RedisStringAsyncCommands; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.api.sync.RedisServerCommands; import io.lettuce.core.cluster.api.StatefulRedisClusterConnection; import io.lettuce.core.cluster.api.async.RedisAdvancedClusterAsyncCommands; import io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands; @@ -44,21 +50,31 @@ import io.micronaut.core.util.StringUtils; import io.micronaut.inject.qualifiers.Qualifiers; import io.micronaut.scheduling.TaskExecutors; -import io.micronaut.session.*; +import io.micronaut.session.InMemorySession; +import io.micronaut.session.InMemorySessionStore; +import io.micronaut.session.Session; +import io.micronaut.session.SessionIdGenerator; +import io.micronaut.session.SessionSettings; +import io.micronaut.session.SessionStore; import io.micronaut.session.event.SessionCreatedEvent; import io.micronaut.session.event.SessionDeletedEvent; import io.micronaut.session.event.SessionExpiredEvent; +import jakarta.annotation.PreDestroy; +import jakarta.inject.Named; +import jakarta.inject.Singleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.PreDestroy; -import jakarta.inject.Named; -import jakarta.inject.Singleton; import java.nio.charset.Charset; import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; -import java.util.*; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; @@ -66,7 +82,9 @@ import java.util.function.Function; import java.util.stream.Collectors; -import static io.micronaut.configuration.lettuce.session.RedisSessionStore.RedisSession.*; +import static io.micronaut.configuration.lettuce.session.RedisSessionStore.RedisSession.ATTR_CREATION_TIME; +import static io.micronaut.configuration.lettuce.session.RedisSessionStore.RedisSession.ATTR_LAST_ACCESSED; +import static io.micronaut.configuration.lettuce.session.RedisSessionStore.RedisSession.ATTR_MAX_INACTIVE_INTERVAL; /** *

An implementation of the {@link SessionStore} interface for Redis. Partially inspired by Spring Session.

diff --git a/settings.gradle b/settings.gradle index 64267712..f9a3bffb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id("io.micronaut.build.shared.settings") version "5.3.14" + id("io.micronaut.build.shared.settings") version "6.0.1" } rootProject.name = 'redis-parent' From adadb975bbc535c352321f43f91f6ed9d7fe5c89 Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Mon, 28 Nov 2022 07:21:52 +0100 Subject: [PATCH 03/12] Update settings.gradle --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index f9a3bffb..d8060895 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id("io.micronaut.build.shared.settings") version "6.0.1" + id("io.micronaut.build.shared.settings") version "6.1.0" } rootProject.name = 'redis-parent' From 0a415af06b291bd622374b3c45eaf76d1258c3f2 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Thu, 1 Dec 2022 13:43:45 +0000 Subject: [PATCH 04/12] Fix build --- gradle/libs.versions.toml | 19 ++++++++----------- redis-lettuce/build.gradle | 28 +++++++++++++--------------- settings.gradle | 7 +++++++ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 88ea1919..dd7a21a4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,25 +1,22 @@ [versions] managed-lettuce = "6.2.1.RELEASE" +micronaut-cache = "4.0.0-SNAPSHOT" +micronaut-micrometer = "5.0.0-SNAPSHOT" + redis-embedded = "0.6" +testcontainers = "1.17.5" + [libraries] managed-lettuce = { module = "io.lettuce:lettuce-core", version.ref = "managed-lettuce" } -micronaut-cache = { module = 'io.micronaut.cache:micronaut-cache-core'} -micronaut-function-web = { module = 'io.micronaut:micronaut-function-web' } -micronaut-graal = { module = 'io.micronaut:micronaut-graal' } -micronaut-http-client = { module = 'io.micronaut:micronaut-http-client' } -micronaut-http-server-netty = { module = 'io.micronaut:micronaut-http-server-netty' } -micronaut-inject-groovy = { module = 'io.micronaut:micronaut-inject-groovy' } -micronaut-inject-java = { module = 'io.micronaut:micronaut-inject-java' } -micronaut-management = { module = 'io.micronaut:micronaut-management' } -micronaut-micrometer = { module = 'io.micronaut.micrometer:micronaut-micrometer-core'} -micronaut-session = { module = 'io.micronaut:micronaut-session' } +micronaut-cache = { module = "io.micronaut.cache:micronaut-cache-bom", version.ref = "micronaut-cache" } +micronaut-micrometer = { module = "io.micronaut.micrometer:micronaut-micrometer-bom", version.ref = "micronaut-micrometer" } projectreactor = { module = 'io.projectreactor:reactor-core' } redis-embedded = { module = "com.github.kstyrc:embedded-redis", version.ref = "redis-embedded" } -testcontainers-bom = { module = "org.testcontainers:testcontainers-bom" } +testcontainers-bom = { module = "org.testcontainers:testcontainers-bom", version.ref = "testcontainers" } testcontainers-spock = { module = "org.testcontainers:spock" } diff --git a/redis-lettuce/build.gradle b/redis-lettuce/build.gradle index 1c9c1f66..76497824 100644 --- a/redis-lettuce/build.gradle +++ b/redis-lettuce/build.gradle @@ -3,32 +3,30 @@ plugins { } dependencies { - annotationProcessor libs.micronaut.graal + annotationProcessor mn.micronaut.graal api libs.managed.lettuce - api libs.micronaut.cache + api mnCache.micronaut.cache.core - compileOnly libs.micronaut.session - compileOnly libs.micronaut.management - compileOnly libs.micronaut.micrometer + compileOnly mn.micronaut.session + compileOnly mn.micronaut.management + compileOnly mnMicrometer.micronaut.micrometer.core compileOnly libs.redis.embedded - testAnnotationProcessor libs.micronaut.inject.java + testAnnotationProcessor mn.micronaut.inject.java testImplementation platform(libs.testcontainers.bom) testImplementation libs.testcontainers.spock testImplementation libs.projectreactor - testImplementation libs.micronaut.cache - testImplementation libs.micronaut.inject.java - testImplementation libs.micronaut.management - testImplementation libs.micronaut.micrometer - testImplementation libs.micronaut.inject.groovy - testImplementation libs.micronaut.function.web + testImplementation mn.micronaut.inject.java + testImplementation mn.micronaut.management + compileOnly mnMicrometer.micronaut.micrometer.core + testImplementation mn.micronaut.function.web - testImplementation libs.micronaut.session - testRuntimeOnly libs.micronaut.http.server.netty - testImplementation libs.micronaut.http.client + testImplementation mn.micronaut.session + testRuntimeOnly mn.micronaut.http.server.netty + testImplementation mn.micronaut.http.client testImplementation libs.redis.embedded } diff --git a/settings.gradle b/settings.gradle index d8060895..d40236eb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,6 +9,13 @@ plugins { id("io.micronaut.build.shared.settings") version "6.1.0" } +micronautBuild { + addSnapshotRepository() + importMicronautCatalog() + importMicronautCatalog("micronaut-cache") + importMicronautCatalog("micronaut-micrometer") +} + rootProject.name = 'redis-parent' include 'redis-bom' From 06440487eb47cdb90d3a6e37d4f81390c2dd6301 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Thu, 1 Dec 2022 14:08:57 +0000 Subject: [PATCH 05/12] Fix compilation errors and binary compat changes --- config/accepted-api-changes.json | 85 +++++++++++++++++++ gradle/libs.versions.toml | 2 + redis-lettuce/build.gradle | 6 +- .../lettuce/AbstractRedisClientFactory.java | 3 +- .../lettuce/cache/AbstractRedisCache.java | 4 +- .../lettuce/cache/RedisCache.java | 2 +- .../cache/RedisConnectionPoolCache.java | 2 +- .../lettuce/cache/RedisCacheSpec.groovy | 9 +- .../lettuce/cache/RedisPoolCacheSpec.groovy | 8 +- .../lettuce/session/RedisSessionSpec.groovy | 7 +- redis-lettuce/src/test/resources/logback.xml | 3 +- settings.gradle | 1 + 12 files changed, 110 insertions(+), 22 deletions(-) diff --git a/config/accepted-api-changes.json b/config/accepted-api-changes.json index 1e22ee43..39b5eadf 100644 --- a/config/accepted-api-changes.json +++ b/config/accepted-api-changes.json @@ -33,5 +33,90 @@ "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer$Configuration", "member": "Constructor io.micronaut.configuration.lettuce.test.EmbeddedRedisServer$Configuration()", "reason": "Removed deprecated class for Micronaut 4.0.x" + }, + { + "type": "io.micronaut.configuration.lettuce.cache.AsyncCacheCommands", + "member": "Implemented interface io.lettuce.core.dynamic.Commands", + "reason": "Lettuce change in major update" + }, + { + "type": "io.micronaut.configuration.lettuce.cache.SyncCacheCommands", + "member": "Implemented interface io.lettuce.core.dynamic.Commands", + "reason": "Lettuce change in major update" + }, + { + "type": "io.micronaut.configuration.lettuce.session.RedisSessionCommands", + "member": "Implemented interface io.lettuce.core.dynamic.Commands", + "reason": "Lettuce change in major update" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationSource", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.BeanContextConditional", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataProvider", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.BeanType", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.BeanDefinitionReference", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationSource", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.BeanContextConditional", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataProvider", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.BeanType", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.BeanDefinitionReference", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer", + "member": "Implemented interface java.util.EventListener", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer", + "member": "Implemented interface java.io.Closeable", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer", + "member": "Implemented interface io.micronaut.context.event.BeanCreatedEventListener", + "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer", + "member": "Implemented interface java.lang.AutoCloseable", + "reason": "Deprecated embedded server was removed" } ] diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd7a21a4..1cdec2f1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,7 @@ managed-lettuce = "6.2.1.RELEASE" micronaut-cache = "4.0.0-SNAPSHOT" micronaut-micrometer = "5.0.0-SNAPSHOT" +micronaut-serde = "2.0.0-SNAPSHOT" redis-embedded = "0.6" @@ -13,6 +14,7 @@ managed-lettuce = { module = "io.lettuce:lettuce-core", version.ref = "managed-l micronaut-cache = { module = "io.micronaut.cache:micronaut-cache-bom", version.ref = "micronaut-cache" } micronaut-micrometer = { module = "io.micronaut.micrometer:micronaut-micrometer-bom", version.ref = "micronaut-micrometer" } +micronaut-serde = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serde" } projectreactor = { module = 'io.projectreactor:reactor-core' } diff --git a/redis-lettuce/build.gradle b/redis-lettuce/build.gradle index 76497824..53b336bd 100644 --- a/redis-lettuce/build.gradle +++ b/redis-lettuce/build.gradle @@ -22,11 +22,15 @@ dependencies { testImplementation mn.micronaut.inject.java testImplementation mn.micronaut.management - compileOnly mnMicrometer.micronaut.micrometer.core + testImplementation mnMicrometer.micronaut.micrometer.core + testImplementation mnSerde.micronaut.serde.jackson + testImplementation mn.micronaut.jackson.databind testImplementation mn.micronaut.function.web testImplementation mn.micronaut.session testRuntimeOnly mn.micronaut.http.server.netty testImplementation mn.micronaut.http.client testImplementation libs.redis.embedded + testRuntimeOnly(mn.logback.classic) + testImplementation mn.snakeyaml } diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java index d74d70f9..50c31090 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/AbstractRedisClientFactory.java @@ -22,12 +22,11 @@ import io.lettuce.core.resource.ClientResources; import io.micronaut.core.annotation.Nullable; -import java.util.Collections; import java.util.List; import java.util.Optional; /** - * Abstract version of the a factory class for creating Redis clients. + * Abstract version of a factory class for creating Redis clients. * * @author Graeme Rocher * @since 1.0 diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AbstractRedisCache.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AbstractRedisCache.java index 8e14cea5..a743c4ce 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AbstractRedisCache.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/AbstractRedisCache.java @@ -57,7 +57,7 @@ public abstract class AbstractRedisCache implements SyncCache, AutoCloseab protected AbstractRedisCache( DefaultRedisCacheConfiguration defaultRedisCacheConfiguration, RedisCacheConfiguration redisCacheConfiguration, - ConversionService conversionService, + ConversionService conversionService, BeanLocator beanLocator ) { if (redisCacheConfiguration == null) { @@ -293,7 +293,7 @@ private ExpirationAfterWritePolicy findExpirationAfterWritePolicyBean(BeanLocato } } - private DefaultStringKeySerializer newDefaultKeySerializer(RedisCacheConfiguration redisCacheConfiguration, ConversionService conversionService) { + private DefaultStringKeySerializer newDefaultKeySerializer(RedisCacheConfiguration redisCacheConfiguration, ConversionService conversionService) { return new DefaultStringKeySerializer(redisCacheConfiguration.getCacheName(), redisCacheConfiguration.getCharset(), conversionService); } } diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java index 11023a6d..6571cf62 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisCache.java @@ -68,7 +68,7 @@ public class RedisCache extends AbstractRedisCache conversionService, + ConversionService conversionService, BeanLocator beanLocator ) { super(defaultRedisCacheConfiguration, redisCacheConfiguration, conversionService, beanLocator); diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java index 32031ed2..14358cc3 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/cache/RedisConnectionPoolCache.java @@ -69,7 +69,7 @@ public class RedisConnectionPoolCache extends AbstractRedisCache conversionService, + ConversionService conversionService, BeanLocator beanLocator, AsyncPool> asyncPool ) { diff --git a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisCacheSpec.groovy b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisCacheSpec.groovy index e133179a..58880998 100644 --- a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisCacheSpec.groovy +++ b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisCacheSpec.groovy @@ -8,13 +8,12 @@ import io.micronaut.configuration.lettuce.RedisSpec import io.micronaut.context.ApplicationContext import io.micronaut.context.BeanLocator import io.micronaut.context.exceptions.ConfigurationException -import io.micronaut.core.convert.DefaultConversionService +import io.micronaut.core.convert.ConversionService import io.micronaut.core.type.Argument import io.micronaut.inject.qualifiers.Qualifiers import io.micronaut.redis.test.RedisContainerUtils import io.micronaut.runtime.ApplicationConfiguration import spock.lang.Requires -import spock.lang.Specification import java.lang.reflect.Field import java.lang.reflect.Modifier @@ -119,7 +118,7 @@ class RedisCacheSpec extends RedisSpec { new RedisCache( new DefaultRedisCacheConfiguration(appConfig), cacheConfig, - new DefaultConversionService(), + ConversionService.SHARED, applicationContext.getBean(BeanLocator.class) ) @@ -143,7 +142,7 @@ class RedisCacheSpec extends RedisSpec { new RedisCache( new DefaultRedisCacheConfiguration(appConfig), cacheConfig, - new DefaultConversionService(), + ConversionService.SHARED, applicationContext.getBean(BeanLocator.class) ) @@ -167,7 +166,7 @@ class RedisCacheSpec extends RedisSpec { new RedisCache( new DefaultRedisCacheConfiguration(appConfig), cacheConfig, - new DefaultConversionService(), + ConversionService.SHARED, applicationContext.getBean(BeanLocator.class) ) diff --git a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisPoolCacheSpec.groovy b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisPoolCacheSpec.groovy index 005e7928..5d7d9e7a 100644 --- a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisPoolCacheSpec.groovy +++ b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/cache/RedisPoolCacheSpec.groovy @@ -8,7 +8,7 @@ import io.micronaut.context.ApplicationContext import io.micronaut.context.BeanLocator import io.micronaut.context.exceptions.ConfigurationException import io.micronaut.context.exceptions.NoSuchBeanException -import io.micronaut.core.convert.DefaultConversionService +import io.micronaut.core.convert.ConversionService import io.micronaut.core.type.Argument import io.micronaut.inject.qualifiers.Qualifiers import io.micronaut.redis.test.RedisContainerUtils @@ -207,7 +207,7 @@ class RedisPoolCacheSpec extends RedisSpec { new RedisConnectionPoolCache( new DefaultRedisCacheConfiguration(appConfig), cacheConfig, - new DefaultConversionService(), + ConversionService.SHARED, applicationContext.getBean(BeanLocator.class), applicationContext.getBean(AsyncPool.class) ) @@ -232,7 +232,7 @@ class RedisPoolCacheSpec extends RedisSpec { new RedisConnectionPoolCache( new DefaultRedisCacheConfiguration(appConfig), cacheConfig, - new DefaultConversionService(), + ConversionService.SHARED, applicationContext.getBean(BeanLocator.class), applicationContext.getBean(AsyncPool.class) ) @@ -257,7 +257,7 @@ class RedisPoolCacheSpec extends RedisSpec { new RedisConnectionPoolCache( new DefaultRedisCacheConfiguration(appConfig), cacheConfig, - new DefaultConversionService(), + ConversionService.SHARED, applicationContext.getBean(BeanLocator.class), applicationContext.getBean(AsyncPool.class) ) diff --git a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/session/RedisSessionSpec.groovy b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/session/RedisSessionSpec.groovy index 77d5803f..7f265042 100644 --- a/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/session/RedisSessionSpec.groovy +++ b/redis-lettuce/src/test/groovy/io/micronaut/configuration/lettuce/session/RedisSessionSpec.groovy @@ -5,12 +5,12 @@ import io.micronaut.context.ApplicationContext import io.micronaut.context.event.ApplicationEventListener import io.micronaut.jackson.serialize.JacksonObjectSerializer import io.micronaut.redis.test.RedisContainerUtils +import io.micronaut.serde.annotation.Serdeable import io.micronaut.session.Session import io.micronaut.session.event.AbstractSessionEvent import io.micronaut.session.event.SessionCreatedEvent import io.micronaut.session.event.SessionDeletedEvent import io.micronaut.session.event.SessionExpiredEvent -import spock.lang.Specification import spock.util.concurrent.PollingConditions import jakarta.inject.Singleton @@ -170,8 +170,6 @@ class RedisSessionSpec extends RedisSpec { session.put("username","bob") session.remove("foo") - - then:"The session was updated in the background" conditions.eventually { Session retrieved = sessionStore.findSession(session.id).get().get() @@ -249,7 +247,8 @@ class RedisSessionSpec extends RedisSpec { applicationContext.stop() } - static class Foo implements Serializable{ + @Serdeable + static class Foo implements Serializable { String name Integer age } diff --git a/redis-lettuce/src/test/resources/logback.xml b/redis-lettuce/src/test/resources/logback.xml index 1e4f6be1..ce54c2d0 100644 --- a/redis-lettuce/src/test/resources/logback.xml +++ b/redis-lettuce/src/test/resources/logback.xml @@ -1,7 +1,6 @@ - true @@ -14,4 +13,4 @@ - \ No newline at end of file + diff --git a/settings.gradle b/settings.gradle index d40236eb..214e9086 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,6 +14,7 @@ micronautBuild { importMicronautCatalog() importMicronautCatalog("micronaut-cache") importMicronautCatalog("micronaut-micrometer") + importMicronautCatalog("micronaut-serde") } rootProject.name = 'redis-parent' From 78385bdaf6a961b3c62411d241f725acf012fb9e Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Mon, 12 Dec 2022 14:05:50 +0000 Subject: [PATCH 06/12] Fix build --- gradle/libs.versions.toml | 2 ++ redis-lettuce/build.gradle | 4 ++-- settings.gradle | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1cdec2f1..d88b66b5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,6 +4,7 @@ managed-lettuce = "6.2.1.RELEASE" micronaut-cache = "4.0.0-SNAPSHOT" micronaut-micrometer = "5.0.0-SNAPSHOT" micronaut-serde = "2.0.0-SNAPSHOT" +micronaut-session = "1.0.0-SNAPSHOT" redis-embedded = "0.6" @@ -15,6 +16,7 @@ managed-lettuce = { module = "io.lettuce:lettuce-core", version.ref = "managed-l micronaut-cache = { module = "io.micronaut.cache:micronaut-cache-bom", version.ref = "micronaut-cache" } micronaut-micrometer = { module = "io.micronaut.micrometer:micronaut-micrometer-bom", version.ref = "micronaut-micrometer" } micronaut-serde = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serde" } +micronaut-session = { module = "io.micronaut.session:micronaut-session-bom", version.ref = "micronaut-session" } projectreactor = { module = 'io.projectreactor:reactor-core' } diff --git a/redis-lettuce/build.gradle b/redis-lettuce/build.gradle index 53b336bd..e7d42f1b 100644 --- a/redis-lettuce/build.gradle +++ b/redis-lettuce/build.gradle @@ -8,7 +8,7 @@ dependencies { api libs.managed.lettuce api mnCache.micronaut.cache.core - compileOnly mn.micronaut.session + compileOnly mnSession.micronaut.session compileOnly mn.micronaut.management compileOnly mnMicrometer.micronaut.micrometer.core compileOnly libs.redis.embedded @@ -27,7 +27,7 @@ dependencies { testImplementation mn.micronaut.jackson.databind testImplementation mn.micronaut.function.web - testImplementation mn.micronaut.session + testImplementation mnSession.micronaut.session testRuntimeOnly mn.micronaut.http.server.netty testImplementation mn.micronaut.http.client testImplementation libs.redis.embedded diff --git a/settings.gradle b/settings.gradle index 214e9086..1c268e4b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ pluginManagement { } plugins { - id("io.micronaut.build.shared.settings") version "6.1.0" + id("io.micronaut.build.shared.settings") version "6.1.1" } micronautBuild { @@ -15,6 +15,7 @@ micronautBuild { importMicronautCatalog("micronaut-cache") importMicronautCatalog("micronaut-micrometer") importMicronautCatalog("micronaut-serde") + importMicronautCatalog("micronaut-session") } rootProject.name = 'redis-parent' From 4df63f8a46e90a14d046b15d65b0dcfb0894e5c0 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Mon, 12 Dec 2022 14:11:00 +0000 Subject: [PATCH 07/12] Checkstyle config --- config/checkstyle/checkstyle.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index e8f5b18f..c1b8e128 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -96,11 +96,13 @@ - + - + + + From 25894dc941819e1cb183d62e6b626c8b4a7d1a2b Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Mon, 12 Dec 2022 16:42:55 +0000 Subject: [PATCH 08/12] Fix conversion of byte[] back from json Previously conversion from a byte[] would return Optional.empty This would trigger the deserialization from the value in the attribute map Now conversion would return a String (which would be the JSON representation of the object) So we end up with strings in the session wrapped in double quotes. This change gets the value as an Object type, and if this is a byte array, deserializes it from JSON --- .../lettuce/session/RedisSessionStore.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java index 909b7406..fd1bd25f 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java @@ -44,6 +44,8 @@ import io.micronaut.context.exceptions.ConfigurationException; import io.micronaut.core.annotation.TypeHint; import io.micronaut.core.convert.ArgumentConversionContext; +import io.micronaut.core.convert.ConversionContext; +import io.micronaut.core.convert.ConversionService; import io.micronaut.core.convert.value.MutableConvertibleValues; import io.micronaut.core.serialize.ObjectSerializer; import io.micronaut.core.util.CollectionUtils; @@ -121,6 +123,7 @@ public class RedisSessionStore extends RedisPubSubAdapter implem private static final Logger LOG = LoggerFactory.getLogger(RedisSessionStore.class); private final RedisHttpSessionConfiguration sessionConfiguration; private final SessionIdGenerator sessionIdGenerator; + private final ConversionService conversionService; private final ApplicationEventPublisher eventPublisher; private final ObjectSerializer valueSerializer; private final Charset charset; @@ -150,10 +153,12 @@ public RedisSessionStore( RedisHttpSessionConfiguration sessionConfiguration, BeanLocator beanLocator, ObjectSerializer defaultSerializer, + ConversionService conversionService, @Named(TaskExecutors.SCHEDULED) ExecutorService scheduledExecutorService, ApplicationEventPublisher eventPublisher) { this.writeMode = sessionConfiguration.getWriteMode(); this.sessionIdGenerator = sessionIdGenerator; + this.conversionService = conversionService; this.valueSerializer = sessionConfiguration .getValueSerializer() .flatMap(beanLocator::findOrInstantiateBean) @@ -546,16 +551,12 @@ public boolean isModified() { @Override public Optional get(CharSequence name, ArgumentConversionContext conversionContext) { - Optional result = super.get(name, conversionContext); - if (!result.isPresent() && attributeMap.containsKey(name)) { - Object val = attributeMap.get(name); - if (val instanceof byte[]) { - Optional deserialized = valueSerializer.deserialize((byte[]) val, conversionContext.getArgument()); - deserialized.ifPresent(t -> attributeMap.put(name, t)); - return deserialized; + return super.get(name, ConversionContext.of(Object.class)).flatMap(o -> { + if (o instanceof byte[] rawBytes) { + return valueSerializer.deserialize(rawBytes, conversionContext.getArgument()); } - } - return result; + return conversionService.convert(o, conversionContext); + }); } @Override From c2a51439cdca715d82f48d36a8a36c7c79de7c7c Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Thu, 15 Dec 2022 12:53:52 +0000 Subject: [PATCH 09/12] Fix JAPICMP as we require a conversion service in the constructor now --- .../lettuce/session/RedisSessionStore.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java index fd1bd25f..17676daa 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java @@ -147,6 +147,32 @@ public class RedisSessionStore extends RedisPubSubAdapter implem * @param defaultSerializer The default value serializer * @param scheduledExecutorService scheduledExecutorService * @param eventPublisher eventPublisher + * + * @deprecated Use {@link #RedisSessionStore(SessionIdGenerator, RedisHttpSessionConfiguration, BeanLocator, ObjectSerializer, ConversionService, ExecutorService, ApplicationEventPublisher)} instead + */ + @Deprecated + public RedisSessionStore( + SessionIdGenerator sessionIdGenerator, + RedisHttpSessionConfiguration sessionConfiguration, + BeanLocator beanLocator, + ObjectSerializer defaultSerializer, + @Named(TaskExecutors.SCHEDULED) ExecutorService scheduledExecutorService, + ApplicationEventPublisher eventPublisher + ) { + this(sessionIdGenerator, sessionConfiguration, beanLocator, defaultSerializer, ConversionService.SHARED, scheduledExecutorService, eventPublisher); + } + + /** + * Constructor. + * @param sessionIdGenerator sessionIdGenerator + * @param sessionConfiguration sessionConfiguration + * @param beanLocator beanLocator + * @param defaultSerializer The default value serializer + * @param conversionService The conversion service + * @param scheduledExecutorService scheduledExecutorService + * @param eventPublisher eventPublisher + * + * @since 6.0.0 */ public RedisSessionStore( SessionIdGenerator sessionIdGenerator, From 9d6ecf30f1f0ea5278ffeb629dde49eac6161fd8 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Thu, 15 Dec 2022 12:54:16 +0000 Subject: [PATCH 10/12] Add Micronaut 4 bean definition changes --- config/accepted-api-changes.json | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/config/accepted-api-changes.json b/config/accepted-api-changes.json index 39b5eadf..9d310b94 100644 --- a/config/accepted-api-changes.json +++ b/config/accepted-api-changes.json @@ -118,5 +118,55 @@ "type": "io.micronaut.configuration.lettuce.test.EmbeddedRedisServer", "member": "Implemented interface java.lang.AutoCloseable", "reason": "Deprecated embedded server was removed" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.core.beans.BeanInfo", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataDelegate", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadata", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.QualifiedBeanType", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", + "member": "Implemented interface io.micronaut.core.type.ArgumentCoercible", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.core.beans.BeanInfo", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataDelegate", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadata", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.inject.QualifiedBeanType", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", + "member": "Implemented interface io.micronaut.core.type.ArgumentCoercible", + "reason": "BeanDeifinition changes in Micronaut 4.0.0" } ] From 49a9cfb3514130f6b57681629a3cc8c03fb18946 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Thu, 15 Dec 2022 15:54:44 +0000 Subject: [PATCH 11/12] Remove old constructor for the next major --- config/accepted-api-changes.json | 25 +++++++++++-------- .../lettuce/session/RedisSessionStore.java | 23 ----------------- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/config/accepted-api-changes.json b/config/accepted-api-changes.json index 9d310b94..fb8c6bed 100644 --- a/config/accepted-api-changes.json +++ b/config/accepted-api-changes.json @@ -122,51 +122,56 @@ { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", "member": "Implemented interface io.micronaut.core.beans.BeanInfo", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataDelegate", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadata", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", "member": "Implemented interface io.micronaut.inject.QualifiedBeanType", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Configuration$Definition$Reference", "member": "Implemented interface io.micronaut.core.type.ArgumentCoercible", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", "member": "Implemented interface io.micronaut.core.beans.BeanInfo", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataDelegate", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", "member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadata", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", "member": "Implemented interface io.micronaut.inject.QualifiedBeanType", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" }, { "type": "io.micronaut.configuration.lettuce.test.$EmbeddedRedisServer$Definition$Reference", "member": "Implemented interface io.micronaut.core.type.ArgumentCoercible", - "reason": "BeanDeifinition changes in Micronaut 4.0.0" + "reason": "BeanDefinition changes in Micronaut 4.0.0" + }, + { + "type": "io.micronaut.configuration.lettuce.session.RedisSessionStore", + "member": "Constructor io.micronaut.configuration.lettuce.session.RedisSessionStore(io.micronaut.session.SessionIdGenerator,io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration,io.micronaut.context.BeanLocator,io.micronaut.core.serialize.ObjectSerializer,java.util.concurrent.ExecutorService,io.micronaut.context.event.ApplicationEventPublisher)", + "reason": "We require the Conversion Service for Micronaut 4.0.0" } ] diff --git a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java index 17676daa..eec419fb 100644 --- a/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java +++ b/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisSessionStore.java @@ -139,29 +139,6 @@ public class RedisSessionStore extends RedisPubSubAdapter implem private final RedisHashAsyncCommands redisHashAsyncCommands; private final RedisKeyAsyncCommands redisKeyAsyncCommands; - /** - * Constructor. - * @param sessionIdGenerator sessionIdGenerator - * @param sessionConfiguration sessionConfiguration - * @param beanLocator beanLocator - * @param defaultSerializer The default value serializer - * @param scheduledExecutorService scheduledExecutorService - * @param eventPublisher eventPublisher - * - * @deprecated Use {@link #RedisSessionStore(SessionIdGenerator, RedisHttpSessionConfiguration, BeanLocator, ObjectSerializer, ConversionService, ExecutorService, ApplicationEventPublisher)} instead - */ - @Deprecated - public RedisSessionStore( - SessionIdGenerator sessionIdGenerator, - RedisHttpSessionConfiguration sessionConfiguration, - BeanLocator beanLocator, - ObjectSerializer defaultSerializer, - @Named(TaskExecutors.SCHEDULED) ExecutorService scheduledExecutorService, - ApplicationEventPublisher eventPublisher - ) { - this(sessionIdGenerator, sessionConfiguration, beanLocator, defaultSerializer, ConversionService.SHARED, scheduledExecutorService, eventPublisher); - } - /** * Constructor. * @param sessionIdGenerator sessionIdGenerator From 851d43a1ea2ea059acbba3774af831de981cbe62 Mon Sep 17 00:00:00 2001 From: Tim Yates Date: Thu, 15 Dec 2022 16:38:45 +0000 Subject: [PATCH 12/12] Address feedback --- gradle.properties | 7 ------- gradle/libs.versions.toml | 8 ++++++-- redis-lettuce/build.gradle | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/gradle.properties b/gradle.properties index f682fc52..f13c24ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,6 @@ projectVersion=6.0.0-SNAPSHOT projectGroup=io.micronaut.redis -micronautDocsVersion=2.0.0 -micronautVersion=4.0.0-SNAPSHOT -micronautTestVersion=4.0.0-SNAPSHOT - -groovyVersion=4.0.6 -spockVersion=2.3-groovy-4.0 - title=Micronaut Redis projectDesc=Integration between Micronaut and Redis projectUrl=https://micronaut.io diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d88b66b5..ecadd1a9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,9 @@ [versions] managed-lettuce = "6.2.1.RELEASE" +micronaut-docs = "2.0.0" +micronaut = "4.0.0-SNAPSHOT" +micronaut-test = "4.0.0-SNAPSHOT" micronaut-cache = "4.0.0-SNAPSHOT" micronaut-micrometer = "5.0.0-SNAPSHOT" micronaut-serde = "2.0.0-SNAPSHOT" @@ -8,6 +11,9 @@ micronaut-session = "1.0.0-SNAPSHOT" redis-embedded = "0.6" +groovy = "4.0.6" +spock = "2.3-groovy-4.0" + testcontainers = "1.17.5" [libraries] @@ -18,8 +24,6 @@ micronaut-micrometer = { module = "io.micronaut.micrometer:micronaut-micrometer- micronaut-serde = { module = "io.micronaut.serde:micronaut-serde-bom", version.ref = "micronaut-serde" } micronaut-session = { module = "io.micronaut.session:micronaut-session-bom", version.ref = "micronaut-session" } -projectreactor = { module = 'io.projectreactor:reactor-core' } - redis-embedded = { module = "com.github.kstyrc:embedded-redis", version.ref = "redis-embedded" } testcontainers-bom = { module = "org.testcontainers:testcontainers-bom", version.ref = "testcontainers" } diff --git a/redis-lettuce/build.gradle b/redis-lettuce/build.gradle index e7d42f1b..45e749ad 100644 --- a/redis-lettuce/build.gradle +++ b/redis-lettuce/build.gradle @@ -18,7 +18,7 @@ dependencies { testImplementation platform(libs.testcontainers.bom) testImplementation libs.testcontainers.spock - testImplementation libs.projectreactor + testImplementation mn.reactor testImplementation mn.micronaut.inject.java testImplementation mn.micronaut.management