use of org.infinispan.notifications.cachelistener.cluster.ClusterEventManager in project infinispan by infinispan.
the class CacheNotifierImplTest method setUp.
@BeforeMethod
public void setUp() {
n = new CacheNotifierImpl();
mockCache = mock(EncoderCache.class);
EmbeddedCacheManager cacheManager = mock(EmbeddedCacheManager.class);
when(mockCache.getCacheManager()).thenReturn(cacheManager);
when(mockCache.getAdvancedCache()).thenReturn(mockCache);
when(mockCache.getKeyDataConversion()).thenReturn(DataConversion.IDENTITY_KEY);
when(mockCache.getValueDataConversion()).thenReturn(DataConversion.IDENTITY_VALUE);
when(mockCache.getStatus()).thenReturn(ComponentStatus.INITIALIZING);
ComponentRegistry componentRegistry = mock(ComponentRegistry.class);
when(mockCache.getComponentRegistry()).thenReturn(componentRegistry);
MockBasicComponentRegistry mockRegistry = new MockBasicComponentRegistry();
when(componentRegistry.getComponent(BasicComponentRegistry.class)).thenReturn(mockRegistry);
mockRegistry.registerMocks(RpcManager.class, CommandsFactory.class);
mockRegistry.registerMock(KnownComponentNames.INTERNAL_MARSHALLER, StreamingMarshaller.class);
ClusteringDependentLogic.LocalLogic cdl = new ClusteringDependentLogic.LocalLogic();
Configuration config = new ConfigurationBuilder().build();
cdl.init(null, config, mock(KeyPartitioner.class));
ClusterEventManager cem = mock(ClusterEventManager.class);
when(cem.sendEvents(any())).thenReturn(CompletableFutures.completedNull());
BlockingManager handler = mock(BlockingManager.class);
when(handler.continueOnNonBlockingThread(any(), any())).thenReturn(CompletableFutures.completedNull());
TestingUtil.inject(n, mockCache, cdl, config, mockRegistry, mock(InternalEntryFactory.class), cem, mock(KeyPartitioner.class), new FakeEncoderRegistry(), TestingUtil.named(KnownComponentNames.ASYNC_NOTIFICATION_EXECUTOR, new WithinThreadExecutor()), handler);
cl = new CacheListener();
n.start();
addListener();
ctx = new NonTxInvocationContext(null);
}
use of org.infinispan.notifications.cachelistener.cluster.ClusterEventManager in project infinispan by infinispan.
the class OnlyPrimaryOwnerTest method setUp.
@BeforeMethod
public void setUp() {
n = new CacheNotifierImpl();
mockCache = mock(EncoderCache.class);
EmbeddedCacheManager cacheManager = mock(EmbeddedCacheManager.class);
when(mockCache.getCacheManager()).thenReturn(cacheManager);
when(mockCache.getAdvancedCache()).thenReturn(mockCache);
when(mockCache.getKeyDataConversion()).thenReturn(DataConversion.IDENTITY_KEY);
when(mockCache.getValueDataConversion()).thenReturn(DataConversion.IDENTITY_VALUE);
when(mockCache.getStatus()).thenReturn(ComponentStatus.INITIALIZING);
ComponentRegistry componentRegistry = mock(ComponentRegistry.class);
when(mockCache.getComponentRegistry()).thenReturn(componentRegistry);
MockBasicComponentRegistry mockRegistry = new MockBasicComponentRegistry();
when(componentRegistry.getComponent(BasicComponentRegistry.class)).thenReturn(mockRegistry);
mockRegistry.registerMocks(RpcManager.class, CommandsFactory.class, Encoder.class);
mockRegistry.registerMock(KnownComponentNames.INTERNAL_MARSHALLER, StreamingMarshaller.class);
Configuration config = new ConfigurationBuilder().memory().storageType(StorageType.OBJECT).build();
ClusterEventManager cem = mock(ClusterEventManager.class);
when(cem.sendEvents(any())).thenReturn(CompletableFutures.completedNull());
TestingUtil.inject(n, mockCache, cdl, config, mockRegistry, mock(InternalEntryFactory.class), cem, mock(KeyPartitioner.class), mock(BlockingManager.class));
cl = new PrimaryOwnerCacheListener();
n.start();
n.addListener(cl);
ctx = new NonTxInvocationContext(null);
}
use of org.infinispan.notifications.cachelistener.cluster.ClusterEventManager in project infinispan by infinispan.
the class BaseCacheNotifierImplInitialTransferTest method setUp.
@BeforeMethod
public void setUp() {
n = new CacheNotifierImpl();
mockCache = mock(EncoderCache.class);
EmbeddedCacheManager cacheManager = mock(EmbeddedCacheManager.class);
when(mockCache.getCacheManager()).thenReturn(cacheManager);
when(mockCache.getAdvancedCache()).thenReturn(mockCache);
when(mockCache.getKeyDataConversion()).thenReturn(DataConversion.IDENTITY_KEY);
when(mockCache.getValueDataConversion()).thenReturn(DataConversion.IDENTITY_VALUE);
Configuration config = new ConfigurationBuilder().clustering().cacheMode(cacheMode).build();
GlobalConfiguration globalConfig = GlobalConfigurationBuilder.defaultClusteredBuilder().build();
when(mockCache.getStatus()).thenReturn(ComponentStatus.INITIALIZING);
mockPublisherManager = mock(ClusterPublisherManager.class);
ComponentRegistry componentRegistry = mock(ComponentRegistry.class);
when(mockCache.getComponentRegistry()).thenReturn(componentRegistry);
MockBasicComponentRegistry mockRegistry = new MockBasicComponentRegistry();
when(componentRegistry.getComponent(BasicComponentRegistry.class)).thenReturn(mockRegistry);
mockRegistry.registerMocks(RpcManager.class, CommandsFactory.class);
mockRegistry.registerMock(KnownComponentNames.INTERNAL_MARSHALLER, StreamingMarshaller.class);
ClusteringDependentLogic.LocalLogic cdl = new ClusteringDependentLogic.LocalLogic();
cdl.init(null, config, mock(KeyPartitioner.class));
ClusterEventManager cem = mock(ClusterEventManager.class);
when(cem.sendEvents(any())).thenReturn(CompletableFutures.completedNull());
BlockingManager handler = mock(BlockingManager.class);
when(handler.continueOnNonBlockingThread(any(), any())).thenReturn(CompletableFutures.completedNull());
TestingUtil.inject(n, mockCache, cdl, config, globalConfig, mockRegistry, mockPublisherManager, new InternalEntryFactoryImpl(), cem, mock(KeyPartitioner.class), handler, TestingUtil.named(KnownComponentNames.ASYNC_NOTIFICATION_EXECUTOR, new WithinThreadExecutor()));
n.start();
ctx = new NonTxInvocationContext(null);
}
Aggregations