com.alibaba.dubbo.rpc.cluster.filter.DemoService Java Examples

The following examples show how to use com.alibaba.dubbo.rpc.cluster.filter.DemoService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test()
public void testNoInvoke() {
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(null).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    LogUtil.start();
    invoker.invoke(invocation);
    assertTrue(LogUtil.findMessage("No provider") > 0);
    LogUtil.stop();
}
 
Example #2
Source File: FailSafeClusterInvokerTest.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
@Test()
public void testNoInvoke() {
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(null).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    LogUtil.start();
    invoker.invoke(invocation);
    assertTrue(LogUtil.findMessage("No provider") > 0);
    LogUtil.stop();
}
 
Example #3
Source File: FailSafeClusterInvokerTest.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
@Test()
public void testNoInvoke() {
    dic = mock(Directory.class);

    given(dic.getUrl()).willReturn(url);
    given(dic.list(invocation)).willReturn(null);
    given(dic.getInterface()).willReturn(DemoService.class);

    invocation.setMethodName("method1");

    resetInvokerToNoException();

    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    LogUtil.start();
    invoker.invoke(invocation);
    assertTrue(LogUtil.findMessage("No provider") > 0);
    LogUtil.stop();
}
 
Example #4
Source File: FailSafeClusterInvokerTest.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
@Test()
public void testNoInvoke() {
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(null).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    LogUtil.start();
    invoker.invoke(invocation);
    assertTrue(LogUtil.findMessage("No provider") > 0);
    LogUtil.stop();
}
 
Example #5
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test()
public void testNoInvoke() {
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(null).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    LogUtil.start();
    invoker.invoke(invocation);
    assertTrue(LogUtil.findMessage("No provider") > 0);
    LogUtil.stop();
}
 
Example #6
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test()
public void testNoInvoke() {
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(null).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    LogUtil.start();
    invoker.invoke(invocation);
    assertTrue(LogUtil.findMessage("No provider") > 0);
    LogUtil.stop();
}
 
Example #7
Source File: FailSafeClusterInvokerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToNoException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andReturn(result).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #8
Source File: FailSafeClusterInvokerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
/**
 * @throws java.lang.Exception
 */

@Before
public void setUp() throws Exception {
    
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(invokers).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    invokers.add(invoker);
}
 
Example #9
Source File: FailSafeClusterInvokerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvokeExceptoin() {
    resetInvokerToException();
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    invoker.invoke(invocation);
    Assert.assertNull(RpcContext.getContext().getInvoker());
}
 
Example #10
Source File: FailSafeClusterInvokerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
@Test()
public void testInvokeNoExceptoin() {
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    Result ret = invoker.invoke(invocation);
    Assert.assertSame(result, ret);
}
 
Example #11
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * @throws java.lang.Exception
 */

@Before
public void setUp() throws Exception {
    
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(invokers).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    invokers.add(invoker);
}
 
Example #12
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andThrow(new RuntimeException()).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #13
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToNoException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andReturn(result).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #14
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvokeExceptoin() {
    resetInvokerToException();
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    invoker.invoke(invocation);
    Assert.assertNull(RpcContext.getContext().getInvoker());
}
 
Example #15
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test()
public void testInvokeNoExceptoin() {
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    Result ret = invoker.invoke(invocation);
    Assert.assertSame(result, ret);
}
 
Example #16
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * @throws java.lang.Exception
 */

@Before
public void setUp() throws Exception {
    
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(invokers).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    invokers.add(invoker);
}
 
Example #17
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andThrow(new RuntimeException()).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #18
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToNoException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andReturn(result).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #19
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvokeExceptoin() {
    resetInvokerToException();
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    invoker.invoke(invocation);
    Assert.assertNull(RpcContext.getContext().getInvoker());
}
 
Example #20
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test()
public void testInvokeNoExceptoin() {
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    Result ret = invoker.invoke(invocation);
    Assert.assertSame(result, ret);
}
 
Example #21
Source File: FailSafeClusterInvokerTest.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andThrow(new RuntimeException()).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #22
Source File: FailSafeClusterInvokerTest.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
/**
 * @throws java.lang.Exception
 */

@Before
public void setUp() throws Exception {

    dic = mock(Directory.class);

    given(dic.getUrl()).willReturn(url);
    given(dic.list(invocation)).willReturn(invokers);
    given(dic.getInterface()).willReturn(DemoService.class);
    invocation.setMethodName("method1");

    invokers.add(invoker);
}
 
Example #23
Source File: FailSafeClusterInvokerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Test()
public void testInvokeNoExceptoin() {
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    Result ret = invoker.invoke(invocation);
    Assert.assertSame(result, ret);
}
 
Example #24
Source File: FailSafeClusterInvokerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvokeExceptoin() {
    resetInvokerToException();
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    invoker.invoke(invocation);
    Assert.assertNull(RpcContext.getContext().getInvoker());
}
 
Example #25
Source File: FailSafeClusterInvokerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToNoException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andReturn(result).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #26
Source File: FailSafeClusterInvokerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andThrow(new RuntimeException()).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}
 
Example #27
Source File: FailSafeClusterInvokerTest.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
/**
 * @throws java.lang.Exception
 */

@Before
public void setUp() throws Exception {
    
    dic = EasyMock.createMock(Directory.class);
    
    EasyMock.expect(dic.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(dic.list(invocation)).andReturn(invokers).anyTimes();
    EasyMock.expect(dic.getInterface()).andReturn(DemoService.class).anyTimes();
    invocation.setMethodName("method1");
    EasyMock.replay(dic);
    
    invokers.add(invoker);
}
 
Example #28
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test()
public void testInvokeNoExceptoin() {
    
    resetInvokerToNoException();
    
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    Result ret = invoker.invoke(invocation);
    Assert.assertSame(result, ret);
}
 
Example #29
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvokeExceptoin() {
    resetInvokerToException();
    FailsafeClusterInvoker<DemoService> invoker = new FailsafeClusterInvoker<DemoService>(dic);
    invoker.invoke(invocation);
    Assert.assertNull(RpcContext.getContext().getInvoker());
}
 
Example #30
Source File: FailSafeClusterInvokerTest.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private void resetInvokerToNoException(){
    EasyMock.reset(invoker);
    EasyMock.expect(invoker.invoke(invocation)).andReturn(result).anyTimes();
    EasyMock.expect(invoker.getUrl()).andReturn(url).anyTimes();
    EasyMock.expect(invoker.getInterface()).andReturn(DemoService.class).anyTimes();
    EasyMock.replay(invoker);
}