Search in sources :

Example 1 with ClientBeatCheckTaskV2

use of com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatCheckTaskV2 in project nacos by alibaba.

the class HealthCheckTaskInterceptWrapperTest method setUp.

@Before
public void setUp() throws Exception {
    when(applicationContext.getBean(NamingMetadataManager.class)).thenReturn(namingMetadataManager);
    when(applicationContext.getBean(GlobalConfig.class)).thenReturn(globalConfig);
    when(applicationContext.getBean(SwitchDomain.class)).thenReturn(switchDomain);
    when(applicationContext.getBean(DistroMapper.class)).thenReturn(distroMapper);
    when(applicationContext.getBean(UpgradeJudgement.class)).thenReturn(upgradeJudgement);
    ApplicationUtils.injectContext(applicationContext);
    client = new IpPortBasedClient(CLIENT_ID, true);
    when(switchDomain.isHealthCheckEnabled()).thenReturn(true);
    when(distroMapper.responsible(client.getResponsibleId())).thenReturn(true);
    when(upgradeJudgement.isUseGrpcFeatures()).thenReturn(true);
    ClientBeatCheckTaskV2 beatCheckTask = new ClientBeatCheckTaskV2(client);
    taskWrapper = new HealthCheckTaskInterceptWrapper(beatCheckTask);
}
Also used : ClientBeatCheckTaskV2(com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatCheckTaskV2) IpPortBasedClient(com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient) Before(org.junit.Before)

Example 2 with ClientBeatCheckTaskV2

use of com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatCheckTaskV2 in project nacos by alibaba.

the class IpPortBasedClient method init.

/**
 * Init client.
 */
public void init() {
    if (ephemeral) {
        beatCheckTask = new ClientBeatCheckTaskV2(this);
        HealthCheckReactor.scheduleCheck(beatCheckTask);
    } else {
        healthCheckTaskV2 = new HealthCheckTaskV2(this);
        HealthCheckReactor.scheduleCheck(healthCheckTaskV2);
    }
}
Also used : ClientBeatCheckTaskV2(com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatCheckTaskV2) HealthCheckTaskV2(com.alibaba.nacos.naming.healthcheck.v2.HealthCheckTaskV2)

Aggregations

ClientBeatCheckTaskV2 (com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatCheckTaskV2)2 IpPortBasedClient (com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient)1 HealthCheckTaskV2 (com.alibaba.nacos.naming.healthcheck.v2.HealthCheckTaskV2)1 Before (org.junit.Before)1