use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class ClientToMemberDiscoveryTest method setup.
@Before
public void setup() {
String serverXmlFileName = "hazelcast-multicast-plugin.xml";
String clientXmlFileName = "hazelcast-client-multicast-plugin.xml";
InputStream xmlResource = MulticastDiscoveryStrategy.class.getClassLoader().getResourceAsStream(serverXmlFileName);
serverConfig = new XmlConfigBuilder(xmlResource).build();
InputStream xmlClientResource = MulticastDiscoveryStrategy.class.getClassLoader().getResourceAsStream(clientXmlFileName);
clientConfig = new XmlClientConfigBuilder(xmlClientResource).build();
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class HazelcastServerCachingProvider method getConfig.
private Config getConfig(URL configURL, ClassLoader theClassLoader, String instanceName) throws IOException {
Config config = new XmlConfigBuilder(configURL).build();
config.setClassLoader(theClassLoader);
if (instanceName != null) {
// If instance name is specified via properties use it
// even though instance name is specified in the config.
config.setInstanceName(instanceName);
} else if (config.getInstanceName() == null) {
// Use config url as instance name if instance name is not specified.
config.setInstanceName(configURL.toString());
}
return config;
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class CachePartitionLostListenerConfigTest method cacheConfigXmlTest.
@Test
public void cacheConfigXmlTest() throws IOException {
String cacheName = "cacheWithPartitionLostListener";
Config config = new XmlConfigBuilder(configUrl).build();
CacheSimpleConfig cacheConfig = config.getCacheConfig(cacheName);
List<CachePartitionLostListenerConfig> configs = cacheConfig.getPartitionLostListenerConfigs();
assertEquals(1, configs.size());
assertEquals("DummyCachePartitionLostListenerImpl", configs.get(0).getClassName());
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class DiscoverySpiTest method testNodeFilter_from_xml.
@Test
public void testNodeFilter_from_xml() throws Exception {
String xmlFileName = "test-hazelcast-discovery-spi.xml";
InputStream xmlResource = DiscoverySpiTest.class.getClassLoader().getResourceAsStream(xmlFileName);
Config config = new XmlConfigBuilder(xmlResource).build();
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
DiscoveryConfig discoveryConfig = joinConfig.getDiscoveryConfig();
Address address = new Address("localhost", 5701);
DiscoveryServiceSettings settings = buildDiscoveryServiceSettings(address, discoveryConfig, DiscoveryMode.Client);
DiscoveryServiceProvider provider = new DefaultDiscoveryServiceProvider();
DiscoveryService discoveryService = provider.newDiscoveryService(settings);
discoveryService.start();
discoveryService.discoverNodes();
discoveryService.destroy();
Field nodeFilterField = DefaultDiscoveryService.class.getDeclaredField("nodeFilter");
nodeFilterField.setAccessible(true);
TestNodeFilter nodeFilter = (TestNodeFilter) nodeFilterField.get(discoveryService);
assertEquals(4, nodeFilter.getNodes().size());
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class MemberToMemberDiscoveryTest method setUp.
@Before
public void setUp() {
String xmlFileName = "hazelcast-multicast-plugin.xml";
InputStream xmlResource = MulticastDiscoveryStrategy.class.getClassLoader().getResourceAsStream(xmlFileName);
config = new XmlConfigBuilder(xmlResource).build();
System.setProperty(TestEnvironment.HAZELCAST_TEST_USE_NETWORK, "true");
System.setProperty("java.net.preferIPv4Stack", "true");
}
Aggregations