-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds infinispan caches configuration resource build property
- Loading branch information
Showing
16 changed files
with
370 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
.../test/java/org/quarkus/infinispan/client/deployment/InfinispanConfigurationSetupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.quarkus.infinispan.client.deployment; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.infinispan.client.hotrod.RemoteCacheManager; | ||
import org.infinispan.client.hotrod.configuration.ClientIntelligence; | ||
import org.infinispan.client.hotrod.configuration.Configuration; | ||
import org.infinispan.client.hotrod.configuration.NearCacheMode; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class InfinispanConfigurationSetupTest { | ||
@Inject | ||
RemoteCacheManager remoteCacheManager; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.withConfigurationResource("cache-config-application.properties") | ||
.withApplicationRoot((jar) -> jar | ||
.addAsResource("distributed-cache-config.xml") | ||
.addAsResource("local-cache-config.xml")); | ||
|
||
@Test | ||
public void infinispanConnectionConfiguration() { | ||
assertThat(remoteCacheManager).isNotNull(); | ||
Configuration configuration = remoteCacheManager.getConfiguration(); | ||
assertThat(configuration.servers().size()).isEqualTo(1); | ||
assertThat(configuration.servers().get(0).host()).isEqualTo("cluster1"); | ||
assertThat(configuration.servers().get(0).port()).isEqualTo(31000); | ||
assertThat(configuration.tracingPropagationEnabled()).isFalse(); | ||
assertThat(configuration.clientIntelligence()).isEqualTo(ClientIntelligence.BASIC); | ||
assertThat(configuration.security().authentication().enabled()).isTrue(); | ||
assertThat(configuration.security().authentication().saslMechanism()).isEqualTo("BASIC"); | ||
assertThat(configuration.security().authentication().serverName()).isEqualTo("custom-server-name"); | ||
assertThat(configuration.security().ssl().enabled()).isTrue(); | ||
assertThat(configuration.security().ssl().trustStorePassword()).isEqualTo("trust-pass".toCharArray()); | ||
assertThat(configuration.security().ssl().trustStoreFileName()).isEqualTo("custom-trust-store"); | ||
assertThat(configuration.security().ssl().trustStoreType()).isEqualTo("JCEKS"); | ||
assertThat(configuration.security().ssl().provider()).isEqualTo("SSL_prov"); | ||
assertThat(configuration.security().ssl().protocol()).isEqualTo("SSL_protocol"); | ||
assertThat(configuration.security().ssl().ciphers()).containsExactlyInAnyOrder("SSL_cipher1", "SSL_cipher2"); | ||
|
||
assertThat(configuration.remoteCaches().get("cache1").configuration()).isEqualTo("<replicated-cache/>"); | ||
assertThat(configuration.remoteCaches().get("cache1").nearCacheBloomFilter()).isTrue(); | ||
assertThat(configuration.remoteCaches().get("cache1").nearCacheMaxEntries()).isEqualTo(100); | ||
assertThat(configuration.remoteCaches().get("cache1").nearCacheMode()).isEqualTo(NearCacheMode.INVALIDATED); | ||
|
||
assertThat(configuration.remoteCaches().get("cache2").configuration()).isEqualTo("<distributed-cache/>"); | ||
assertThat(configuration.remoteCaches().get("cache2").nearCacheBloomFilter()).isFalse(); | ||
assertThat(configuration.remoteCaches().get("cache2").nearCacheMaxEntries()).isEqualTo(-1); | ||
assertThat(configuration.remoteCaches().get("cache2").nearCacheMode()).isEqualTo(NearCacheMode.DISABLED); | ||
|
||
assertThat(configuration.remoteCaches().get("cache3").configuration()).isEqualTo("<local-cache/>"); | ||
|
||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...a/org/quarkus/infinispan/client/deployment/InfinispanDefaultMinimalConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.quarkus.infinispan.client.deployment; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.infinispan.client.hotrod.RemoteCacheManager; | ||
import org.infinispan.client.hotrod.configuration.ClientIntelligence; | ||
import org.infinispan.client.hotrod.configuration.Configuration; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class InfinispanDefaultMinimalConfigurationTest { | ||
@Inject | ||
RemoteCacheManager remoteCacheManager; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.withConfigurationResource("minimal-application.properties"); | ||
|
||
@Test | ||
public void infinispanConnectionConfiguration() { | ||
assertThat(remoteCacheManager).isNotNull(); | ||
Configuration configuration = remoteCacheManager.getConfiguration(); | ||
assertThat(configuration.servers().size()).isEqualTo(1); | ||
assertThat(configuration.servers().get(0).host()).isEqualTo("cluster1"); | ||
assertThat(configuration.servers().get(0).port()).isEqualTo(31000); | ||
assertThat(configuration.tracingPropagationEnabled()).isTrue(); | ||
assertThat(configuration.clientIntelligence()).isEqualTo(ClientIntelligence.HASH_DISTRIBUTION_AWARE); | ||
assertThat(configuration.remoteCaches()).isEmpty(); | ||
assertThat(configuration.security().authentication().enabled()).isTrue(); | ||
assertThat(configuration.security().authentication().saslMechanism()).isEqualTo("DIGEST-MD5"); | ||
assertThat(configuration.security().ssl().enabled()).isFalse(); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...g/quarkus/infinispan/client/deployment/MultipleNamedInfinispanConfigurationSetupTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.quarkus.infinispan.client.deployment; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.infinispan.client.hotrod.RemoteCacheManager; | ||
import org.infinispan.client.hotrod.configuration.Configuration; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.infinispan.client.InfinispanClientName; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class MultipleNamedInfinispanConfigurationSetupTest { | ||
@Inject | ||
RemoteCacheManager remoteCacheManager; | ||
|
||
@Inject | ||
@InfinispanClientName("another") | ||
RemoteCacheManager anotherRemoteCacheManager; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withEmptyApplication() | ||
.withConfigurationResource("multiple-cache-config-application.properties") | ||
.withApplicationRoot((jar) -> jar | ||
.addAsResource("distributed-cache-config.xml") | ||
.addAsResource("local-cache-config.xml")); | ||
|
||
@Test | ||
public void infinispanMultipleConnectionsConfiguration() { | ||
assertThat(remoteCacheManager).isNotNull(); | ||
assertThat(anotherRemoteCacheManager).isNotNull(); | ||
|
||
Configuration configuration = remoteCacheManager.getConfiguration(); | ||
assertThat(configuration.servers().size()).isEqualTo(1); | ||
assertThat(configuration.servers().get(0).host()).isEqualTo("cluster1"); | ||
assertThat(configuration.servers().get(0).port()).isEqualTo(31000); | ||
assertThat(configuration.remoteCaches().get("cache3").configuration()).isEqualTo("<local-cache/>"); | ||
|
||
Configuration anotherConfiguration = anotherRemoteCacheManager.getConfiguration(); | ||
assertThat(anotherConfiguration.servers().size()).isEqualTo(1); | ||
assertThat(anotherConfiguration.servers().get(0).host()).isEqualTo("cluster2"); | ||
assertThat(anotherConfiguration.servers().get(0).port()).isEqualTo(41000); | ||
assertThat(anotherConfiguration.remoteCaches().get("cache4").configuration()).isEqualTo("<local-cache/>"); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...sions/infinispan-client/deployment/src/test/resources/cache-config-application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# don't run any server with test containers. this config is used to test the configuration mapping | ||
quarkus.infinispan-client.devservices.enabled=false | ||
quarkus.infinispan-client.use-schema-registration=false | ||
|
||
quarkus.infinispan-client.hosts=cluster1:31000 | ||
quarkus.infinispan-client.username=infinispan | ||
quarkus.infinispan-client.password=secret | ||
quarkus.infinispan-client.tracing.propagation.enabled=false | ||
quarkus.infinispan-client.client-intelligence=BASIC | ||
quarkus.infinispan-client.sasl-mechanism=BASIC | ||
quarkus.infinispan-client.auth-realm=infiniRealm | ||
quarkus.infinispan-client.auth-server-name=custom-server-name | ||
quarkus.infinispan-client.trust-store=custom-trust-store | ||
quarkus.infinispan-client.trust-store-password=trust-pass | ||
quarkus.infinispan-client.trust-store-type=JCEKS | ||
quarkus.infinispan-client.ssl-provider=SSL_prov | ||
quarkus.infinispan-client.ssl-protocol=SSL_protocol | ||
quarkus.infinispan-client.ssl-ciphers=SSL_cipher1,SSL_cipher2 | ||
|
||
# cache 1 config | ||
quarkus.infinispan-client.cache.cache1.configuration=<replicated-cache/> | ||
quarkus.infinispan-client.cache.cache1.near-cache-use-bloom-filter=true | ||
quarkus.infinispan-client.cache.cache1.near-cache-max-entries=100 | ||
quarkus.infinispan-client.cache.cache1.near-cache-mode=INVALIDATED | ||
|
||
# cache 2 config (configuration-resource over configuration) | ||
quarkus.infinispan-client.cache.cache2.configuration=<replicated-cache/> | ||
quarkus.infinispan-client.cache.cache2.configuration-resource=distributed-cache-config.xml | ||
|
||
# cache 3 config (configuration-uri over configuration-resource and configuration) | ||
quarkus.infinispan-client.cache.cache3.configuration=<replicated-cache/> | ||
quarkus.infinispan-client.cache.cache3.configuration-resource=distributed-cache-config.xml | ||
quarkus.infinispan-client.cache.cache3.configuration-uri=local-cache-config.xml |
1 change: 1 addition & 0 deletions
1
extensions/infinispan-client/deployment/src/test/resources/distributed-cache-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<distributed-cache/> |
1 change: 1 addition & 0 deletions
1
extensions/infinispan-client/deployment/src/test/resources/local-cache-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<local-cache/> |
7 changes: 7 additions & 0 deletions
7
extensions/infinispan-client/deployment/src/test/resources/minimal-application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# don't run any server with test containers. this config is used to test the configuration mapping | ||
quarkus.infinispan-client.devservices.enabled=false | ||
quarkus.infinispan-client.use-schema-registration=false | ||
|
||
quarkus.infinispan-client.hosts=cluster1:31000 | ||
quarkus.infinispan-client.username=infinispan | ||
quarkus.infinispan-client.password=secret |
20 changes: 20 additions & 0 deletions
20
...inispan-client/deployment/src/test/resources/multiple-cache-config-application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# don't run any server with test containers. this config is used to test the configuration mapping | ||
quarkus.infinispan-client.devservices.enabled=false | ||
quarkus.infinispan-client.devservices.another.enabled=false | ||
quarkus.infinispan-client.use-schema-registration=false | ||
quarkus.infinispan-client.another.use-schema-registration=false | ||
|
||
quarkus.infinispan-client.hosts=cluster1:31000 | ||
quarkus.infinispan-client.username=infinispan | ||
quarkus.infinispan-client.password=secret | ||
|
||
quarkus.infinispan-client.another.hosts=cluster2:41000 | ||
quarkus.infinispan-client.another.username=another-infinispan | ||
quarkus.infinispan-client.another.password=another-secret | ||
|
||
# cache 3 config (configuration-uri over configuration-resource and configuration) | ||
quarkus.infinispan-client.cache.cache3.configuration-resource=distributed-cache-config.xml | ||
quarkus.infinispan-client.cache.cache3.configuration-uri=local-cache-config.xml | ||
|
||
# cache 4 config (only present in another and build time config) | ||
quarkus.infinispan-client.another.cache.cache4.configuration-resource=local-cache-config.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.