Search in sources :

Example 1 with MockWorld

use of com.weibo.api.motan.protocol.example.MockWorld in project motan by weibocom.

the class MockServiceConfig method mockIWorldServiceConfig.

protected static ServiceConfig<IWorld> mockIWorldServiceConfig() {
    ServiceConfig<IWorld> serviceConfig = new ServiceConfig<IWorld>();
    serviceConfig.setRef(new MockWorld());
    serviceConfig.setApplication(application);
    serviceConfig.setModule(module);
    serviceConfig.setCheck("true");
    serviceConfig.setInterface(IWorld.class);
    serviceConfig.setGroup(group);
    serviceConfig.setShareChannel(true);
    return serviceConfig;
}
Also used : ServiceConfig(com.weibo.api.motan.config.ServiceConfig) IWorld(com.weibo.api.motan.protocol.example.IWorld) MockWorld(com.weibo.api.motan.protocol.example.MockWorld)

Example 2 with MockWorld

use of com.weibo.api.motan.protocol.example.MockWorld in project motan by weibocom.

the class RefererConfigTest method testGetRef.

@Test
public void testGetRef() {
    MockWorld mWorld = new MockWorld();
    serviceConfig.setRef(mWorld);
    serviceConfig.export();
    IWorld ref = refererConfig.getRef();
    assertNotNull(ref);
    assertEquals(refererConfig.getClusterSupports().size(), 1);
    int times = 3;
    for (int i = 0; i < times; i++) {
        ref.world("test");
    }
    assertEquals(times, mWorld.stringCount.get());
    serviceConfig.unexport();
    // destroy
    refererConfig.destroy();
    assertFalse(refererConfig.getInitialized().get());
}
Also used : IWorld(com.weibo.api.motan.protocol.example.IWorld) MockWorld(com.weibo.api.motan.protocol.example.MockWorld) Test(org.junit.Test)

Aggregations

IWorld (com.weibo.api.motan.protocol.example.IWorld)2 MockWorld (com.weibo.api.motan.protocol.example.MockWorld)2 ServiceConfig (com.weibo.api.motan.config.ServiceConfig)1 Test (org.junit.Test)1