use of org.apache.dubbo.rpc.support.MockInvocation in project dubbo by alibaba.
the class ActiveLimitFilterTest method testInvokeNoActives.
@Test
public void testInvokeNoActives() {
URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&actives=0");
Invoker<ActiveLimitFilterTest> invoker = new MyInvoker<ActiveLimitFilterTest>(url);
Invocation invocation = new MockInvocation();
activeLimitFilter.invoke(invoker, invocation);
}
use of org.apache.dubbo.rpc.support.MockInvocation in project dubbo by alibaba.
the class AccessLogFilterTest method testCustom.
@Test
public void testCustom() {
URL url = URL.valueOf("test://test:11/test?accesslog=custom-access.log");
Invoker<AccessLogFilterTest> invoker = new MyInvoker<AccessLogFilterTest>(url);
Invocation invocation = new MockInvocation();
accessLogFilter.invoke(invoker, invocation);
}
use of org.apache.dubbo.rpc.support.MockInvocation in project dubbo by alibaba.
the class ContextFilterTest method testWithAttachments.
@Test
public void testWithAttachments() {
URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1");
Invoker<DemoService> invoker = new MyInvoker<DemoService>(url);
Invocation invocation = new MockInvocation();
Result result = contextFilter.invoke(invoker, invocation);
assertNull(RpcContext.getContext().getInvoker());
}
use of org.apache.dubbo.rpc.support.MockInvocation in project dubbo by alibaba.
the class DefaultTPSLimiterTest method testIsAllowable.
@Test
public void testIsAllowable() throws Exception {
Invocation invocation = new MockInvocation();
URL url = URL.valueOf("test://test");
url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService");
url = url.addParameter(TPS_LIMIT_RATE_KEY, TEST_LIMIT_RATE);
url = url.addParameter(TPS_LIMIT_INTERVAL_KEY, 1000);
for (int i = 1; i <= TEST_LIMIT_RATE; i++) {
Assertions.assertTrue(defaultTPSLimiter.isAllowable(url, invocation));
}
}
use of org.apache.dubbo.rpc.support.MockInvocation in project dubbo by alibaba.
the class DefaultTPSLimiterTest method testIsNotAllowable.
@Test
public void testIsNotAllowable() throws Exception {
Invocation invocation = new MockInvocation();
URL url = URL.valueOf("test://test");
url = url.addParameter(INTERFACE_KEY, "org.apache.dubbo.rpc.file.TpsService");
url = url.addParameter(TPS_LIMIT_RATE_KEY, TEST_LIMIT_RATE);
url = url.addParameter(TPS_LIMIT_INTERVAL_KEY, 1000);
for (int i = 1; i <= TEST_LIMIT_RATE + 1; i++) {
if (i == TEST_LIMIT_RATE + 1) {
Assertions.assertFalse(defaultTPSLimiter.isAllowable(url, invocation));
} else {
Assertions.assertTrue(defaultTPSLimiter.isAllowable(url, invocation));
}
}
}
Aggregations