Search in sources :

Example 11 with IpPortBasedClient

use of com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient in project nacos by alibaba.

the class ClientBeatCheckTaskV2Test 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(DistroMapper.class)).thenReturn(distroMapper);
    when(distroMapper.responsible(anyString())).thenReturn(true);
    ApplicationUtils.injectContext(applicationContext);
    client = new IpPortBasedClient(CLIENT_ID, true);
    beatCheckTask = new ClientBeatCheckTaskV2(client);
}
Also used : IpPortBasedClient(com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient) Before(org.junit.Before)

Example 12 with IpPortBasedClient

use of com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient in project nacos by alibaba.

the class HealthCheckTaskV2Test method setUp.

@Before
public void setUp() {
    ApplicationUtils.injectContext(context);
    when(ApplicationUtils.getBean(SwitchDomain.class)).thenReturn(switchDomain);
    when(switchDomain.getTcpHealthParams()).thenReturn(new SwitchDomain.TcpHealthParams());
    when(ApplicationUtils.getBean(NamingMetadataManager.class)).thenReturn(new NamingMetadataManager());
    healthCheckTaskV2 = new HealthCheckTaskV2(ipPortBasedClient);
}
Also used : SwitchDomain(com.alibaba.nacos.naming.misc.SwitchDomain) NamingMetadataManager(com.alibaba.nacos.naming.core.v2.metadata.NamingMetadataManager) Before(org.junit.Before)

Example 13 with IpPortBasedClient

use of com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient in project nacos by alibaba.

the class HealthCheckProcessorV2DelegateTest method testProcess.

@Test
public void testProcess() throws NoSuchFieldException, IllegalAccessException {
    testAddProcessor();
    when(clusterMetadata.getHealthyCheckType()).thenReturn(HealthCheckType.TCP.name());
    when(healthCheckTaskV2.getClient()).thenReturn(new IpPortBasedClient("127.0.0.1:80#true", true));
    healthCheckProcessorV2Delegate.process(healthCheckTaskV2, service, clusterMetadata);
    verify(clusterMetadata).getHealthyCheckType();
    verify(healthCheckTaskV2).getClient();
}
Also used : IpPortBasedClient(com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient) Test(org.junit.Test)

Example 14 with IpPortBasedClient

use of com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient in project nacos by alibaba.

the class IpPortBasedClientTest method setUp.

@Before
public void setUp() throws Exception {
    ipPortBasedClient = new IpPortBasedClient(clientId, true);
    ipPortBasedClient.init();
    instancePublishInfo = new InstancePublishInfo();
}
Also used : InstancePublishInfo(com.alibaba.nacos.naming.core.v2.pojo.InstancePublishInfo) Before(org.junit.Before)

Aggregations

IpPortBasedClient (com.alibaba.nacos.naming.core.v2.client.impl.IpPortBasedClient)11 Before (org.junit.Before)5 Service (com.alibaba.nacos.naming.core.v2.pojo.Service)3 Test (org.junit.Test)3 Instance (com.alibaba.nacos.api.naming.pojo.Instance)2 ClientEvent (com.alibaba.nacos.naming.core.v2.event.client.ClientEvent)2 NamingMetadataOperateService (com.alibaba.nacos.naming.core.v2.metadata.NamingMetadataOperateService)2 ClientOperationService (com.alibaba.nacos.naming.core.v2.service.ClientOperationService)2 RsInfo (com.alibaba.nacos.naming.healthcheck.RsInfo)2 UdpPushService (com.alibaba.nacos.naming.push.UdpPushService)2 NacosException (com.alibaba.nacos.api.exception.NacosException)1 Response (com.alibaba.nacos.consistency.entity.Response)1 WriteRequest (com.alibaba.nacos.consistency.entity.WriteRequest)1 NamingMetadataManager (com.alibaba.nacos.naming.core.v2.metadata.NamingMetadataManager)1 InstancePublishInfo (com.alibaba.nacos.naming.core.v2.pojo.InstancePublishInfo)1 ClientBeatCheckTaskV2 (com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatCheckTaskV2)1 ClientBeatProcessorV2 (com.alibaba.nacos.naming.healthcheck.heartbeat.ClientBeatProcessorV2)1 SwitchDomain (com.alibaba.nacos.naming.misc.SwitchDomain)1