vert-x3 / vertx-service-proxy

EventBus Proxy generation
Apache License 2.0
67 stars 58 forks source link

Convert element within nested list and map. #29

Closed mguillet closed 9 years ago

mguillet commented 9 years ago

The mongo service proxy violates some method signatures when running over a cluster of several node.

For instance, the method:

MongoClient find(String collection, JsonObject query, Handler<AsyncResult<List<JsonObject>>> resultHandler);

Doesn't return a instance of List<JsonObject> but a List<Map> instance instead.

I've tried to explain the issue in this topic: https://groups.google.com/d/topic/vertx/7pMZEMsjZNE/discussion

According to the documentation of vertx-service-proxy, you can only have JsonObject or JsonArray contained in instances of Map, List or Set.

So, now in convertList and convertMap the code:

cescoffier commented 9 years ago

Could you add a unit test ?

mguillet commented 9 years ago

Yes, I will!

I'll try to do that by the end of the week. Would that be ok?

cescoffier commented 9 years ago

Yes thanks !

I'm working on the project right now, so don't forget to update first.

cescoffier commented 9 years ago

If you look as https://github.com/vert-x3/vertx-service-proxy/pull/30, there are a couple of clustered tests. This PR (I hope) will be merged before this weekend. So you can easily add your tests there.

mguillet commented 9 years ago

Hello @cescoffier, any reason you're not using vert-unit in your clustered test from #30 ?

cescoffier commented 9 years ago

No real reason (just my own habits), you can use vertx-unit.

mguillet commented 9 years ago

Okay then I might :-) ! I find it quite elegant.

I'm working on the subject: I will grab some of the test ressources from #30 you created and wait for it to be merged before I update this PR. I that OK for you?

cescoffier commented 9 years ago

Yes, thanks !

mguillet commented 9 years ago

Ok, it was easier and more logical to plug my test on what you've done.

One question though: in the documentation it states that you can return a Map<String, JsonObject> from a service call. But the code generation forbids it:

type io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<java.lang.String,io.vertx.core.json.JsonObject>>> is not legal for use for a parameter in proxy

Which one is right?

I've commented out my test related to Maps...

cescoffier commented 9 years ago

I guess the document is wrong. Could you tell me where you found it ?

mguillet commented 9 years ago

In the README.md of this project around line 244

cescoffier commented 9 years ago

Thanks !