Search in sources :

Example 6 with DeploymentResource

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.
     */
public void testMd5DirectoryCheck() throws Exception {
    undeployCntr.set(0);
    DeploymentResource task = getSpi().findResource("GridUriDeploymentTestWithNameTask6");
    assert task == null;
    U.copy(getGarDir(), new File(getDeployDir(), "uri1.gar"), true);
    Thread.sleep(500);
    task = getSpi().findResource("GridUriDeploymentTestWithNameTask6");
    assert task != null;
    assert undeployCntr.get() == 0;
    U.copy(getGarDir(), new File(getDeployDir(), "uri2.gar"), true);
    Thread.sleep(500);
    task = getSpi().findResource("GridUriDeploymentTestWithNameTask6");
    assert task != null;
    assert undeployCntr.get() == 0;
    U.delete(getGarDir());
    U.delete(new File(getDeployDir(), "uri1.gar"));
    U.delete(new File(getDeployDir(), "uri2.gar"));
}
Also used : DeploymentResource(org.apache.ignite.spi.deployment.DeploymentResource) File(java.io.File)

Example 7 with DeploymentResource

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.
     */
public void testMd5FileCheck() throws Exception {
    undeployCntr.set(0);
    DeploymentResource task = getSpi().findResource("GridUriDeploymentTestWithNameTask7");
    assert task == null;
    U.copy(getGarFile(), new File(getDeployDir(), "uri1.gar"), true);
    Thread.sleep(500);
    task = getSpi().findResource("GridUriDeploymentTestWithNameTask7");
    assert task != null;
    assert undeployCntr.get() == 0;
    U.copy(getGarFile(), new File(getDeployDir(), "uri2.gar"), true);
    Thread.sleep(500);
    task = getSpi().findResource("GridUriDeploymentTestWithNameTask7");
    assert task != null;
    assert undeployCntr.get() == 0;
}
Also used : DeploymentResource(org.apache.ignite.spi.deployment.DeploymentResource) File(java.io.File)

Example 8 with DeploymentResource

use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.

the class GridUriDeploymentSimpleSelfTest method testSimpleDeployTwoTasks.

/**
     * @throws Exception If failed.
     */
public void testSimpleDeployTwoTasks() throws Exception {
    UriDeploymentSpi spi = getSpi();
    spi.register(TestTask.class.getClassLoader(), TestTask.class);
    spi.register(TestTaskWithName.class.getClassLoader(), TestTaskWithName.class);
    DeploymentResource task1 = spi.findResource("TestTaskWithName");
    DeploymentResource task2 = spi.findResource(TestTask.class.getName());
    assert task1 != null;
    assert task1.getResourceClass() == TestTaskWithName.class;
    assert spi.findResource(TestTaskWithName.class.getName()) != null;
    assert task2 != null;
    assert task2.getResourceClass() == TestTask.class;
    assert spi.findResource("TestTask") == null;
    spi.unregister("TestTaskWithName");
    assert spi.findResource("TestTaskWithName") == null;
    spi.unregister(TestTask.class.getName());
    assert spi.findResource(TestTask.class.getName()) == null;
}
Also used : DeploymentResource(org.apache.ignite.spi.deployment.DeploymentResource)

Example 9 with DeploymentResource

use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.

the class GridUriDeploymentAbstractSelfTest method checkNoTask.

/**
     * @param taskName name of unavailable task.
     * @throws Exception if failed.
     */
protected void checkNoTask(String taskName) throws Exception {
    assert taskName != null;
    DeploymentResource task = getSpi().findResource(taskName);
    assert task == null;
    info("Not deployed task [task=" + task + ']');
}
Also used : DeploymentResource(org.apache.ignite.spi.deployment.DeploymentResource)

Example 10 with DeploymentResource

use of org.apache.ignite.spi.deployment.DeploymentResource in project ignite by apache.

the class GridUriDeploymentSimpleSelfTest method testSimpleDeploy.

/**
     * @throws Exception If failed.
     */
public void testSimpleDeploy() throws Exception {
    UriDeploymentSpi spi = getSpi();
    spi.register(TestTask.class.getClassLoader(), TestTask.class);
    DeploymentResource task = spi.findResource(TestTask.class.getName());
    assert task != null;
    assert task.getResourceClass() == TestTask.class;
    assert spi.findResource("TestTaskWithName") == null;
    spi.unregister(TestTask.class.getName());
    assert spi.findResource(TestTask.class.getName()) == null;
}
Also used : DeploymentResource(org.apache.ignite.spi.deployment.DeploymentResource)

Aggregations

DeploymentResource (org.apache.ignite.spi.deployment.DeploymentResource)11 File (java.io.File)2 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)2 Nullable (org.jetbrains.annotations.Nullable)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteDeploymentCheckedException (org.apache.ignite.internal.IgniteDeploymentCheckedException)1