use of org.infinispan.server.resp.configuration.RespServerConfigurationBuilder in project infinispan by infinispan.
the class RespServerTest method testNoDefaultConfigurationClustered.
public void testNoDefaultConfigurationClustered() {
GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
Stoppable.useCacheManager(new DefaultCacheManager(global.build()), cm -> Stoppable.useServer(new RespServer(), ms -> {
ms.start(new RespServerConfigurationBuilder().build(), cm);
assertEquals(CacheMode.REPL_SYNC, ms.getCache().getCacheConfiguration().clustering().cacheMode());
}));
}
use of org.infinispan.server.resp.configuration.RespServerConfigurationBuilder in project infinispan by infinispan.
the class RespServerConfigurationParser method parseResp.
private void parseResp(ConfigurationReader reader, ServerConfigurationBuilder serverBuilder) {
boolean dedicatedSocketBinding = false;
String securityRealm = null;
EndpointConfigurationBuilder endpoint = serverBuilder.endpoints().current();
RespServerConfigurationBuilder builder = endpoint.addConnector(RespServerConfigurationBuilder.class);
for (int i = 0; i < reader.getAttributeCount(); i++) {
ParseUtils.requireNoNamespaceAttribute(reader, i);
String value = replaceProperties(reader.getAttributeValue(i));
Attribute attribute = Attribute.forName(reader.getAttributeName(i));
switch(attribute) {
case CACHE:
{
builder.defaultCacheName(value);
break;
}
case NAME:
{
builder.name(value);
break;
}
case SOCKET_BINDING:
{
builder.socketBinding(value);
builder.startTransport(true);
dedicatedSocketBinding = true;
break;
}
case SECURITY_REALM:
{
securityRealm = value;
}
default:
{
ServerConfigurationParser.parseCommonConnectorAttributes(reader, i, serverBuilder, builder);
}
}
}
if (!dedicatedSocketBinding) {
builder.socketBinding(endpoint.singlePort().socketBinding()).startTransport(false);
}
while (reader.inTag()) {
Element element = Element.forName(reader.getLocalName());
switch(element) {
case AUTHENTICATION:
{
parseAuthentication(reader, serverBuilder, builder.authentication().enable(), securityRealm);
break;
}
case ENCRYPTION:
{
if (!dedicatedSocketBinding) {
throw Server.log.cannotConfigureProtocolEncryptionUnderSinglePort();
}
parseEncryption(reader, serverBuilder, builder.encryption(), securityRealm);
break;
}
default:
{
ServerConfigurationParser.parseCommonConnectorElements(reader, builder);
}
}
}
}
use of org.infinispan.server.resp.configuration.RespServerConfigurationBuilder in project infinispan by infinispan.
the class RespServerTest 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 RespServer(), ms -> {
ms.start(new RespServerConfigurationBuilder().defaultCacheName(cm.getCacheManagerConfiguration().defaultCacheName().get()).build(), cm);
fail("Server should not start when expiration is enabled");
}));
}
use of org.infinispan.server.resp.configuration.RespServerConfigurationBuilder in project infinispan by infinispan.
the class RespServerTest method testNoDefaultConfigurationLocal.
public void testNoDefaultConfigurationLocal() {
GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
Stoppable.useCacheManager(new DefaultCacheManager(global.build()), cm -> Stoppable.useServer(new RespServer(), ms -> {
ms.start(new RespServerConfigurationBuilder().build(), cm);
assertEquals(CacheMode.LOCAL, ms.getCache().getCacheConfiguration().clustering().cacheMode());
}));
}
use of org.infinispan.server.resp.configuration.RespServerConfigurationBuilder in project infinispan by infinispan.
the class RespTestingUtil method startServer.
public static RespServer startServer(EmbeddedCacheManager cacheManager, int port) {
RespServer server = new RespServer();
String serverName = TestResourceTracker.getCurrentTestShortName();
server.start(new RespServerConfigurationBuilder().name(serverName).host(host).port(port).build(), cacheManager);
return server;
}
Aggregations