Search in sources :

Example 1 with LocalSwitcherService

use of com.weibo.api.motan.switcher.LocalSwitcherService in project motan by weibocom.

the class LocalSwitcherServiceTest method testProtocolSwitcher.

@Test
public void testProtocolSwitcher() {
    String protocolSwitcher = MotanConstants.PROTOCOL_SWITCHER_PREFIX + "motan";
    LocalSwitcherService localSwitcherService = new LocalSwitcherService();
    localSwitcherService.setValue(protocolSwitcher, false);
    Switcher switcher = localSwitcherService.getSwitcher(protocolSwitcher);
    Assert.assertNotNull(switcher);
    Assert.assertFalse(switcher.isOn());
    localSwitcherService.setValue(protocolSwitcher, true);
    switcher = localSwitcherService.getSwitcher(protocolSwitcher);
    Assert.assertNotNull(switcher);
    Assert.assertTrue(switcher.isOn());
}
Also used : Switcher(com.weibo.api.motan.switcher.Switcher) LocalSwitcherService(com.weibo.api.motan.switcher.LocalSwitcherService) Test(org.junit.Test)

Aggregations

LocalSwitcherService (com.weibo.api.motan.switcher.LocalSwitcherService)1 Switcher (com.weibo.api.motan.switcher.Switcher)1 Test (org.junit.Test)1