use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ClientReliableTopicOverloadTest method setupCluster.
@Before
public void setupCluster() {
Config config = new Config();
config.addRingBufferConfig(new RingbufferConfig("when*").setCapacity(100).setTimeToLiveSeconds(5));
hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenError_*").setTopicOverloadPolicy(TopicOverloadPolicy.ERROR));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenDiscardOldest_*").setTopicOverloadPolicy(TopicOverloadPolicy.DISCARD_OLDEST));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenDiscardNewest_*").setTopicOverloadPolicy(TopicOverloadPolicy.DISCARD_NEWEST));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenBlock_*").setTopicOverloadPolicy(TopicOverloadPolicy.BLOCK));
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
serializationService = ((HazelcastClientProxy) client).getSerializationService();
String topicName = getTestMethodName();
topic = client.<String>getReliableTopic(topicName);
ringbuffer = ((ClientReliableTopicProxy<String>) topic).getRingbuffer();
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ProxyFactoryTest method testCustomProxy_usingFactoryClassName.
@Test
public void testCustomProxy_usingFactoryClassName() {
ClientConfig clientConfig = new ClientConfig();
ProxyFactoryConfig proxyFactoryConfig = new ProxyFactoryConfig();
proxyFactoryConfig.setService(SERVICE_NAME);
proxyFactoryConfig.setClassName(CustomProxyFactory.class.getName());
clientConfig.addProxyFactoryConfig(proxyFactoryConfig);
testCustomProxy(clientConfig);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ProxyFactoryTest method testCustomProxy_usingFactoryImplementation.
@Test
public void testCustomProxy_usingFactoryImplementation() {
ClientConfig clientConfig = new ClientConfig();
ProxyFactoryConfig proxyFactoryConfig = new ProxyFactoryConfig();
proxyFactoryConfig.setService(SERVICE_NAME);
proxyFactoryConfig.setFactoryImpl(new CustomProxyFactory());
clientConfig.addProxyFactoryConfig(proxyFactoryConfig);
testCustomProxy(clientConfig);
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class ProxyFactoryTest method testProxy_whenInitThrowsError.
@Test
public void testProxy_whenInitThrowsError() {
ClientConfig clientConfig = new ClientConfig();
ProxyFactoryConfig proxyFactoryConfig = new ProxyFactoryConfig();
proxyFactoryConfig.setService(SERVICE_NAME);
proxyFactoryConfig.setFactoryImpl(new ClientProxyFactory() {
@Override
public ClientProxy create(String id) {
return new ClientProxy(SERVICE_NAME, id) {
@Override
protected void onInitialize() {
super.onInitialize();
throw new ExpectedError();
}
};
}
});
clientConfig.addProxyFactoryConfig(proxyFactoryConfig);
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
String objectName = "custom-object";
try {
client.getDistributedObject(SERVICE_NAME, objectName);
fail("Client proxy initialization should fail!");
} catch (ExpectedError expected) {
}
}
use of com.hazelcast.client.config.ClientConfig in project hazelcast by hazelcast.
the class AtomicLongStableReadStressTest method setUp.
@Before
public void setUp() {
super.setUp();
ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().setRedoOperation(true);
client = HazelcastClient.newHazelcastClient(clientConfig);
references = new IAtomicLong[REFERENCE_COUNT];
for (int k = 0; k < references.length; k++) {
references[k] = client.getAtomicLong("atomicreference:" + k);
}
stressThreads = new StressThread[CLIENT_THREAD_COUNT];
for (int k = 0; k < stressThreads.length; k++) {
stressThreads[k] = new StressThread();
stressThreads[k].start();
}
}
Aggregations