Bug 349014 - [server] Add test for GET /gitapi/config/{key}/clone/file/{path}
Summary: [server] Add test for GET /gitapi/config/{key}/clone/file/{path}
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 0.2   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard: gsoc2011
Keywords: test
Depends on:
Blocks: 345399
  Show dependency tree
 
Reported: 2011-06-10 07:53 EDT by Tomasz Zarna CLA
Modified: 2012-01-19 11:44 EST (History)
2 users (show)

See Also:
tomasz.zarna: review+
malgorzata.tomczyk: review+


Attachments
GitConfigHandlerV1.handleGet(...) with source code annot's (26.65 KB, image/png)
2011-06-10 07:55 EDT, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2011-06-10 07:53:50 EDT
Running EclEmma against org.eclipse.orion.server.git proved that the code coverage is pretty good. These are few places where the coverage could be improved, one of them is org.eclipse.orion.server.git.servlets.GitConfigHandlerV1.handleGet(HttpServletRequest, HttpServletResponse, String). See the attached screenshot for details.
Comment 1 Tomasz Zarna CLA 2011-06-10 07:55:05 EDT
Created attachment 197765 [details]
GitConfigHandlerV1.handleGet(...) with source code annot's
Comment 2 Piotr Janik CLA 2011-06-10 10:21:22 EDT
Right. Simple fix: https://github.com/pjanik/orion.server/tree/bug349014

I wrote all this code and have the rights to contribute it to Eclipse under the eclipse.org web site terms of use.
Comment 3 Tomasz Zarna CLA 2011-06-13 07:17:42 EDT
First of all, I would split the testSetAndUnsetConfigValues method into separate test cases, just like we're trying to do in other tests. For example, I would extract tests for:
* getting list of options
* getting a single option
* adding/setting values with POST
* updating values with PUT
* removing/unsetting options with DELETE
* trying to set a value for non-existing option
* and so on...

Don't get me wrong, the code is fine, but having a separate test method for each scenario makes the results clearer in case of a failure.
Comment 4 Piotr Janik CLA 2011-06-13 08:42:54 EDT
Ok, updated (the same branch).
Comment 5 Piotr Janik CLA 2011-06-13 11:35:07 EDT
Next update, fixed issues mentioned in the comments at github.

https://github.com/pjanik/orion.server/commits/bug349014
Comment 7 Piotr Janik CLA 2011-06-15 12:19:02 EDT
Updated.
https://github.com/pjanik/orion.server/commits/bug349014