Skip to content

Commit

Permalink
reverted few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seran committed Oct 24, 2023
1 parent e4ecad1 commit fbdc780
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,36 @@ class WmUrlOpenRest {
}


// @GetMapping(path = ["/object"])
// fun getObject() : ResponseEntity<String> {
//
// val url = URL("http://hello.there:8877/api/object")
// val connection = url.openConnection()
// connection.setRequestProperty("accept", "application/json")
//
// val mapper = ObjectMapper()
// val dto = mapper.readValue(connection.getInputStream(), WmUrlOpenDto::class.java)
//
// return if (dto.x!! > 0){
// ResponseEntity.ok("OK")
// } else{
// ResponseEntity.status(500).build()
// }
// }

// @GetMapping(path = ["/sstring"])
// fun getSString() : ResponseEntity<String> {
//
// val url = URL("https://hello.there:8443/api/string")
// val connection = url.openConnection()
// connection.setRequestProperty("accept", "application/json")
// val data = connection.getInputStream().bufferedReader().use(BufferedReader::readText)
//
// return if (data == "\"HELLO THERE!!!\""){
// ResponseEntity.ok("OK")
// } else{
// ResponseEntity.status(500).build()
// }
// }
@GetMapping(path = ["/object"])
fun getObject() : ResponseEntity<String> {

val url = URL("http://hello.there:8877/api/object")
val connection = url.openConnection()
connection.setRequestProperty("accept", "application/json")

val mapper = ObjectMapper()
val dto = mapper.readValue(connection.getInputStream(), WmUrlOpenDto::class.java)

return if (dto.x!! > 0){
ResponseEntity.ok("OK")
} else{
ResponseEntity.status(500).build()
}
}

@GetMapping(path = ["/sstring"])
fun getSString() : ResponseEntity<String> {

val url = URL("https://hello.there:8443/api/string")
val connection = url.openConnection()
connection.setRequestProperty("accept", "application/json")
val data = connection.getInputStream().bufferedReader().use(BufferedReader::readText)

return if (data == "\"HELLO THERE!!!\""){
ResponseEntity.ok("OK")
} else{
ResponseEntity.status(500).build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class WmUrlOpenEMTest : SpringTestBase() {

assertTrue(solution.individuals.size >= 1)
assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/api/wm/urlopen/string", "OK")
// assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/api/wm/urlopen/sstring", "OK")
assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/api/wm/urlopen/sstring", "OK")

if(!CIUtils.isRunningGA()) {
//FIXME: this weird... fails on CI, even when incresing budget significantly... but passes local on all OS
// assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/api/wm/urlopen/object", "OK")
assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/api/wm/urlopen/object", "OK")
}
},
3,
Expand Down

0 comments on commit fbdc780

Please sign in to comment.