initial work to support HttpEntity#531
Conversation
| public void testHttpEffector() throws Exception { | ||
| new HttpCommandEffector(ConfigBag.newInstance() | ||
| .configure(HttpCommandEffector.EFFECTOR_NAME, "GithubApacheAccount") | ||
| .configure(HttpCommandEffector.EFFECTOR_URI, "https://api.github.com/users/apache") |
There was a problem hiding this comment.
I'd recommend http://httpbin.org/ for integration testing - it gives very predictable responses based on the inputs, allowing you to test a wide variety of things such as request/response headers, get/put/post/delete etc.
There was a problem hiding this comment.
thanks @aledsage, much better, I'll use it
| private EntityLocal entity; | ||
|
|
||
| @BeforeMethod(alwaysRun=true) | ||
| public void setUp() throws Exception { |
There was a problem hiding this comment.
You can write a unit test (rather than just an integration test) if you use something similar to https://github.com/apache/brooklyn-server/blob/master/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java
|
It would be good to also have some yaml-based tests (e.g. see https://github.com/apache/brooklyn-server/blob/master/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SshCommandEffectorYamlTest.java) |
|
And rebind tests would be very good (e.g. see https://github.com/apache/brooklyn-server/blob/master/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java and its sub-classes - the important thing is to call |
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(CompositeEffector.class); | ||
|
|
||
| public static final ConfigKey<List<String>> EFFECTORS = ConfigKeys.newConfigKey(new TypeToken<List<String>>() {}, "effectors", |
There was a problem hiding this comment.
I see we pass in the same parameters to every effector. I wonder whether we should also accept a list of maps, so that we could define the parameters to the individual effectors. But that would make the code more complicated.
It would be interesting to see what the user's yaml would look like, if they were doing that.
|
I've added more tests for the effectors:
please @aledsage can you have another look? |
- add HttpCommnadEffector - add CompositeEffector - add EntityInitializers util class to resolve DSL injected as params into the HttpCommandEffector
- some http calls may not require to parse the output
- add unit test (HttpCommandEffectorTest) - add YamlTest (HttpCommandEffectorYamlTest) - add YamlRebindTest (HttpCommandEffectorYamlRebindTest)
50f908a to
8809d5c
Compare
98edec7 to
1871a52
Compare
|
very nice @andreaturli -- and excellent tests. is there a corresponding PR against the docs to explain how to use this? looks good so merging |
|
I will open a PR for docs ASAP, thanks @ahgittin for merging it |
into the HttpCommandEffector
It is based on #152 which was not merged as it didn't handle rebind properly, happy to sort it out in this PR but I've not touched rebinding yet.