> On June 4, 2016, 5:17 p.m., Stephan Erb wrote:
> > docs/features/webhooks.md, line 1
> > <https://reviews.apache.org/r/47440/diff/11/?file=1406242#file1406242line1>
> >
> >     Please add a reference to this file in `docs/README.md`

Done.


> On June 4, 2016, 5:17 p.m., Stephan Erb wrote:
> > docs/features/webhooks.md, line 8
> > <https://reviews.apache.org/r/47440/diff/11/?file=1406242#file1406242line8>
> >
> >     Please also add an example event payload that one would receive via a 
> > post request.

Done.


> On June 4, 2016, 5:17 p.m., Stephan Erb wrote:
> > src/main/resources/org/apache/aurora/scheduler/webhook.json, lines 1-8
> > <https://reviews.apache.org/r/47440/diff/11/?file=1406249#file1406249line1>
> >
> >     I still think we should get rid of that file. It is not really a 
> > usuable by default for anyone, shipping it in our source and binary 
> > distribution therefore does not make much sense.

It's used for testing, so I prefer to keep it here. It's on par with how 
tier_config file is shipped.


> On June 4, 2016, 5:17 p.m., Stephan Erb wrote:
> > src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java, lines 
> > 52-65
> > <https://reviews.apache.org/r/47440/diff/11/?file=1406250#file1406250line52>
> >
> >     I have to admit, that I don't really understand what those tests are 
> > _actually_ asserting, especially given the coarse-grained 
> > `try-catch`-clauses in the code. 
> >     
> >     Personally, I would have opted to start a proper webserver within my 
> > test that actually asserts data is received as requested.  I have never 
> > done this in Java, but it seems possible (for example with Jetty): 
> > https://stackoverflow.com/questions/29758607/how-to-run-jetty-server-for-java-junit-testing

Tests are asserting that functions got called with expected arguments.

Great idea. I have never setup a test server in Java either, so maybe we can 
rely on unit tests.


> On June 4, 2016, 5:17 p.m., Stephan Erb wrote:
> > src/main/java/org/apache/aurora/scheduler/events/Webhook.java, lines 71-73
> > <https://reviews.apache.org/r/47440/diff/11/?file=1406246#file1406246line71>
> >
> >     Seeing the code spelled out here, this looks kind of complicated.
> >     
> >     I believe you can make the code more obvious if you don't do any error 
> > handling within `initializeConnection` but instead just let the exceptions 
> > bubble-up and handle them in the first `try`-block in `callEndpoint`. You 
> > might even consider merging all try-blocks into just a single one.

I try to break up code into more digestable chunks so I think I prefer 
isolating parts and letting `initializeConnection` dealing with object 
creation, and `callEndpoint` with actual call. I see what you mean though.


> On June 4, 2016, 5:17 p.m., Stephan Erb wrote:
> > src/main/java/org/apache/aurora/scheduler/events/Webhook.java, line 82
> > <https://reviews.apache.org/r/47440/diff/11/?file=1406246#file1406246line82>
> >
> >     According to the docs, `getErrorStream` _may_ return `null`, so we need 
> > a guard here. 
> > https://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html#getErrorStream()

Good call. Done.


- Dmitriy


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/47440/#review136169
-----------------------------------------------------------


On June 4, 2016, 6:33 p.m., Dmitriy Shirchenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/47440/
> -----------------------------------------------------------
> 
> (Updated June 4, 2016, 6:33 p.m.)
> 
> 
> Review request for Aurora, Maxim Khutornenko and Stephan Erb.
> 
> 
> Bugs: AURORA-1683
>     https://issues.apache.org/jira/browse/AURORA-1683
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Looking for some feedback whether I'm on the correct path in adding a 
> webhook. All comments are welcome!
> 
> 
> Diffs
> -----
> 
>   RELEASE-NOTES.md 21a141f1acadfdaa94247b75de2f734b11868137 
>   docs/README.md aea8518b07918ae1cd3322873e72fc8bfcd6df7b 
>   docs/features/webhooks.md PRE-CREATION 
>   docs/reference/scheduler-configuration.md 
> f7d676d0ed6bc536f4341dbb9365cf50e8607efb 
>   src/main/java/org/apache/aurora/scheduler/app/SchedulerMain.java 
> 9ebfe230836e88a97bc60092373f72f176a8f6f2 
>   src/main/java/org/apache/aurora/scheduler/events/PubsubEvent.java 
> 2a4c0665e48d30e0655de00bd7f6f9b49f01eafc 
>   src/main/java/org/apache/aurora/scheduler/events/Webhook.java PRE-CREATION 
>   src/main/java/org/apache/aurora/scheduler/events/WebhookInfo.java 
> PRE-CREATION 
>   src/main/java/org/apache/aurora/scheduler/events/WebhookModule.java 
> PRE-CREATION 
>   src/main/resources/org/apache/aurora/scheduler/webhook.json PRE-CREATION 
>   src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java 
> PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/47440/diff/
> 
> 
> Testing
> -------
> 
> Need to fix tests.
> 
> 
> Thanks,
> 
> Dmitriy Shirchenko
> 
>

Reply via email to