-
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.
Fixes NullPointerException when using Infinispan Counter Manager
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
...client/deployment/src/test/java/io/quarkus/infinispan/test/OnlyUseCounterManagerTest.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,39 @@ | ||
package io.quarkus.infinispan.test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import jakarta.enterprise.inject.Default; | ||
import jakarta.inject.Inject; | ||
|
||
import org.infinispan.client.hotrod.RemoteCacheManager; | ||
import org.infinispan.counter.api.CounterConfiguration; | ||
import org.infinispan.counter.api.CounterManager; | ||
import org.infinispan.counter.api.CounterType; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class OnlyUseCounterManagerTest { | ||
|
||
//tag::injection[] | ||
@Inject | ||
CounterManager defaultCounterManager; | ||
|
||
//end::injection[] | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withConfigurationResource("empty-application-infinispan-client.properties"); | ||
|
||
@Test | ||
public void testContainerHasBeans() { | ||
assertThat(Arc.container().instance(RemoteCacheManager.class, Default.Literal.INSTANCE).get()).isNotNull(); | ||
assertThat(Arc.container().instance(CounterManager.class, Default.Literal.INSTANCE).get()).isNotNull(); | ||
|
||
boolean created = defaultCounterManager.defineCounter("one", | ||
CounterConfiguration.builder(CounterType.BOUNDED_STRONG).build()); | ||
assertThat(created).isTrue(); | ||
} | ||
} |
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