You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by hongbin ma <ma...@apache.org> on 2015/05/19 08:39:34 UTC
Mock HTableInterface
hi, experts
i'm looking for some mock for HTableInterface for my unit tests.
I googled and found it can be done by mockito or minicluster.
However, I'm looking for some HTableInterface mock that persist my data(for
a little while before it is used), i'm not sure if mockito will do it.
For minicluster approach, it is obviously too heavy for my unit tests.
I know there used to be some implementations like:
https://gist.github.com/agaoglu/613217, but seems outdated.
https://issues.apache.org/jira/browse/HBASE-10894 seems pointing to the
same problem as mine.
--
Regards,
*Bin Mahone | 马洪宾*
Apache Kylin: http://kylin.io
Github: https://github.com/binmahone
Re: Mock HTableInterface
Posted by Bryan Beaudreault <bb...@hubspot.com>.
One possibility is fake-hbase from the guys working on kiji:
https://github.com/kijiproject/fake-hbase
Alternatively, HTableInterface is just that, an interface. You can put
whatever implementation you want behind it. We have many implementations of
HTableInterface for a variety of use cases. At one time we had one that
backs everything by a series of maps, for testing. We've moved away from
that in favor of fake-hbase though.
Finally, mockito does work like you said, in that way you can specialize
each mocked table on a per-test basis
On Tuesday, May 19, 2015, hongbin ma <ma...@apache.org> wrote:
> hi, experts
>
> i'm looking for some mock for HTableInterface for my unit tests.
> I googled and found it can be done by mockito or minicluster.
> However, I'm looking for some HTableInterface mock that persist my data(for
> a little while before it is used), i'm not sure if mockito will do it.
> For minicluster approach, it is obviously too heavy for my unit tests.
>
> I know there used to be some implementations like:
> https://gist.github.com/agaoglu/613217, but seems outdated.
>
> https://issues.apache.org/jira/browse/HBASE-10894 seems pointing to the
> same problem as mine.
>
> --
> Regards,
>
> *Bin Mahone | 马洪宾*
> Apache Kylin: http://kylin.io
> Github: https://github.com/binmahone
>