use of org.infinispan.container.impl.DefaultDataContainer in project infinispan by infinispan.
the class CacheConfigurationMBeanTest method testEvictionSize.
public void testEvictionSize() throws Exception {
MBeanServer mBeanServer = mBeanServerLookup.getMBeanServer();
ObjectName defaultOn = getCacheObjectName(JMX_DOMAIN, getDefaultCacheName() + "(local)", "Configuration");
assertEquals(1000L, (long) mBeanServer.getAttribute(defaultOn, "evictionSize"));
assertEquals(1000, cache().getCacheConfiguration().memory().size());
DefaultDataContainer<Object, Object> dataContainer = (DefaultDataContainer<Object, Object>) cache().getAdvancedCache().getDataContainer();
assertEquals(1000, dataContainer.capacity());
mBeanServer.setAttribute(defaultOn, new Attribute("evictionSize", 2000L));
assertEquals(2000, cache().getCacheConfiguration().memory().size());
assertEquals(2000, dataContainer.capacity());
}
use of org.infinispan.container.impl.DefaultDataContainer in project infinispan by infinispan.
the class DataContainerStressTest method testMemoryBoundedDataContainer.
public void testMemoryBoundedDataContainer() throws InterruptedException {
// The key length could be 4 or 5 (90% of the time it will be 5)
// The value length could be 6 or 7 (90% of the time it will be 7)
DefaultDataContainer dc = DefaultDataContainer.boundedDataContainer(5000, threeQuarterMemorySize(NUM_KEYS, 5, 20), EvictionType.MEMORY);
initializeDefaultDataContainer(dc);
doTest(dc);
}
use of org.infinispan.container.impl.DefaultDataContainer 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.DefaultDataContainer in project infinispan by infinispan.
the class DataContainerStressTest method testSimpleDataContainer.
public void testSimpleDataContainer() throws InterruptedException {
DefaultDataContainer dc = DefaultDataContainer.unBoundedDataContainer(5000);
initializeDefaultDataContainer(dc);
doTest(dc);
}
use of org.infinispan.container.impl.DefaultDataContainer in project infinispan by infinispan.
the class DataContainerStressTest method testEntryBoundedDataContainer.
public void testEntryBoundedDataContainer() throws InterruptedException {
DefaultDataContainer dc = DefaultDataContainer.boundedDataContainer(5000, NUM_KEYS - NUM_KEYS / 4, EvictionType.COUNT);
initializeDefaultDataContainer(dc);
doTest(dc);
}
Aggregations