use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentTest method createClientConfig.
private ClientConfig createClientConfig() {
ClientConfig config = new ClientConfig();
ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig();
clientUserCodeDeploymentConfig.addClass("usercodedeployment.IncrementingEntryProcessor");
config.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig.setEnabled(true));
config.getConnectionStrategyConfig().getConnectionRetryConfig().setClusterConnectTimeoutMillis(Long.MAX_VALUE);
return config;
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentTest method testWithParentAndChildClassesWorksIndependentOfOrder_parentFirst.
@Test
public void testWithParentAndChildClassesWorksIndependentOfOrder_parentFirst() {
ClientConfig clientConfig = new ClientConfig();
ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig();
clientUserCodeDeploymentConfig.addClass(SampleBaseClass.class);
clientUserCodeDeploymentConfig.addClass(SampleSubClass.class);
clientConfig.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig.setEnabled(true));
factory.newHazelcastInstance(createNodeConfig());
factory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientDomConfigProcessor method handleUserCodeDeployment.
private void handleUserCodeDeployment(Node node) {
Node enabledNode = getNamedItemNode(node, "enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode).trim());
ClientUserCodeDeploymentConfig userCodeDeploymentConfig = new ClientUserCodeDeploymentConfig();
userCodeDeploymentConfig.setEnabled(enabled);
for (Node child : childElements(node)) {
handleUserCodeDeploymentNode(userCodeDeploymentConfig, child);
}
clientConfig.setUserCodeDeploymentConfig(userCodeDeploymentConfig);
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ThreadLeakClientTest method testThreadLeakWhenClientCanNotStartDueToIncorrectUserCodeDeploymentClass.
@Test(expected = HazelcastException.class)
public void testThreadLeakWhenClientCanNotStartDueToIncorrectUserCodeDeploymentClass() {
Hazelcast.newHazelcastInstance();
ClientConfig config = new ClientConfig();
ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig();
clientUserCodeDeploymentConfig.addClass("invalid.class.test");
config.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig.setEnabled(true));
Set<Thread> testStartThreads = getThreads();
try {
HazelcastClient.newHazelcastClient(config);
} finally {
Hazelcast.shutdownAll();
assertHazelcastThreadShutdown(testStartThreads);
}
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class TestClientApplicationContext method testUserCodeDeploymentConfig.
@Test
public void testUserCodeDeploymentConfig() {
ClientConfig config = userCodeDeploymentTestClient.getClientConfig();
ClientUserCodeDeploymentConfig userCodeDeploymentConfig = config.getUserCodeDeploymentConfig();
List<String> classNames = userCodeDeploymentConfig.getClassNames();
assertFalse(userCodeDeploymentConfig.isEnabled());
assertEquals(2, classNames.size());
assertTrue(classNames.contains("SampleClassName1"));
assertTrue(classNames.contains("SampleClassName2"));
List<String> jarPaths = userCodeDeploymentConfig.getJarPaths();
assertEquals(1, jarPaths.size());
assertTrue(jarPaths.contains("/User/jar/path/test.jar"));
}
Aggregations