Search in sources :

Example 1 with LoadPersonIsolatedMetaSupplier

use of com.hazelcast.jet.impl.deployment.LoadPersonIsolated.LoadPersonIsolatedMetaSupplier in project hazelcast-jet by hazelcast.

the class AbstractDeploymentTest method testDeployment_whenJarAddedAsResource_thenClassesAvailableOnClassLoader.

@Test
public void testDeployment_whenJarAddedAsResource_thenClassesAvailableOnClassLoader() throws Throwable {
    createCluster();
    DAG dag = new DAG();
    dag.newVertex("load class", new LoadPersonIsolatedMetaSupplier());
    JetInstance jetInstance = getJetInstance();
    JobConfig jobConfig = new JobConfig();
    jobConfig.addJar(this.getClass().getResource("/deployment/sample-pojo-1.0-person.jar"));
    executeAndPeel(jetInstance.newJob(dag, jobConfig));
}
Also used : JetInstance(com.hazelcast.jet.JetInstance) LoadPersonIsolatedMetaSupplier(com.hazelcast.jet.impl.deployment.LoadPersonIsolated.LoadPersonIsolatedMetaSupplier) DAG(com.hazelcast.jet.core.DAG) JobConfig(com.hazelcast.jet.config.JobConfig) Test(org.junit.Test)

Example 2 with LoadPersonIsolatedMetaSupplier

use of com.hazelcast.jet.impl.deployment.LoadPersonIsolated.LoadPersonIsolatedMetaSupplier in project hazelcast-jet by hazelcast.

the class AbstractDeploymentTest method testDeployment_whenClassAddedAsResource_thenClassAvailableOnClassLoader.

@Test
public void testDeployment_whenClassAddedAsResource_thenClassAvailableOnClassLoader() throws Throwable {
    createCluster();
    DAG dag = new DAG();
    dag.newVertex("create and print person", new LoadPersonIsolatedMetaSupplier());
    JobConfig jobConfig = new JobConfig();
    URL classUrl = this.getClass().getResource("/cp1/");
    URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { classUrl }, null);
    Class<?> appearance = urlClassLoader.loadClass("com.sample.pojo.person.Person$Appereance");
    jobConfig.addClass(appearance);
    executeAndPeel(getJetInstance().newJob(dag, jobConfig));
}
Also used : URLClassLoader(java.net.URLClassLoader) LoadPersonIsolatedMetaSupplier(com.hazelcast.jet.impl.deployment.LoadPersonIsolated.LoadPersonIsolatedMetaSupplier) DAG(com.hazelcast.jet.core.DAG) JobConfig(com.hazelcast.jet.config.JobConfig) URL(java.net.URL) Test(org.junit.Test)

Aggregations

JobConfig (com.hazelcast.jet.config.JobConfig)2 DAG (com.hazelcast.jet.core.DAG)2 LoadPersonIsolatedMetaSupplier (com.hazelcast.jet.impl.deployment.LoadPersonIsolated.LoadPersonIsolatedMetaSupplier)2 Test (org.junit.Test)2 JetInstance (com.hazelcast.jet.JetInstance)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1