Skip to content

Commit

Permalink
Microstream version bump backport (#9289)
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <[email protected]>
  • Loading branch information
Verdent authored Oct 3, 2024
1 parent 92468ef commit fcaea1c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 44 deletions.
7 changes: 6 additions & 1 deletion dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<version.lib.microprofile-rest-client>3.0</version.lib.microprofile-rest-client>
<version.lib.microprofile-tracing>3.0</version.lib.microprofile-tracing>
<version.lib.microprofile-lra-api>2.0-RC1</version.lib.microprofile-lra-api>
<version.lib.microstream>05.00.02-MS-GA</version.lib.microstream>
<version.lib.microstream>08.01.01-MS-GA</version.lib.microstream>
<version.lib.mongodb.reactivestreams>1.11.0</version.lib.mongodb.reactivestreams>
<version.lib.mssql-jdbc>8.4.1.jre8</version.lib.mssql-jdbc>
<version.lib.mysql-connector-j>8.2.0</version.lib.mysql-connector-j>
Expand Down Expand Up @@ -736,6 +736,11 @@
<artifactId>microstream-cache</artifactId>
<version>${version.lib.microstream}</version>
</dependency>
<dependency>
<groupId>one.microstream</groupId>
<artifactId>microstream-persistence-binary-jdk17</artifactId>
<version>${version.lib.microstream}</version>
</dependency>

<!-- Integrations related -->
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion integrations/microstream/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This projects add [Microstream](https://microstream.one) support to Helidon.

The offical [Microstream documentation](https://manual.docs.microstream.one/) can be found here.
The official [Microstream documentation](https://manual.docs.microstream.one/) can be found here.

## helidon-integrations-microstream

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,9 +16,6 @@

package io.helidon.integrations.microstream.cache;

import java.lang.reflect.Field;
import java.util.function.Predicate;

import javax.cache.configuration.CacheEntryListenerConfiguration;
import javax.cache.configuration.Factory;
import javax.cache.expiry.ExpiryPolicy;
Expand All @@ -33,6 +30,7 @@
import one.microstream.cache.types.CacheConfigurationPropertyNames;
import one.microstream.cache.types.EvictionManager;
import one.microstream.configuration.types.Configuration;
import one.microstream.persistence.binary.util.SerializerFoundation;

/**
* Builder for Microstream-CacheConfigurations.
Expand Down Expand Up @@ -89,7 +87,7 @@ public static <K, V> MicrostreamCacheConfigurationBuilder<K, V> builder(Class<K>
*
* @param <K> type of the cache key
* @param <V> type of the cache value
* @param config helidon configuation
* @param config helidon configuration
* @param keyType type of the cache key
* @param valueType type of the cache value
* @return a new CacheConfiguration builder
Expand Down Expand Up @@ -171,10 +169,8 @@ public MicrostreamCacheConfigurationBuilder<K, V> cacheWriterFactory(
}

@Override
public MicrostreamCacheConfigurationBuilder<K, V> serializerFieldPredicate(
Predicate<? super Field> serializerFieldPredicate) {
cacheConfigBuilder.serializerFieldPredicate(serializerFieldPredicate);
return this;
public Builder<K, V> serializerFoundation(SerializerFoundation<?> serializerFoundation) {
return cacheConfigBuilder.serializerFoundation(serializerFoundation);
}

@Override
Expand All @@ -185,7 +181,7 @@ public Builder<K, V> addListenerConfiguration(CacheEntryListenerConfiguration<K,

private static void verifyType(String typeName, Class<?> actualType) {
if (!typeName.equals(actualType.getTypeName())) {
throw new ConfigException("Microstream cache-config type missmatch, expected value from configuration: " + typeName
throw new ConfigException("Microstream cache-config type mismatch, expected value from configuration: " + typeName
+ " but got: " + actualType.getTypeName());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,9 +16,7 @@

package io.helidon.integrations.microstream.cache;

import java.lang.reflect.Field;
import java.util.Map;
import java.util.function.Predicate;

import javax.cache.configuration.Factory;
import javax.cache.expiry.ExpiryPolicy;
Expand Down Expand Up @@ -65,9 +63,7 @@ void defaultValuesTest() {
() -> assertThat("getCacheLoaderFactory", cacheConfig.getCacheLoaderFactory(), nullValue()),
() -> assertThat("getCacheWriterFactory", cacheConfig.getCacheWriterFactory(), nullValue()),
() -> assertThat("getCacheEntryListenerConfigurations",
cacheConfig.getCacheEntryListenerConfigurations(), emptyIterable()),
() -> assertThat("getSerializerFieldPredicate", cacheConfig.getSerializerFieldPredicate(),
is(CacheConfiguration.DefaultSerializerFieldPredicate())));
cacheConfig.getCacheEntryListenerConfigurations(), emptyIterable()));
}

/**
Expand Down Expand Up @@ -154,14 +150,4 @@ void evictionManagerFactoryTest() {
assertThat(cacheConfig.getEvictionManagerFactory(), sameInstance(evictionManagerFactory));
}

@Test
void serializerFieldPredicate() {
@SuppressWarnings("unchecked")
Predicate<? super Field> serializerFieldPredicate = Mockito.mock(Predicate.class);

CacheConfiguration<Integer, String> cacheConfig = MicrostreamCacheConfigurationBuilder
.builder(Integer.class, String.class).serializerFieldPredicate(serializerFieldPredicate).build();

assertThat(cacheConfig.getSerializerFieldPredicate(), sameInstance(serializerFieldPredicate));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -100,10 +100,8 @@ private void addBeans(@Observes final AfterBeanDiscovery event, final BeanManage
.scope(ApplicationScoped.class)
.addTransitiveTypeClosure(Cache.class)
.addTypes(types)
.createWith(cc -> {
return CacheBuilder.create(name, getConfigNode(qualifiers), keyType.rawType(),
valueType.rawType());
})
.createWith(cc -> CacheBuilder.create(name, getConfigNode(qualifiers), keyType.rawType(),
valueType.rawType()))
.destroyWith((cache, context) -> cache.close());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -89,9 +89,7 @@ private void addBeans(@Observes final AfterBeanDiscovery event, final BeanManage
.addTransitiveTypeClosure(EmbeddedStorageManager.class)
.beanClass(EmbeddedStorageManager.class)
.qualifiers(qualifiers)
.createWith(cc -> {
return EmbeddedStorageManagerBuilder.create(getConfigNode(qualifiers)).start();
})
.createWith(cc -> EmbeddedStorageManagerBuilder.create(getConfigNode(qualifiers)).start())
.destroyWith((storageManager, context) -> storageManager.shutdown());
}
}
Expand Down
5 changes: 1 addition & 4 deletions integrations/microstream/cdi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,10 +29,7 @@
requires transitive jakarta.inject;
requires jakarta.interceptor.api;
requires jakarta.annotation;
requires microstream.base;
requires microstream.cache;
requires microstream.persistence;
requires microstream.storage;
requires microstream.storage.embedded;

provides jakarta.enterprise.inject.spi.Extension
Expand Down
4 changes: 4 additions & 0 deletions integrations/microstream/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<groupId>one.microstream</groupId>
<artifactId>microstream-configuration</artifactId>
</dependency>
<dependency>
<groupId>one.microstream</groupId>
<artifactId>microstream-persistence-binary-jdk17</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.config</groupId>
<artifactId>helidon-config</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion integrations/microstream/core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,5 +28,6 @@
requires transitive microstream.storage;
requires transitive microstream.storage.embedded;
requires transitive microstream.storage.embedded.configuration;
requires microstream.persistence.binary.jdk17;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +39,6 @@
public class MicrostreamMetricsSupport {

private static final String CONFIG_METRIC_ENABLED_VENDOR = "vendor.";
static final String BASE_ENABLED_KEY = CONFIG_METRIC_ENABLED_VENDOR + "enabled";

private static final Metadata GLOBAL_FILE_COUNT = Metadata.builder()
.withName("microstream.globalFileCount")
Expand Down

0 comments on commit fcaea1c

Please sign in to comment.