use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentExceptionTest method testClientsWith_wrongClassName.
@Test(expected = ClassNotFoundException.class)
public void testClientsWith_wrongClassName() throws Throwable {
Config config = createNodeConfig();
config.getUserCodeDeploymentConfig().setEnabled(true);
factory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig();
clientUserCodeDeploymentConfig.addClass("NonExisting.class").setEnabled(true);
clientConfig.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig);
try {
factory.newHazelcastClient(clientConfig);
} catch (HazelcastException e) {
throw e.getCause();
}
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentExceptionTest method testClientsWith_wrongJarPath.
@Test(expected = FileNotFoundException.class)
public void testClientsWith_wrongJarPath() throws Throwable {
Config config = createNodeConfig();
config.getUserCodeDeploymentConfig().setEnabled(true);
factory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
ClientUserCodeDeploymentConfig clientUserCodeDeploymentConfig = new ClientUserCodeDeploymentConfig();
clientUserCodeDeploymentConfig.addJar("NonExisting.jar").setEnabled(true);
clientConfig.setUserCodeDeploymentConfig(clientUserCodeDeploymentConfig);
try {
factory.newHazelcastClient(clientConfig);
} catch (HazelcastException e) {
throw e.getCause();
}
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentConfigTest method testConfigWithURLPath.
@Test
public void testConfigWithURLPath() throws ClassNotFoundException, IOException {
ClientUserCodeDeploymentConfig config = new ClientUserCodeDeploymentConfig();
config.setEnabled(true);
ClassLoader classLoader = getClass().getClassLoader();
URL resource = classLoader.getResource("IncrementingEntryProcessor.jar");
config.addJar(resource.toExternalForm());
ClientUserCodeDeploymentService service = new ClientUserCodeDeploymentService(config, classLoader);
service.start();
List<Map.Entry<String, byte[]>> list = service.getClassDefinitionList();
assertClassLoaded(list, "usercodedeployment.IncrementingEntryProcessor");
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentConfigTest method testConfigWithWrongJarPath.
@Test(expected = FileNotFoundException.class)
public void testConfigWithWrongJarPath() throws ClassNotFoundException, IOException {
ClientUserCodeDeploymentConfig config = new ClientUserCodeDeploymentConfig();
config.setEnabled(true);
ClassLoader classLoader = getClass().getClassLoader();
config.addJar("/wrongPath/IncrementingEntryProcessor.jar");
ClientUserCodeDeploymentService service = new ClientUserCodeDeploymentService(config, classLoader);
service.start();
}
use of com.hazelcast.client.config.ClientUserCodeDeploymentConfig in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentConfigTest method testConfigWithWrongClassName.
@Test(expected = ClassNotFoundException.class)
public void testConfigWithWrongClassName() throws ClassNotFoundException, IOException {
ClientUserCodeDeploymentConfig config = new ClientUserCodeDeploymentConfig();
config.setEnabled(true);
String className = "NonExistingClass";
config.addClass(className);
ClientUserCodeDeploymentService service = new ClientUserCodeDeploymentService(config, this.getClass().getClassLoader());
service.start();
}
Aggregations