I have found it , I will fix it later.

yiji

jun liu <ken.lj...@gmail.com> 于2018年9月12日周三 下午12:45写道:

>
> >> 2. mock=“force:return xxx”, directly specify the return value you want.
> > This may be the case you want to use, but I think you just forget the
> mock
> > value you want.
> >
> > It does’t work, cause:
> > PropertyAccessException 1:
> > org.springframework.beans.MethodInvocationException: Property 'mock'
> threw
> > exception; nested exception is java.lang.IllegalStateException: Invalid
> > mock="force:return null" contain illegal charactor, only digit, letter,
> > '-', '_' and '.' is legal.
> >
> > I think maybe the implementation of mock may have bugs.
>
> I haven’t tried this usage in xml yet, seems like we need to find the
> problem and fix it so that it can work properly as expected.
>
> Best regards,
> Jun
>
> > On 12 Sep 2018, at 10:24, Zonghai Shang <y...@apache.org> wrote:
> >
> >> 1. mock=“true”, this will direct the to the default mock implementation
> > with a name convention like DemoServiceMock.
> >> 3. mock=“org.apache.dubbo.xxx.xxxMock”, specify the class where your
> mock
> > logic is located.
> >
> > mock=“org.apache.dubbo.xxx.xxxMock” , only throw RpcException to execute
> > the mock, which does not match the force logic.
> >
> >> 2. mock=“force:return xxx”, directly specify the return value you want.
> > This may be the case you want to use, but I think you just forget the
> mock
> > value you want.
> >
> > It does’t work, cause:
> > PropertyAccessException 1:
> > org.springframework.beans.MethodInvocationException: Property 'mock'
> threw
> > exception; nested exception is java.lang.IllegalStateException: Invalid
> > mock="force:return null" contain illegal charactor, only digit, letter,
> > '-', '_' and '.' is legal.
> >
> > I think maybe the implementation of mock may have bugs.
> >
> >
> > Best regards,
> > yiji
> >
> > jun liu <ken.lj...@gmail.com> 于2018年9月12日周三 上午8:56写道:
> >
> >>> <dubbo:reference id="demoService" check="false"
> >>> interface="com.alibaba.dubbo.samples.mock.api.DemoService"
> mock="force”/>
> >>
> >> As far as I can describe now, I think you can use:
> >> 1. mock=“true”, this will direct the to the default mock implementation
> >> with a name convention like DemoServiceMock.
> >> 2. mock=“force:return xxx”, directly specify the return value you want.
> >> This may be the case you want to use, but I think you just forget the
> mock
> >> value you want.
> >> 3. mock=“org.apache.dubbo.xxx.xxxMock”, specify the class where your
> mock
> >> logic is located.
> >>
> >>> `com.alibaba.dubbo.common.utils.ConfigUtils#isDefault` should support
> >>> force? Can someone help me?
> >>
> >> Given the above usage supported I think there’s no need to add an extra
> >> mock=“force” support. What do u think?
> >>
> >> Best regards,
> >> Jun
> >>
> >>> On 11 Sep 2018, at 16:31, Zonghai Shang <y...@apache.org> wrote:
> >>>
> >>> Hi,
> >>>
> >>> MockClusterInvoker provides local forced mock,I tested it locally, but
> it
> >>> doesn't work.
> >>>
> >>> @Override
> >>> public Result invoke(Invocation invocation) throws RpcException {
> >>>   // ….
> >>>   else if (value.startsWith("force")) {
> >>>       if (logger.isWarnEnabled()) {
> >>>           logger.info("force-mock: " + invocation.getMethodName() + "
> >>> force-mock enabled , url : " + directory.getUrl());
> >>>       }
> >>>       //force:direct mock
> >>>       result = doMockInvoke(invocation, null);
> >>>   }
> >>>      // ….
> >>> }
> >>>
> >>> <dubbo:reference id="demoService" check="false"
> >>> interface="com.alibaba.dubbo.samples.mock.api.DemoService"
> mock="force”/>
> >>>
> >>> Here is demo:
> >>> https://github.com/dubbo/dubbo-samples/tree/master/dubbo-samples-mock
> >>>
> >>> `com.alibaba.dubbo.common.utils.ConfigUtils#isDefault` should support
> >>> force? Can someone help me?
> >>>
> >>> yiji
> >>
> >>
>
>

Reply via email to