Injecting own client into internal node

Hi there,

While writing my plugin I came across the problem that I would like to
inject my custom self written client with a suggest method, whenever
node.client() is called - this would be especially useful for my
tests, as I am currently doing integration tests against the rest
controller.

--Alexander

Hey,

Sadly, there isn't really an option to do it. But, you could get the
TransportXXAction one and use it (from the internal injector). Need to
think more on custom APIs and how to add them to a statically typed
language :slight_smile:

-shay.banon

On Tue, Nov 29, 2011 at 5:18 PM, Alexander Reelsen <
alexander.reelsen@googlemail.com> wrote:

Hi there,

While writing my plugin I came across the problem that I would like to
inject my custom self written client with a suggest method, whenever
node.client() is called - this would be especially useful for my
tests, as I am currently doing integration tests against the rest
controller.

--Alexander

Hey

On 29 Nov., 16:22, Shay Banon kim...@gmail.com wrote:

Sadly, there isn't really an option to do it. But, you could get the
TransportXXAction one and use it (from the internal injector). Need to
think more on custom APIs and how to add them to a statically typed
language :slight_smile:
Hm, it feels a bit like maven downloading half the internet three
times when I try to resolve the dependencies of a
TransportBroadcastOperationAction manually, as it needs a
clusterservice, a transport service and a indicesservice - which in
turn needs all kinds of modules injected.

Does it make sense to resolve all these dependencies or is there some
trick I just dont see? Or some even better solution?

Thanks a lot for helping!

--Alexander

What? You have your action implemented, no? You can get the guice injector
and get its (singleton) instance.

On Thu, Dec 1, 2011 at 12:56 AM, Alexander Reelsen <
alexander.reelsen@googlemail.com> wrote:

Hey

On 29 Nov., 16:22, Shay Banon kim...@gmail.com wrote:

Sadly, there isn't really an option to do it. But, you could get the
TransportXXAction one and use it (from the internal injector). Need to
think more on custom APIs and how to add them to a statically typed
language :slight_smile:
Hm, it feels a bit like maven downloading half the internet three
times when I try to resolve the dependencies of a
TransportBroadcastOperationAction manually, as it needs a
clusterservice, a transport service and a indicesservice - which in
turn needs all kinds of modules injected.

Does it make sense to resolve all these dependencies or is there some
trick I just dont see? Or some even better solution?

Thanks a lot for helping!

--Alexander

Hi

On Dec 1, 3:08 pm, Shay Banon kim...@gmail.com wrote:

What? You have your action implemented, no? You can get the guice injector
and get its (singleton) instance.
Works now, I did the same as in the HdfsGatewayTests:

TransportSuggestAction suggestAction = ((InternalNode)
node).injector().getInstance(TransportSuggestAction.class);

Thanks for helping, I shouldnt check/search/ask for such issues after
midnight during the week I guess.

--Alexander