Search in sources :

Example 6 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridJobStealingFailoverSpiOneNodeSelfTest method testFailover.

/**
     * @throws Exception If test failed.
     */
public void testFailover() throws Exception {
    ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
    GridTestJobResult failed = new GridTestJobResult(rmt);
    failed.getJobContext().setAttribute(JobStealingCollisionSpi.THIEF_NODE_ATTR, getSpiContext().localNode().id());
    ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), Collections.singletonList(getSpiContext().remoteNodes().iterator().next()));
    assert other == rmt : "Invalid failed-over node: " + other;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Example 7 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridAlwaysFailoverSpiSelfTest method testSingleNode.

/**
     * @throws Exception If failed.
     */
public void testSingleNode() throws Exception {
    AlwaysFailoverSpi spi = getSpi();
    List<ClusterNode> nodes = new ArrayList<>();
    ClusterNode node = new GridTestNode(UUID.randomUUID());
    nodes.add(node);
    node = spi.failover(new GridFailoverTestContext(new GridTestTaskSession(), new GridTestJobResult(node)), nodes);
    assert node == null;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) ArrayList(java.util.ArrayList) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridTestNode(org.apache.ignite.testframework.GridTestNode) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Example 8 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridJobStealingFailoverSpiOneNodeSelfTest method testNoFailover.

/**
     * @throws Exception If test failed.
     */
public void testNoFailover() throws Exception {
    ClusterNode rmt = getSpiContext().remoteNodes().iterator().next();
    GridTestJobResult failed = new GridTestJobResult(rmt);
    ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), Collections.singletonList(getSpiContext().remoteNodes().iterator().next()));
    assert other == null;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Example 9 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridNeverFailoverSpiSelfTest method testAlwaysNull.

/**
     * @throws Exception If failed.
     */
public void testAlwaysNull() throws Exception {
    List<ClusterNode> nodes = new ArrayList<>();
    ClusterNode node = new GridTestNode(UUID.randomUUID());
    nodes.add(node);
    assert getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), new GridTestJobResult(node)), nodes) == null;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) ArrayList(java.util.ArrayList) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridTestNode(org.apache.ignite.testframework.GridTestNode) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Example 10 with GridTestJobResult

use of org.apache.ignite.GridTestJobResult in project ignite by apache.

the class GridJobStealingFailoverSpiSelfTest method testThiefNotInTopology.

/**
     * @throws Exception If test failed.
     */
public void testThiefNotInTopology() throws Exception {
    ClusterNode rmt = new GridTestNode(UUID.randomUUID());
    GridTestJobResult failed = new GridTestJobResult(rmt);
    failed.getJobContext().setAttribute(THIEF_NODE_ATTR, rmt.id());
    ClusterNode other = getSpi().failover(new GridFailoverTestContext(new GridTestTaskSession(), failed), new ArrayList<>(getSpiContext().nodes()));
    assert other != null;
    assert other != rmt;
    assert getSpiContext().nodes().contains(other);
    checkAttributes(failed.getJobContext(), rmt, 1);
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) GridTestTaskSession(org.apache.ignite.GridTestTaskSession) GridTestJobResult(org.apache.ignite.GridTestJobResult) GridTestNode(org.apache.ignite.testframework.GridTestNode) GridFailoverTestContext(org.apache.ignite.spi.failover.GridFailoverTestContext)

Aggregations

GridTestJobResult (org.apache.ignite.GridTestJobResult)13 GridTestTaskSession (org.apache.ignite.GridTestTaskSession)13 ClusterNode (org.apache.ignite.cluster.ClusterNode)13 GridFailoverTestContext (org.apache.ignite.spi.failover.GridFailoverTestContext)13 GridTestNode (org.apache.ignite.testframework.GridTestNode)5 ArrayList (java.util.ArrayList)4 ComputeJobResult (org.apache.ignite.compute.ComputeJobResult)2