use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class AbstractClientMapReduceJobTest method buildConfig.
protected Config buildConfig() {
Config config = new XmlConfigBuilder().build();
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1");
return config;
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class CacheQuorumConfigTest method cacheConfigXmlTest.
@Test
public void cacheConfigXmlTest() throws IOException {
final String cacheName = "configtestCache" + randomString();
Config config = new XmlConfigBuilder(configUrl).build();
CacheSimpleConfig cacheConfig1 = config.getCacheConfig(cacheName);
final String quorumName = cacheConfig1.getQuorumName();
assertEquals("cache-quorum", quorumName);
QuorumConfig quorumConfig = config.getQuorumConfig(quorumName);
assertEquals(3, quorumConfig.getSize());
assertEquals(QuorumType.READ_WRITE, quorumConfig.getType());
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class CacheCreationTest method init.
@BeforeClass
public static void init() throws Exception {
final URL configUrl = CacheCreationTest.class.getClassLoader().getResource("test-hazelcast-real-jcache.xml");
XmlConfigBuilder configBuilder = new XmlConfigBuilder(configUrl.getFile());
hzConfig = configBuilder.build();
}
use of com.hazelcast.config.XmlConfigBuilder in project ddf by codice.
the class ResourceCacheImpl method getHazelcastConfig.
private Config getHazelcastConfig(BundleContext context, String xmlConfigFilename) {
Config cfg = null;
Bundle bundle = context.getBundle();
URL xmlConfigFileUrl = null;
if (StringUtils.isNotBlank(xmlConfigFilename)) {
xmlConfigFileUrl = bundle.getResource(xmlConfigFilename);
}
XmlConfigBuilder xmlConfigBuilder = null;
if (xmlConfigFileUrl != null) {
try {
xmlConfigBuilder = new XmlConfigBuilder(xmlConfigFileUrl.openStream());
cfg = xmlConfigBuilder.build();
LOGGER.debug("Successfully built hazelcast config from XML config file {}", xmlConfigFilename);
} catch (FileNotFoundException e) {
LOGGER.info("FileNotFoundException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
} catch (IOException e) {
LOGGER.info("IOException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
}
}
if (cfg == null) {
LOGGER.info("Falling back to using generic Config for hazelcast");
cfg = new Config();
} else if (LOGGER.isDebugEnabled()) {
MapConfig mapConfig = cfg.getMapConfig("Product_Cache");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistentNotifications - try persistent*");
mapConfig = cfg.getMapConfig("persistent*");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistent*");
}
} else {
MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
if (null != mapStoreConfig) {
LOGGER.debug("mapStoreConfig factoryClassName = {}", mapStoreConfig.getFactoryClassName());
}
}
}
return cfg;
}
use of com.hazelcast.config.XmlConfigBuilder in project ddf by codice.
the class HazelcastNotificationStore method getHazelcastConfig.
private Config getHazelcastConfig(BundleContext context, String xmlConfigFilename) {
Config cfg = null;
Bundle bundle = context.getBundle();
URL xmlConfigFileUrl = null;
if (StringUtils.isNotBlank(xmlConfigFilename)) {
xmlConfigFileUrl = bundle.getResource(xmlConfigFilename);
}
XmlConfigBuilder xmlConfigBuilder = null;
if (xmlConfigFileUrl != null) {
try {
xmlConfigBuilder = new XmlConfigBuilder(xmlConfigFileUrl.openStream());
cfg = xmlConfigBuilder.build();
LOGGER.debug("Successfully built hazelcast config from XML config file {}", xmlConfigFilename);
} catch (FileNotFoundException e) {
LOGGER.info("FileNotFoundException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
} catch (IOException e) {
LOGGER.info("IOException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
}
}
if (cfg == null) {
LOGGER.info("Falling back to using generic Config for hazelcast");
cfg = new Config();
} else if (LOGGER.isDebugEnabled()) {
MapConfig mapConfig = cfg.getMapConfig("persistentNotifications");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistentNotifications - try persistent*");
mapConfig = cfg.getMapConfig("persistent*");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistent*");
}
} else {
MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
if (mapStoreConfig != null) {
LOGGER.debug("mapStoreConfig factoryClassName = {}", mapStoreConfig.getFactoryClassName());
} else {
LOGGER.debug("mapStoreConfig is null");
}
}
}
return cfg;
}
Aggregations