Search in sources :

Example 71 with ServiceInfo

use of com.alibaba.nacos.api.naming.pojo.ServiceInfo in project nacos by alibaba.

the class PushExecutorRpcImplTest method setUp.

@Before
public void setUp() throws Exception {
    serviceMetadata = new ServiceMetadata();
    pushData = new PushDataWrapper(serviceMetadata, new ServiceInfo("G@@S"));
    pushExecutor = new PushExecutorRpcImpl(pushService);
    doAnswer(new CallbackAnswer()).when(pushService).pushWithCallback(eq(rpcClientId), any(NotifySubscriberRequest.class), eq(pushCallBack), eq(GlobalExecutor.getCallbackExecutor()));
}
Also used : PushDataWrapper(com.alibaba.nacos.naming.push.v2.PushDataWrapper) ServiceInfo(com.alibaba.nacos.api.naming.pojo.ServiceInfo) NotifySubscriberRequest(com.alibaba.nacos.api.naming.remote.request.NotifySubscriberRequest) ServiceMetadata(com.alibaba.nacos.naming.core.v2.metadata.ServiceMetadata) Before(org.junit.Before)

Example 72 with ServiceInfo

use of com.alibaba.nacos.api.naming.pojo.ServiceInfo in project nacos by alibaba.

the class PushExecutorUdpImplTest method setUp.

@Before
public void setUp() throws Exception {
    serviceMetadata = new ServiceMetadata();
    pushData = new PushDataWrapper(serviceMetadata, new ServiceInfo("G@@S"));
    pushExecutor = new PushExecutorUdpImpl(pushService);
    doAnswer(new CallbackAnswer()).when(pushService).pushDataWithCallback(eq(subscriber), any(ServiceInfo.class), eq(pushCallBack));
}
Also used : PushDataWrapper(com.alibaba.nacos.naming.push.v2.PushDataWrapper) ServiceInfo(com.alibaba.nacos.api.naming.pojo.ServiceInfo) ServiceMetadata(com.alibaba.nacos.naming.core.v2.metadata.ServiceMetadata) Before(org.junit.Before)

Example 73 with ServiceInfo

use of com.alibaba.nacos.api.naming.pojo.ServiceInfo in project nacos by alibaba.

the class PushDelayTaskExecuteEngineTest method setUp.

@Before
public void setUp() throws Exception {
    when(serviceStorage.getPushData(service)).thenReturn(new ServiceInfo("G@@S"));
    when(indexesManager.getAllClientsSubscribeService(service)).thenReturn(Collections.singletonList(clientId));
    when(clientManager.getClient(clientId)).thenReturn(client);
    when(client.getSubscriber(service)).thenReturn(subscriber);
    when(switchDomain.isPushEnabled()).thenReturn(true);
    executeEngine = new PushDelayTaskExecuteEngine(clientManager, indexesManager, serviceStorage, metadataManager, pushExecutor, switchDomain);
}
Also used : ServiceInfo(com.alibaba.nacos.api.naming.pojo.ServiceInfo) Before(org.junit.Before)

Example 74 with ServiceInfo

use of com.alibaba.nacos.api.naming.pojo.ServiceInfo in project nacos by alibaba.

the class ServiceUtilTest method testSelectInstances.

@Test
public void testSelectInstances() {
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setGroupName("groupName");
    serviceInfo.setName("serviceName");
    serviceInfo.setChecksum("checkSum");
    serviceInfo.setAllIPs(false);
    ServiceInfo cluster = ServiceUtil.selectInstances(serviceInfo, "cluster");
    assertNotNull(cluster);
}
Also used : ServiceInfo(com.alibaba.nacos.api.naming.pojo.ServiceInfo) Test(org.junit.Test)

Aggregations

ServiceInfo (com.alibaba.nacos.api.naming.pojo.ServiceInfo)74 Test (org.junit.Test)44 Instance (com.alibaba.nacos.api.naming.pojo.Instance)29 ArrayList (java.util.ArrayList)17 ServiceMetadata (com.alibaba.nacos.naming.core.v2.metadata.ServiceMetadata)12 Properties (java.util.Properties)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 NacosException (com.alibaba.nacos.api.exception.NacosException)8 ServiceInfoHolder (com.alibaba.nacos.client.naming.cache.ServiceInfoHolder)8 Before (org.junit.Before)8 Service (com.alibaba.nacos.naming.core.v2.pojo.Service)7 Field (java.lang.reflect.Field)6 HashSet (java.util.HashSet)5 EventListener (com.alibaba.nacos.api.naming.listener.EventListener)4 SubscribeServiceResponse (com.alibaba.nacos.api.naming.remote.response.SubscribeServiceResponse)4 PushDataWrapper (com.alibaba.nacos.naming.push.v2.PushDataWrapper)4 HashMap (java.util.HashMap)4 QueryServiceResponse (com.alibaba.nacos.api.naming.remote.response.QueryServiceResponse)3 Secured (com.alibaba.nacos.auth.annotation.Secured)3 InstancesChangeNotifier (com.alibaba.nacos.client.naming.event.InstancesChangeNotifier)3