use of com.hazelcast.jet.config.ResourceConfig in project hazelcast-jet by hazelcast.
the class ResourceConfigTest method testAddResource_with_Url_and_ResourceName.
@Test
public void testAddResource_with_Url_and_ResourceName() throws Exception {
JobConfig config = new JobConfig();
String resourceName = "resourceFileName";
String urlString = "file://path/to/resourceFile";
config.addResource(new URL(urlString), resourceName);
ResourceConfig resourceConfig = config.getResourceConfigs().iterator().next();
assertEquals(resourceName, resourceConfig.getId());
assertFalse(resourceConfig.isArchive());
assertEquals(urlString, resourceConfig.getUrl().toString());
}
use of com.hazelcast.jet.config.ResourceConfig in project hazelcast-jet by hazelcast.
the class ResourceConfigTest method testAddResource_with_Url.
@Test
public void testAddResource_with_Url() throws Exception {
JobConfig config = new JobConfig();
String urlString = "file://path/to/resourceFile";
config.addResource(new URL(urlString));
ResourceConfig resourceConfig = config.getResourceConfigs().iterator().next();
assertEquals("resourceFile", resourceConfig.getId());
assertFalse(resourceConfig.isArchive());
assertEquals(urlString, resourceConfig.getUrl().toString());
}
use of com.hazelcast.jet.config.ResourceConfig in project hazelcast-jet by hazelcast.
the class ResourceConfigTest method testAddResource_with_Path.
@Test
public void testAddResource_with_Path() throws Exception {
JobConfig config = new JobConfig();
String path = "/path/to/resource";
config.addResource(path);
ResourceConfig resourceConfig = config.getResourceConfigs().iterator().next();
assertEquals("resource", resourceConfig.getId());
assertFalse(resourceConfig.isArchive());
assertEquals(new File(path).toURI().toURL(), resourceConfig.getUrl());
}
use of com.hazelcast.jet.config.ResourceConfig in project hazelcast-jet by hazelcast.
the class ResourceConfigTest method testAddClass_with_Class.
@Test
public void testAddClass_with_Class() throws Exception {
JobConfig config = new JobConfig();
config.addClass(this.getClass());
ResourceConfig resourceConfig = config.getResourceConfigs().iterator().next();
assertEquals(this.getClass().getName().replace('.', '/') + ".class", resourceConfig.getId());
assertFalse(resourceConfig.isArchive());
}
use of com.hazelcast.jet.config.ResourceConfig in project hazelcast-jet by hazelcast.
the class ResourceConfigTest method testAddJar_with_File.
@Test
public void testAddJar_with_File() throws Exception {
JobConfig config = new JobConfig();
File file = new File("/path/to/jarfile");
config.addJar(file);
ResourceConfig resourceConfig = config.getResourceConfigs().iterator().next();
assertNull(resourceConfig.getId());
assertTrue(resourceConfig.isArchive());
assertEquals(file.toURI().toURL(), resourceConfig.getUrl());
}
Aggregations