use of org.apache.ignite.spi.collision.GridCollisionTestContext in project ignite by apache.
the class GridFifoQueueCollisionSpiSelfTest method testCollision3.
/**
* @throws Exception If failed.
*/
@Test
public void testCollision3() throws Exception {
getSpi().setParallelJobsNumber(15);
GridCollisionTestContext cntx = createContext(10, 10);
Collection<CollisionJobContext> activeJobs = cntx.activeJobs();
Collection<CollisionJobContext> passiveJobs = cntx.waitingJobs();
getSpi().onCollision(new GridCollisionTestContext(activeJobs, passiveJobs));
int i = 0;
for (CollisionJobContext ctx : activeJobs) {
if (i++ < 10)
assert !((GridTestCollisionJobContext) ctx).isActivated();
else
assert ((GridTestCollisionJobContext) ctx).isActivated();
assert !((GridTestCollisionJobContext) ctx).isCanceled();
}
for (CollisionJobContext ctx : passiveJobs) {
if (((GridTestCollisionJobContext) ctx).getIndex() < 5) {
assert ((GridTestCollisionJobContext) ctx).isActivated();
assert !((GridTestCollisionJobContext) ctx).isCanceled();
} else {
assert !((GridTestCollisionJobContext) ctx).isActivated();
assert !((GridTestCollisionJobContext) ctx).isCanceled();
}
}
}
use of org.apache.ignite.spi.collision.GridCollisionTestContext in project ignite by apache.
the class GridFifoQueueCollisionSpiSelfTest method testCollision2.
/**
* @throws Exception If failed.
*/
@Test
public void testCollision2() throws Exception {
getSpi().setParallelJobsNumber(3);
GridCollisionTestContext cntx = createContext(11, 0);
Collection<CollisionJobContext> activeJobs = cntx.activeJobs();
Collection<CollisionJobContext> passiveJobs = cntx.waitingJobs();
getSpi().onCollision(new GridCollisionTestContext(activeJobs, passiveJobs));
for (CollisionJobContext ctx : activeJobs) {
assert !((GridTestCollisionJobContext) ctx).isActivated();
assert !((GridTestCollisionJobContext) ctx).isCanceled();
}
assert passiveJobs.isEmpty();
}
Aggregations