use of com.hazelcast.internal.networking.nio.NioThread in project hazelcast by hazelcast.
the class LoadMigrationStrategyTest method testFindPipelineToMigrate.
@Test
public void testFindPipelineToMigrate() throws Exception {
NioThread srcOwner = mock(NioThread.class);
NioThread dstOwner = mock(NioThread.class);
imbalance.srcOwner = srcOwner;
imbalance.dstOwner = dstOwner;
imbalance.minimumLoad = 100;
MigratablePipeline pipeline1 = mock(MigratablePipeline.class);
loadCounter.set(pipeline1, 100L);
ownerToPipelines.put(dstOwner, singleton(pipeline1));
imbalance.maximumLoad = 300;
MigratablePipeline pipeline2 = mock(MigratablePipeline.class);
MigratablePipeline pipeline3 = mock(MigratablePipeline.class);
loadCounter.set(pipeline2, 200L);
loadCounter.set(pipeline3, 100L);
ownerToPipelines.put(srcOwner, setOf(pipeline2, pipeline3));
MigratablePipeline pipelineToMigrate = strategy.findPipelineToMigrate(imbalance);
assertEquals(pipeline3, pipelineToMigrate);
}
Aggregations