use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class ClientMapStoreTest method buildConfig.
private Config buildConfig(String xml) {
ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
XmlConfigBuilder configBuilder = new XmlConfigBuilder(bis);
return configBuilder.build();
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class ClientExecutorServiceCancelTest method setup.
@Before
public void setup() {
Config config = new XmlConfigBuilder(getClass().getClassLoader().getResourceAsStream("hazelcast-test-executor.xml")).build();
server1 = hazelcastFactory.newHazelcastInstance(config);
server2 = hazelcastFactory.newHazelcastInstance(config);
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method setup.
@Before
public void setup() throws IOException {
Config config = new XmlConfigBuilder(getClass().getClassLoader().getResourceAsStream("hazelcast-test-executor.xml")).build();
ClientConfig clientConfig = new XmlClientConfigBuilder("classpath:hazelcast-client-test-executor.xml").build();
instance = hazelcastFactory.newHazelcastInstance(config);
hazelcastFactory.newHazelcastInstance(config);
hazelcastFactory.newHazelcastInstance(config);
hazelcastFactory.newHazelcastInstance(config);
client = hazelcastFactory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class ClientMapWithIndexCreationTest method test_createMapWithIndexes_whenProxyCreatedOnMemberOtherThanClientOwner.
/**
* Given a two members (A, B) cluster, a non-smart client connected to B attempts to create a map proxy targeting member A.
*/
@Test
public void test_createMapWithIndexes_whenProxyCreatedOnMemberOtherThanClientOwner() {
Config config = new XmlConfigBuilder().build();
MapConfig mapConfig = config.getMapConfig("test");
List<IndexConfig> indexConfigs = mapConfig.getIndexConfigs();
IndexConfig indexConfig = new IndexConfig();
indexConfig.addAttribute("name");
indexConfig.setType(IndexType.SORTED);
indexConfigs.add(indexConfig);
HazelcastInstance hz1 = factory.newHazelcastInstance(config);
HazelcastInstance hz2 = factory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
// ProxyManager#findNextAddressToSendCreateRequest uses the configured load balancer to find the next address
// to which proxy creation request will be sent. We want this to be member hz1.
clientConfig.setLoadBalancer(new StaticLB((Member) hz1.getLocalEndpoint()));
clientConfig.getNetworkConfig().setSmartRouting(false);
// the client only connects to member hz2.
clientConfig.getNetworkConfig().addAddress(hz2.getCluster().getLocalMember().getAddress().getHost() + ":" + hz2.getCluster().getLocalMember().getAddress().getPort());
HazelcastInstance client = factory.newHazelcastClient(clientConfig);
IMap<String, SampleTestObjects.Employee> test = client.getMap("test");
test.put("foo", new SampleTestObjects.Employee(1, "name", "age", 32, true, 230));
}
use of com.hazelcast.config.XmlConfigBuilder in project hazelcast by hazelcast.
the class GcpDiscoveryStrategyFactoryTest method createStrategy.
private static DiscoveryStrategy createStrategy(String xmlFileName) {
final InputStream xmlResource = GcpDiscoveryStrategyFactoryTest.class.getClassLoader().getResourceAsStream(xmlFileName);
Config config = new XmlConfigBuilder(xmlResource).build();
DiscoveryConfig discoveryConfig = config.getNetworkConfig().getJoin().getDiscoveryConfig();
DiscoveryServiceSettings settings = new DiscoveryServiceSettings().setDiscoveryConfig(discoveryConfig);
DefaultDiscoveryService service = new DefaultDiscoveryService(settings);
Iterator<DiscoveryStrategy> strategies = service.getDiscoveryStrategies().iterator();
return strategies.next();
}
Aggregations