From 6f8e480ae96675ed0e395c64d1cf8c593f1452c0 Mon Sep 17 00:00:00 2001 From: AMeng Date: Tue, 29 Dec 2015 15:32:15 -0700 Subject: [PATCH] Remove legacy endpoints --- .../gate/controllers/BuildController.groovy | 26 -------- .../controllers/BuildControllerSpec.groovy | 61 ------------------- 2 files changed, 87 deletions(-) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy index 9fe3be7249..d511cf20df 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/BuildController.groovy @@ -65,30 +65,4 @@ class BuildController { buildService.getBuild(buildMaster, job, number) } - // LEGACY ENDPOINTS: - - @RequestMapping(value = "/builds", method = RequestMethod.GET) - List getBuildMastersLegacy() { - buildService.getBuildMasters() - } - - @RequestMapping(value = "/builds/{buildMaster}/jobs", method = RequestMethod.GET) - List getJobsForBuildMasterLegacy(@PathVariable("buildMaster") String buildMaster) { - buildService.getJobsForBuildMaster(buildMaster) - } - - @RequestMapping(value = "/builds/{buildMaster}/jobs/{job:.+}", method = RequestMethod.GET) - Map getJobConfigLegacy(@PathVariable("buildMaster") String buildMaster, @PathVariable("job") String job) { - buildService.getJobConfig(buildMaster, job) - } - - @RequestMapping(value = "/builds/{buildMaster}/jobs/{job}/builds", method = RequestMethod.GET) - List getBuildsLegacy(@PathVariable("buildMaster") String buildMaster, @PathVariable("job") String job) { - buildService.getBuilds(buildMaster, job) - } - - @RequestMapping(value = "/builds/{buildMaster}/jobs/{job}/builds/{number}", method = RequestMethod.GET) - Map getBuildsLegacy(@PathVariable("buildMaster") String buildMaster, @PathVariable("job") String job, @PathVariable("number") String number) { - buildService.getBuild(buildMaster, job, number) - } } diff --git a/gate-web/src/test/groovy/com/netflix/spinnaker/gate/controllers/BuildControllerSpec.groovy b/gate-web/src/test/groovy/com/netflix/spinnaker/gate/controllers/BuildControllerSpec.groovy index d483668b90..0106045f06 100644 --- a/gate-web/src/test/groovy/com/netflix/spinnaker/gate/controllers/BuildControllerSpec.groovy +++ b/gate-web/src/test/groovy/com/netflix/spinnaker/gate/controllers/BuildControllerSpec.groovy @@ -113,65 +113,4 @@ class BuildControllerSpec extends Specification { response.contentAsString == "{\"building\":false,\"number\":${BUILD_NUMBER}}" } - // LEGACY ENDPOINT TESTS: - - void 'should get a list of masters LEGACY'() { - given: - 1 * igorService.getBuildMasters() >> [MASTER, "master2"] - - when: - MockHttpServletResponse response = mockMvc.perform(get("/builds") - .accept(MediaType.APPLICATION_JSON)).andReturn().response - - then: - response.contentAsString == "[\"${MASTER}\",\"master2\"]" - } - - void 'should get a list of jobs for a master LEGACY'() { - given: - 1 * igorService.getJobsForBuildMaster(MASTER) >> [JOB_NAME_LEGACY, "another_job"] - - when: - MockHttpServletResponse response = mockMvc.perform(get("/builds/${MASTER}/jobs") - .accept(MediaType.APPLICATION_JSON)).andReturn().response - - then: - response.contentAsString == "[\"${JOB_NAME_LEGACY}\",\"another_job\"]" - } - - void 'should get a list of builds for a job LEGACY'() { - given: - 1 * igorService.getBuilds(MASTER, JOB_NAME_LEGACY) >> [["building":false, "number":111], ["building":false, "number":222]] - - when: - MockHttpServletResponse response = mockMvc.perform(get("/builds/${MASTER}/jobs/${JOB_NAME_LEGACY}/builds") - .accept(MediaType.APPLICATION_JSON)).andReturn().response - - then: - response.contentAsString == "[{\"building\":false,\"number\":111},{\"building\":false,\"number\":222}]" - } - - void 'should get a job config LEGACY'() { - given: - 1 * igorService.getJobConfig(MASTER, JOB_NAME_LEGACY) >> ['name': JOB_NAME_LEGACY, 'url': "http://test.com/job/${JOB_NAME_LEGACY}".toString()] - - when: - MockHttpServletResponse response = mockMvc.perform(get("/builds/${MASTER}/jobs/${JOB_NAME_LEGACY}") - .accept(MediaType.APPLICATION_JSON)).andReturn().response - - then: - response.contentAsString == "{\"name\":\"${JOB_NAME_LEGACY}\",\"url\":\"http://test.com/job/${JOB_NAME_LEGACY}\"}" - } - - void 'should get a build LEGACY'() { - given: - 1 * igorService.getBuild(MASTER, JOB_NAME_LEGACY, BUILD_NUMBER.toString()) >> ["building":false, "number":BUILD_NUMBER] - - when: - MockHttpServletResponse response = mockMvc.perform(get("/builds/${MASTER}/jobs/${JOB_NAME_LEGACY}/builds/${BUILD_NUMBER}/") - .accept(MediaType.APPLICATION_JSON)).andReturn().response - - then: - response.contentAsString == "{\"building\":false,\"number\":${BUILD_NUMBER}}" - } }