use of org.infinispan.container.impl.InternalEntryFactoryImpl in project infinispan by infinispan.
the class DataContainerStressTest method initializeDefaultDataContainer.
private void initializeDefaultDataContainer(DefaultDataContainer dc) {
InternalEntryFactoryImpl entryFactory = new InternalEntryFactoryImpl();
TimeService timeService = new EmbeddedTimeService();
TestingUtil.inject(entryFactory, timeService);
// Mockito cannot be used as it will run out of memory from keeping all the invocations, thus we use blank impls
TestingUtil.inject(dc, (EvictionManager) (evicted, cmd) -> CompletableFutures.completedNull(), new PassivationManagerStub(), entryFactory, new ActivationManagerStub(), null, timeService, null, new InternalExpirationManager() {
@Override
public void processExpiration() {
}
@Override
public boolean isEnabled() {
return false;
}
@Override
public CompletableFuture<Boolean> entryExpiredInMemory(InternalCacheEntry entry, long currentTime, boolean writeOperation) {
return null;
}
@Override
public CompletionStage<Void> handleInStoreExpirationInternal(Object key) {
return null;
}
@Override
public CompletionStage<Void> handleInStoreExpirationInternal(MarshallableEntry marshalledEntry) {
return null;
}
@Override
public CompletionStage<Boolean> handlePossibleExpiration(InternalCacheEntry entry, int segment, boolean isWrite) {
return null;
}
@Override
public void addInternalListener(ExpirationConsumer consumer) {
}
@Override
public void removeInternalListener(Object listener) {
}
});
}
use of org.infinispan.container.impl.InternalEntryFactoryImpl in project infinispan by infinispan.
the class BaseStoreTest method setUp.
// alwaysRun = true otherwise, when we run unstable tests, this method is not invoked (because it belongs to the unit group)
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
marshaller = new TestObjectStreamMarshaller(getSerializationContextInitializer());
timeService = getTimeService();
factory = new InternalEntryFactoryImpl();
TestingUtil.inject(factory, timeService);
try {
// noinspection unchecked
cl = createStore();
cl.start();
} catch (Exception e) {
log.error("Error creating store", e);
throw e;
}
}
use of org.infinispan.container.impl.InternalEntryFactoryImpl in project infinispan by infinispan.
the class ListenerRegistrationTest method newNotifier.
private CacheNotifierImpl newNotifier() {
CacheNotifierImpl notifier = new CacheNotifierImpl();
AdvancedCache mockCache = mock(AdvancedCache.class, RETURNS_DEEP_STUBS);
ComponentRegistry registry = mock(ComponentRegistry.class);
Configuration config = mock(Configuration.class, RETURNS_DEEP_STUBS);
when(config.clustering().cacheMode()).thenReturn(CacheMode.LOCAL);
when(config.memory().storageType()).thenReturn(StorageType.OBJECT);
TestingUtil.inject(notifier, mockCache, new ClusteringDependentLogic.LocalLogic(), config, new InternalEntryFactoryImpl(), mock(ClusterEventManager.class), mock(BasicComponentRegistry.class));
return notifier;
}
use of org.infinispan.container.impl.InternalEntryFactoryImpl in project infinispan by infinispan.
the class BaseNonBlockingStoreTest method setUp.
// alwaysRun = true otherwise, when we run unstable tests, this method is not invoked (because it belongs to the unit group)
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
marshaller = new TestObjectStreamMarshaller(getSerializationContextInitializer());
timeService = getTimeService();
internalEntryFactory = new InternalEntryFactoryImpl();
TestingUtil.inject(internalEntryFactory, timeService);
marshallableEntryFactory = new MarshalledEntryFactoryImpl();
TestingUtil.inject(marshallableEntryFactory, marshaller);
try {
NonBlockingStore<Object, Object> nonBlockingStore = createStore();
// Make sure all store methods don't block when we invoke them
store = new EnsureNonBlockingStore<>(nonBlockingStore, keyPartitioner);
startStore(store);
} catch (Exception e) {
log.error("Error creating store", e);
throw e;
}
}
use of org.infinispan.container.impl.InternalEntryFactoryImpl 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