use of com.hazelcast.internal.networking.nio.MigratablePipeline in project hazelcast by hazelcast.
the class MonkeyMigrationStrategyTest method imbalanceDetected_shouldReturnTrueWhenPipelineExist.
@Test
public void imbalanceDetected_shouldReturnTrueWhenPipelineExist() {
MigratablePipeline pipeline = mock(MigratablePipeline.class);
ownerPipelines.put(imbalance.srcOwner, setOf(pipeline));
boolean imbalanceDetected = strategy.imbalanceDetected(imbalance);
assertTrue(imbalanceDetected);
}
use of com.hazelcast.internal.networking.nio.MigratablePipeline in project hazelcast by hazelcast.
the class MonkeyMigrationStrategyTest method findPipelineToMigrate_shouldWorkEvenWithASinglePipelineAvailable.
@Test
public void findPipelineToMigrate_shouldWorkEvenWithASinglePipelineAvailable() {
MigratablePipeline pipeline = mock(MigratablePipeline.class);
ownerPipelines.put(imbalance.srcOwner, setOf(pipeline));
MigratablePipeline pipelineToMigrate = strategy.findPipelineToMigrate(imbalance);
assertEquals(pipeline, pipelineToMigrate);
}
use of com.hazelcast.internal.networking.nio.MigratablePipeline in project hazelcast by hazelcast.
the class IOBalancerTest method whenChannelRemoved_andDisabled_thenSkipTaskCreation.
// https://github.com/hazelcast/hazelcast/issues/11501
@Test
public void whenChannelRemoved_andDisabled_thenSkipTaskCreation() {
IOBalancer ioBalancer = new IOBalancer(new NioThread[1], new NioThread[1], "foo", 1, loggingService);
MigratablePipeline inboundPipeline = mock(MigratablePipeline.class);
MigratablePipeline outboundPipelines = mock(MigratablePipeline.class);
ioBalancer.channelRemoved(inboundPipeline, outboundPipelines);
assertTrue(ioBalancer.getWorkQueue().isEmpty());
}
use of com.hazelcast.internal.networking.nio.MigratablePipeline in project hazelcast by hazelcast.
the class LoadTrackerTest method testUpdateImbalance_notUsingSinglePipelineOwnerAsSource.
// there is no point in selecting a selector with a single handler as source.
@Test
public void testUpdateImbalance_notUsingSinglePipelineOwnerAsSource() throws Exception {
MigratablePipeline owmer1Pipeline1 = mock(MigratablePipeline.class);
// the first selector has a handler with a large number of events
when(owmer1Pipeline1.load()).thenReturn(10000L);
when(owmer1Pipeline1.owner()).thenReturn(owner1);
loadTracker.addPipeline(owmer1Pipeline1);
MigratablePipeline owner2Pipeline = mock(MigratablePipeline.class);
when(owner2Pipeline.load()).thenReturn(200L);
when(owner2Pipeline.owner()).thenReturn(owner2);
loadTracker.addPipeline(owner2Pipeline);
MigratablePipeline owner2Pipeline2 = mock(MigratablePipeline.class);
when(owner2Pipeline2.load()).thenReturn(200L);
when(owner2Pipeline2.owner()).thenReturn(owner2);
loadTracker.addPipeline(owner2Pipeline2);
LoadImbalance loadImbalance = loadTracker.updateImbalance();
assertEquals(400, loadImbalance.minimumLoad);
assertEquals(400, loadImbalance.maximumLoad);
assertEquals(owner2, loadImbalance.dstOwner);
assertEquals(owner2, loadImbalance.srcOwner);
}
Aggregations