Examples of GridAlwaysFailoverSpi


Examples of org.gridgain.grid.spi.failover.always.GridAlwaysFailoverSpi

public class GridAlwaysFailoverSpiSelfTest extends GridSpiAbstractTest<GridAlwaysFailoverSpi> {
    /**
     * @throws Exception If failed.
     */
    public void testSingleNode() throws Exception {
        GridAlwaysFailoverSpi spi = getSpi();

        List<GridNode> nodes = new ArrayList<>();

        GridNode node = new GridTestNode(UUID.randomUUID());

        nodes.add(node);

        node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), new GridTestJobResult(node)), nodes);

        assert node == null;
    }
View Full Code Here

Examples of org.gridgain.grid.spi.failover.always.GridAlwaysFailoverSpi

    /**
     * @throws Exception If test failed.
     */
    @SuppressWarnings("unchecked")
    public void testTwoNodes() throws Exception {
        GridAlwaysFailoverSpi spi = getSpi();

        List<GridNode> nodes = new ArrayList<>();

        nodes.add(new GridTestNode(UUID.randomUUID()));
        nodes.add(new GridTestNode(UUID.randomUUID()));

        GridComputeJobResult jobRes = new GridTestJobResult(nodes.get(0));

        GridNode node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), jobRes), nodes);

        assert node != null;
        assert node.equals(nodes.get(1));

        checkFailedNodes(jobRes, 1);
View Full Code Here

Examples of org.gridgain.grid.spi.failover.always.GridAlwaysFailoverSpi

    /**
     * @throws Exception If failed.
     */
    public void testMaxAttempts() throws Exception {
        GridAlwaysFailoverSpi spi = getSpi();

        spi.setMaximumFailoverAttempts(1);

        List<GridNode> nodes = new ArrayList<>();

        nodes.add(new GridTestNode(UUID.randomUUID()));
        nodes.add(new GridTestNode(UUID.randomUUID()));

        GridComputeJobResult jobRes = new GridTestJobResult(nodes.get(0));

        // First attempt.
        GridNode node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), jobRes), nodes);

        assert node != null;
        assert node.equals(nodes.get(1));

        checkFailedNodes(jobRes, 1);

        // Second attempt (exceeds default max attempts of 1).
        node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), jobRes), nodes);

        assert node == null;

        checkFailedNodes(jobRes, 1);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.