Search in sources :

Example 1 with MeshApiClient

use of com.alipay.sofa.rpc.registry.mesh.client.MeshApiClient in project sofa-rpc by sofastack.

the class MeshRegistry method init.

@Override
public void init() {
    synchronized (MeshRegistry.class) {
        if (!inited) {
            String address = registryConfig.getAddress();
            client = new MeshApiClient(address);
            inited = true;
        }
    }
}
Also used : MeshApiClient(com.alipay.sofa.rpc.registry.mesh.client.MeshApiClient)

Example 2 with MeshApiClient

use of com.alipay.sofa.rpc.registry.mesh.client.MeshApiClient in project sofa-rpc by sofastack.

the class MeshApiClientTest method before.

@Before
public void before() {
    httpMockServer = new HttpMockServer();
    meshApiClient = new MeshApiClient("http://localhost:7654");
    httpMockServer.initSever(7654);
    ApplicationInfoResult applicationInfoResult = new ApplicationInfoResult();
    applicationInfoResult.setSuccess(true);
    httpMockServer.addMockPath(MeshEndpoint.CONFIGS, JSON.toJSONString(applicationInfoResult));
    PublishServiceResult publishServiceResult = new PublishServiceResult();
    publishServiceResult.setSuccess(true);
    httpMockServer.addMockPath(MeshEndpoint.PUBLISH, JSON.toJSONString(publishServiceResult));
    SubscribeServiceResult subscribeServiceResult = new SubscribeServiceResult();
    subscribeServiceResult.setSuccess(true);
    httpMockServer.addMockPath(MeshEndpoint.SUBCRIBE, JSON.toJSONString(subscribeServiceResult));
    UnPublishServiceResult unPublishServiceResult = new UnPublishServiceResult();
    unPublishServiceResult.setSuccess(true);
    httpMockServer.addMockPath(MeshEndpoint.UN_PUBLISH, JSON.toJSONString(unPublishServiceResult));
    UnSubscribeServiceResult unSubscribeServiceResult = new UnSubscribeServiceResult();
    unSubscribeServiceResult.setSuccess(true);
    httpMockServer.addMockPath(MeshEndpoint.UN_SUBCRIBE, JSON.toJSONString(unSubscribeServiceResult));
    httpMockServer.start();
}
Also used : UnPublishServiceResult(com.alipay.sofa.rpc.registry.mesh.model.UnPublishServiceResult) PublishServiceResult(com.alipay.sofa.rpc.registry.mesh.model.PublishServiceResult) HttpMockServer(com.alipay.sofa.rpc.registry.mesh.mock.HttpMockServer) MeshApiClient(com.alipay.sofa.rpc.registry.mesh.client.MeshApiClient) UnPublishServiceResult(com.alipay.sofa.rpc.registry.mesh.model.UnPublishServiceResult) UnSubscribeServiceResult(com.alipay.sofa.rpc.registry.mesh.model.UnSubscribeServiceResult) ApplicationInfoResult(com.alipay.sofa.rpc.registry.mesh.model.ApplicationInfoResult) UnSubscribeServiceResult(com.alipay.sofa.rpc.registry.mesh.model.UnSubscribeServiceResult) SubscribeServiceResult(com.alipay.sofa.rpc.registry.mesh.model.SubscribeServiceResult) Before(org.junit.Before)

Aggregations

MeshApiClient (com.alipay.sofa.rpc.registry.mesh.client.MeshApiClient)2 HttpMockServer (com.alipay.sofa.rpc.registry.mesh.mock.HttpMockServer)1 ApplicationInfoResult (com.alipay.sofa.rpc.registry.mesh.model.ApplicationInfoResult)1 PublishServiceResult (com.alipay.sofa.rpc.registry.mesh.model.PublishServiceResult)1 SubscribeServiceResult (com.alipay.sofa.rpc.registry.mesh.model.SubscribeServiceResult)1 UnPublishServiceResult (com.alipay.sofa.rpc.registry.mesh.model.UnPublishServiceResult)1 UnSubscribeServiceResult (com.alipay.sofa.rpc.registry.mesh.model.UnSubscribeServiceResult)1 Before (org.junit.Before)1