Skip to content

Commit

Permalink
Remove legacy endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
AMeng committed Jan 12, 2016
1 parent c4ca24e commit 6f8e480
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,4 @@ class BuildController {
buildService.getBuild(buildMaster, job, number)
}

// LEGACY ENDPOINTS:

@RequestMapping(value = "/builds", method = RequestMethod.GET)
List<String> getBuildMastersLegacy() {
buildService.getBuildMasters()
}

@RequestMapping(value = "/builds/{buildMaster}/jobs", method = RequestMethod.GET)
List<String> 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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
}
}

0 comments on commit 6f8e480

Please sign in to comment.