use of org.infinispan.server.memcached.configuration.MemcachedServerConfigurationBuilder in project infinispan by infinispan.
the class MemcachedServerTest method testNoDefaultConfigurationLocal.
public void testNoDefaultConfigurationLocal() {
GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
Stoppable.useCacheManager(new DefaultCacheManager(global.build()), cm -> Stoppable.useServer(new MemcachedServer(), ms -> {
ms.start(new MemcachedServerConfigurationBuilder().build(), cm);
assertEquals(CacheMode.LOCAL, ms.getCache().getCacheConfiguration().clustering().cacheMode());
}));
}
use of org.infinispan.server.memcached.configuration.MemcachedServerConfigurationBuilder in project infinispan by infinispan.
the class MemcachedServerTest method testValidateInvalidExpiration.
@Test(expectedExceptions = CacheConfigurationException.class)
public void testValidateInvalidExpiration() {
ConfigurationBuilder config = new ConfigurationBuilder();
config.expiration().lifespan(10);
Stoppable.useCacheManager(TestCacheManagerFactory.createCacheManager(config), cm -> Stoppable.useServer(new MemcachedServer(), ms -> {
ms.start(new MemcachedServerConfigurationBuilder().defaultCacheName(cm.getCacheManagerConfiguration().defaultCacheName().get()).build(), cm);
fail("Server should not start when expiration is enabled");
}));
}
use of org.infinispan.server.memcached.configuration.MemcachedServerConfigurationBuilder in project infinispan by infinispan.
the class MemcachedTestingUtil method startMemcachedTextServer.
public static MemcachedServer startMemcachedTextServer(EmbeddedCacheManager cacheManager, int port, MediaType valueMediaType) {
MemcachedServer server = new MemcachedServer();
String serverName = TestResourceTracker.getCurrentTestShortName();
server.start(new MemcachedServerConfigurationBuilder().name(serverName).host(host).port(port).clientEncoding(valueMediaType).build(), cacheManager);
return server;
}
use of org.infinispan.server.memcached.configuration.MemcachedServerConfigurationBuilder in project infinispan by infinispan.
the class NoReplyListener method testStoreAsBinaryOverride.
public void testStoreAsBinaryOverride() {
ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
builder.memory().storageType(StorageType.BINARY);
EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(builder);
Configuration cfg = builder.build();
cm.defineConfiguration(new MemcachedServerConfigurationBuilder().build().defaultCacheName(), cfg);
assertEquals(StorageType.BINARY, cfg.memory().storageType());
MemcachedServer testServer = startMemcachedTextServer(cm, server.getPort() + 33);
try {
Cache memcachedCache = cm.getCache(testServer.getConfiguration().defaultCacheName());
assertEquals(StorageType.BINARY, memcachedCache.getCacheConfiguration().memory().storageType());
} finally {
cm.stop();
testServer.stop();
}
}
use of org.infinispan.server.memcached.configuration.MemcachedServerConfigurationBuilder in project infinispan by infinispan.
the class MemcachedServerTest method testNoDefaultConfigurationClustered.
public void testNoDefaultConfigurationClustered() {
GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
Stoppable.useCacheManager(new DefaultCacheManager(global.build()), cm -> Stoppable.useServer(new MemcachedServer(), ms -> {
ms.start(new MemcachedServerConfigurationBuilder().build(), cm);
assertEquals(CacheMode.REPL_SYNC, ms.getCache().getCacheConfiguration().clustering().cacheMode());
}));
}
Aggregations