Repository: sqoop Updated Branches: refs/heads/sqoop2 813319201 -> 93e2dc376
SQOOP-2822: Sqoop2: RESTiliency: Provide tests for Link POST action (Jarek Jarcec Cecho via Colin Ma) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/93e2dc37 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/93e2dc37 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/93e2dc37 Branch: refs/heads/sqoop2 Commit: 93e2dc376d5b902d86d1deb76bb0e7292b6fec0f Parents: 8133192 Author: Colin Ma <[email protected]> Authored: Wed Feb 17 11:58:00 2016 +0800 Committer: Colin Ma <[email protected]> Committed: Wed Feb 17 11:58:00 2016 +0800 ---------------------------------------------------------------------- .../integration/server/rest/LinkRestTest.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/93e2dc37/test/src/test/java/org/apache/sqoop/integration/server/rest/LinkRestTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/sqoop/integration/server/rest/LinkRestTest.java b/test/src/test/java/org/apache/sqoop/integration/server/rest/LinkRestTest.java index f9b0cbf..d988f2d 100644 --- a/test/src/test/java/org/apache/sqoop/integration/server/rest/LinkRestTest.java +++ b/test/src/test/java/org/apache/sqoop/integration/server/rest/LinkRestTest.java @@ -65,6 +65,26 @@ public class LinkRestTest extends RestTest { assertServerException("Entity requested doesn't exist", "SERVER_0006"); assertContains("Invalid connector: i-dont-exists"); }}), + + // Post + new TestDescription("Empty data", "v1/link", "POST", "", new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(500); + assertServerException("Invalid JSON", "SERIALIZATION_002"); + }}), + new TestDescription("Corrupted JSON", "v1/link", "POST", "{\"blah\" : {}", new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(500); + assertServerException("Invalid JSON", "SERIALIZATION_002"); + }}), + new TestDescription("Empty JSON", "v1/link", "POST", "{}", new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(500); + assertServerException("Required key field is missing", "SERIALIZATION_003"); + }}), }; @DataProvider(name="link-rest-test", parallel=false)
