Repository: sqoop Updated Branches: refs/heads/sqoop2 a3c374723 -> 208d5daf4
SQOOP-2547. Sqoop2: RESTiliency: Provide REST tests for v1/connector servlet (Jarcec via Hari Shreedharan) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/208d5daf Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/208d5daf Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/208d5daf Branch: refs/heads/sqoop2 Commit: 208d5daf458e4dc1eebfcd3b2b4efb582c188275 Parents: a3c3747 Author: Hari Shreedharan <[email protected]> Authored: Fri Sep 18 12:14:31 2015 -0700 Committer: Hari Shreedharan <[email protected]> Committed: Fri Sep 18 12:14:31 2015 -0700 ---------------------------------------------------------------------- .../server/InvalidRESTCallsTest.java | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/208d5daf/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java b/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java index da3a6ea..be2ac04 100644 --- a/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java +++ b/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java @@ -116,6 +116,41 @@ public class InvalidRESTCallsTest extends SqoopTestCase { assertResponseCode(500); assertServerException("org.apache.sqoop.server.common.ServerError", "SERVER_0002"); }}), + + // End point /v1/connector + new TestDescription("Get all connectors", "v1/connector/all", "GET", null, new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(200); + }}), + new TestDescription("Get connector by ID", "v1/connector/1", "GET", null, new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(200); + }}), + new TestDescription("Get connector by name", "v1/connector/generic-jdbc-connector", "GET", null, new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(200); + }}), + new TestDescription("Get connector by non-existing ID", "v1/connector/666", "GET", null, new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(500); + assertServerException("org.apache.sqoop.error.code.CommonRepositoryError", "COMMON_0057"); + }}), + new TestDescription("Get connector by non-existing name", "v1/connector/jarcecs-cool-connector", "GET", null, new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(500); + assertServerException("org.apache.sqoop.server.common.ServerError", "SERVER_0005"); + }}), + new TestDescription("Invalid post request", "v1/connector", "POST", "Random data", new Validator() { + @Override + void validate() throws Exception { + assertResponseCode(500); + assertServerException("org.apache.sqoop.server.common.ServerError", "SERVER_0002"); + }}), }; @DataProvider(name="invalid-rest-calls-test", parallel=false) @@ -158,6 +193,8 @@ public class InvalidRESTCallsTest extends SqoopTestCase { LOG.info("error = " + desc.validator.error); LOG.info("input = " + desc.validator.input); desc.validator.validate(); + + LOG.info("End: " + getTestName()); } }
