Skip to content

Commit

Permalink
Merge pull request #34062 from karesti/fix-injection-with-counter-man…
Browse files Browse the repository at this point in the history
…ager-only
  • Loading branch information
gastaldi authored Jun 15, 2023
2 parents 85224a9 + 772847d commit bd18df7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public RemoteCacheManager getNamedRemoteCacheManager(String clientName) {
}

public CounterManager getNamedCounterManager(String clientName) {
RemoteCacheManager cacheManager = remoteCacheManagers.get(clientName);
RemoteCacheManager cacheManager = getNamedRemoteCacheManager(clientName);
return RemoteCounterManagerFactory.asCounterManager(cacheManager);
}

Expand Down

0 comments on commit bd18df7

Please sign in to comment.