use of com.alibaba.nacos.naming.core.v2.upgrade.UpgradeJudgement 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);
}
use of com.alibaba.nacos.naming.core.v2.upgrade.UpgradeJudgement in project nacos by alibaba.
the class NamingSubscriberServiceV2ImplTest method setUp.
@Before
public void setUp() throws Exception {
subscriberService = new NamingSubscriberServiceV2Impl(clientManager, indexesManager, null, null, null, upgradeJudgement, switchDomain);
ReflectionTestUtils.setField(subscriberService, "delayTaskEngine", delayTaskEngine);
when(indexesManager.getAllClientsSubscribeService(service)).thenReturn(Collections.singletonList(testClientId));
when(indexesManager.getAllClientsSubscribeService(service1)).thenReturn(Collections.singletonList(testClientId));
Collection<Service> services = new LinkedList<>();
services.add(service);
services.add(service1);
when(indexesManager.getSubscribedService()).thenReturn(services);
when(clientManager.getClient(testClientId)).thenReturn(client);
when(client.getSubscriber(service)).thenReturn(new Subscriber("1.1.1.1:1111", "Test", "unknown", "1.1.1.1", "N", service.getGroupedServiceName(), 0));
when(client.getSubscriber(service1)).thenReturn(new Subscriber("1.1.1.1:1111", "Test", "unknown", "1.1.1.1", "N", service1.getGroupedServiceName(), 0));
when(upgradeJudgement.isUseGrpcFeatures()).thenReturn(true);
}
Aggregations