> 1. Improve the documentation
> 2. Consider the configuration of xml compatible with the configuration of
the override protocol

I agree, maybe a pull request to fix it.

Best regards,
yiji

yuhang xiu <carry...@gmail.com> 于2018年9月12日周三 上午10:36写道:

> Hi guys,
>
> I also encountered this confusion when I configured the mock in xml.
> Now it seems that the form of mock=force:return xxx can only be used when
> dynamically configured using the override protocol, which does not match
> the configuration of the xml.
>
> I think we need to do one of the following two things:
> 1. Improve the documentation
> 2. Consider the configuration of xml compatible with the configuration of
> the override protocol
>
> Zonghai Shang <y...@apache.org> 于2018年9月12日周三 上午10:24写道:
>
> > > 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