Search in sources :

Example 11 with NioThread

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);
}
Also used : NioThread(com.hazelcast.internal.networking.nio.NioThread) MigratablePipeline(com.hazelcast.internal.networking.nio.MigratablePipeline) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

NioThread (com.hazelcast.internal.networking.nio.NioThread)11 MigratablePipeline (com.hazelcast.internal.networking.nio.MigratablePipeline)4 IMap (com.hazelcast.map.IMap)3 Map (java.util.Map)3 Collectors.toMap (java.util.stream.Collectors.toMap)3 Test (org.junit.Test)2 Config (com.hazelcast.config.Config)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 NioChannel (com.hazelcast.internal.networking.nio.NioChannel)1 NioInboundPipeline (com.hazelcast.internal.networking.nio.NioInboundPipeline)1 NioNetworking (com.hazelcast.internal.networking.nio.NioNetworking)1 NioOutboundPipeline (com.hazelcast.internal.networking.nio.NioOutboundPipeline)1 ServerConnection (com.hazelcast.internal.server.ServerConnection)1 ServerConnectionManager (com.hazelcast.internal.server.ServerConnectionManager)1 TcpServer (com.hazelcast.internal.server.tcp.TcpServer)1 TcpServerConnection (com.hazelcast.internal.server.tcp.TcpServerConnection)1 ILogger (com.hazelcast.logging.ILogger)1 NightlyTest (com.hazelcast.test.annotation.NightlyTest)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1