use of com.hazelcast.client.impl.spi.impl.ClientUserCodeDeploymentService in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentConfigTest method testConfigWithJarPath.
@Test
public void testConfigWithJarPath() throws ClassNotFoundException, IOException {
ClientUserCodeDeploymentConfig config = new ClientUserCodeDeploymentConfig();
config.setEnabled(true);
ClassLoader classLoader = getClass().getClassLoader();
config.addJar("IncrementingEntryProcessor.jar");
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.impl.spi.impl.ClientUserCodeDeploymentService in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentConfigTest method testConfigWithJarPaths.
@Test
public void testConfigWithJarPaths() throws ClassNotFoundException, IOException {
ClientUserCodeDeploymentConfig config = new ClientUserCodeDeploymentConfig();
config.setEnabled(true);
ClassLoader classLoader = getClass().getClassLoader();
config.setJarPaths(Collections.singletonList("IncrementingEntryProcessor.jar"));
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.impl.spi.impl.ClientUserCodeDeploymentService 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.impl.spi.impl.ClientUserCodeDeploymentService 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.impl.spi.impl.ClientUserCodeDeploymentService 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