Search in sources :

Example 1 with LocalDeploymentSpi

use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.

the class ExternalNonSpringAopSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    cfg.setDeploymentSpi(new LocalDeploymentSpi());
    cfg.setMetricsUpdateFrequency(500);
    cfg.setDeploymentMode(depMode);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) LocalDeploymentSpi(org.apache.ignite.spi.deployment.local.LocalDeploymentSpi)

Example 2 with LocalDeploymentSpi

use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.

the class AbstractAopTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setDeploymentSpi(new LocalDeploymentSpi());
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    cfg.setMetricsUpdateFrequency(500);
    cfg.setDeploymentMode(depMode);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) LocalDeploymentSpi(org.apache.ignite.spi.deployment.local.LocalDeploymentSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 3 with LocalDeploymentSpi

use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.

the class GridP2PUndeploySelfTest method processTestUndeployLocalTasks.

/**
     * @param depMode deployment mode.
     * @throws Exception If failed.
     */
@SuppressWarnings("unchecked")
private void processTestUndeployLocalTasks(DeploymentMode depMode) throws Exception {
    try {
        this.depMode = depMode;
        Ignite ignite1 = startGrid(1);
        Ignite ignite2 = startGrid(2);
        ClassLoader tstClsLdr = new GridTestClassLoader(GridP2PTestTask.class.getName(), GridP2PTestJob.class.getName());
        Class<? extends ComputeTask<?, ?>> task1 = (Class<? extends ComputeTask<?, ?>>) tstClsLdr.loadClass(GridP2PTestTask.class.getName());
        ignite1.compute().localDeployTask(task1, tstClsLdr);
        ignite1.compute().execute(task1.getName(), 1);
        ignite2.compute().localDeployTask(task1, tstClsLdr);
        ignite2.compute().execute(task1.getName(), 2);
        LocalDeploymentSpi spi1 = spis.get(ignite1.name());
        LocalDeploymentSpi spi2 = spis.get(ignite2.name());
        assert spi1.findResource(task1.getName()) != null;
        assert spi2.findResource(task1.getName()) != null;
        assert ignite1.compute().localTasks().containsKey(task1.getName());
        assert ignite2.compute().localTasks().containsKey(task1.getName());
        ignite2.compute().undeployTask(task1.getName());
        // Wait for undeploy.
        Thread.sleep(1000);
        assert spi1.findResource(task1.getName()) == null;
        assert spi2.findResource(task1.getName()) == null;
        assert !ignite1.compute().localTasks().containsKey(task1.getName());
        assert !ignite2.compute().localTasks().containsKey(task1.getName());
    } finally {
        stopGrid(2);
        stopGrid(1);
    }
}
Also used : ComputeTask(org.apache.ignite.compute.ComputeTask) GridTestClassLoader(org.apache.ignite.testframework.GridTestClassLoader) GridTestClassLoader(org.apache.ignite.testframework.GridTestClassLoader) URLClassLoader(java.net.URLClassLoader) Ignite(org.apache.ignite.Ignite) LocalDeploymentSpi(org.apache.ignite.spi.deployment.local.LocalDeploymentSpi)

Example 4 with LocalDeploymentSpi

use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.

the class GridP2PUndeploySelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName, IgniteTestResources rsrcs) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName, rsrcs);
    LocalDeploymentSpi spi = new LocalDeploymentSpi();
    spis.put(igniteInstanceName, spi);
    cfg.setDeploymentSpi(spi);
    cfg.setDeploymentMode(depMode);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) LocalDeploymentSpi(org.apache.ignite.spi.deployment.local.LocalDeploymentSpi)

Example 5 with LocalDeploymentSpi

use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.

the class GridP2PUndeploySelfTest method processTestUndeployP2PTasks.

/**
     * @param depMode deployment mode.
     * @throws Exception If failed.
     */
@SuppressWarnings("unchecked")
private void processTestUndeployP2PTasks(DeploymentMode depMode) throws Exception {
    try {
        this.depMode = depMode;
        Ignite ignite1 = startGrid(1);
        Ignite ignite2 = startGrid(2);
        ClassLoader ldr = new URLClassLoader(new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) }, GridP2PSameClassLoaderSelfTest.class.getClassLoader());
        Class<? extends ComputeTask<?, ?>> task1 = (Class<? extends ComputeTask<?, ?>>) ldr.loadClass(TEST_TASK_NAME);
        ignite1.compute().localDeployTask(task1, ldr);
        ignite1.compute().execute(task1.getName(), ignite2.cluster().localNode().id());
        LocalDeploymentSpi spi1 = spis.get(ignite1.name());
        LocalDeploymentSpi spi2 = spis.get(ignite2.name());
        assert spi1.findResource(task1.getName()) != null;
        assert ignite1.compute().localTasks().containsKey(task1.getName());
        // P2P deployment will not deploy task into the SPI.
        assert spi2.findResource(task1.getName()) == null;
        ignite1.compute().undeployTask(task1.getName());
        // Wait for undeploy.
        Thread.sleep(1000);
        assert spi1.findResource(task1.getName()) == null;
        assert spi2.findResource(task1.getName()) == null;
        assert !ignite1.compute().localTasks().containsKey(task1.getName());
        assert !ignite2.compute().localTasks().containsKey(task1.getName());
        spis = null;
    } finally {
        stopGrid(2);
        stopGrid(1);
    }
}
Also used : URLClassLoader(java.net.URLClassLoader) ComputeTask(org.apache.ignite.compute.ComputeTask) GridTestClassLoader(org.apache.ignite.testframework.GridTestClassLoader) URLClassLoader(java.net.URLClassLoader) Ignite(org.apache.ignite.Ignite) LocalDeploymentSpi(org.apache.ignite.spi.deployment.local.LocalDeploymentSpi) URL(java.net.URL)

Aggregations

LocalDeploymentSpi (org.apache.ignite.spi.deployment.local.LocalDeploymentSpi)6 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)3 URLClassLoader (java.net.URLClassLoader)2 Ignite (org.apache.ignite.Ignite)2 ComputeTask (org.apache.ignite.compute.ComputeTask)2 GridTestClassLoader (org.apache.ignite.testframework.GridTestClassLoader)2 URL (java.net.URL)1 GridDeploymentManager (org.apache.ignite.internal.managers.deployment.GridDeploymentManager)1 DeploymentSpi (org.apache.ignite.spi.deployment.DeploymentSpi)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1