use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.
the class GridLocalDeploymentSpiSelfTest method testDeploy.
/**
* @throws Exception If failed.
*/
@SuppressWarnings({ "TooBroadScope" })
@Test
public void testDeploy() throws Exception {
String taskName = "GridDeploymentTestTask";
Class<? extends ComputeTask<?, ?>> task = GridDeploymentTestTask.class;
deploy(task);
checkResourceRegisteredInSpi(task.getClassLoader(), taskName, getSpi(), true);
Map<String, String> rcsMap = new HashMap<>(2);
rcsMap.put(taskName, task.getName());
rcsMap.put(task.getName(), task.getName());
// Note we use task name instead of class name.
DeploymentResource t1 = U.invoke(getSpi().getClass(), getSpi(), "findResource0", rcsMap, taskName, task.getClassLoader());
assertNotNull(t1);
assertSame(t1.getResourceClass(), task);
assertEquals(t1.getName(), taskName);
getSpi().unregister(taskName);
checkUndeployed(task);
checkResourceRegisteredInSpi(task.getClassLoader(), taskName, getSpi(), false);
checkResourceRegisteredInSpi(task.getClassLoader(), task.getName(), getSpi(), false);
}
use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.
the class GridUriDeploymentAbstractSelfTest method checkTask.
/**
* @param taskName Name of available task.
* @throws Exception if failed.
*/
protected void checkTask(String taskName) throws Exception {
assert taskName != null;
DeploymentResource task = getSpi().findResource(taskName);
assert task != null;
info("Deployed task [task=" + task + ']');
}
use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.
the class GridUriDeploymentMd5CheckSelfTest method testMd5DirectoryCheck.
/**
* Test skipping fresh deployment of .gar directories with equal content.
*
* @throws Exception if failed.
*/
@Test
public void testMd5DirectoryCheck() throws Exception {
undeployCntr.set(0);
String taskName = "GridUriDeploymentTestWithNameTask6";
DeploymentResource task = getSpi().findResource(taskName);
assert task == null;
atomicCopy(getGarDir(), getDeployDir(), "uri1.gar");
waitForTask(taskName, true, 10000);
assert undeployCntr.get() == 0;
atomicCopy(getGarDir(), getDeployDir(), "uri2.gar");
waitForTask(taskName, true, 10000);
assert undeployCntr.get() == 0;
}
use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.
the class GridUriDeploymentMd5CheckSelfTest method testMd5FileCheck.
/**
* Test skipping fresh deployment of duplicated .gar files.
*
* @throws Exception if failed.
*/
@Test
public void testMd5FileCheck() throws Exception {
undeployCntr.set(0);
String taskName = "GridUriDeploymentTestWithNameTask7";
DeploymentResource task = getSpi().findResource(taskName);
assert task == null;
atomicCopy(getGarFile(), getDeployDir(), "uri1.gar");
waitForTask(taskName, true, 10000);
assert undeployCntr.get() == 0;
atomicCopy(getGarFile(), getDeployDir(), "uri2.gar");
waitForTask(taskName, true, 10000);
assert undeployCntr.get() == 0;
}
use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.
the class GridUriDeploymentClassloaderRegisterSelfTest method testDeploy.
/**
* @throws Exception If failed.
*/
@Test
public void testDeploy() throws Exception {
Class<? extends ComputeTask<?, ?>> task = GridFileDeploymentTestTask.class;
deploy(task);
DeploymentResource t1 = getSpi().findResource(task.getName());
assert t1 != null;
DeploymentResource t2 = getSpi().findResource(task.getName());
assert t1.equals(t2);
assert t1.getResourceClass() == t2.getResourceClass();
getSpi().unregister(task.getName());
checkUndeployed(task);
assert getSpi().findResource(task.getName()) == null;
}
Aggregations