Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FSSDK-10587] chore: rollback to 4.0.0 #491

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,45 +68,45 @@ class ODPSegmentClientTest {
verify(urlConnection).disconnect()
}

// @Test
// fun fetchQualifiedSegments_400() {
// `when`(urlConnection.responseCode).thenReturn(400)
//
// segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
//
// verify(client).execute(captor.capture(), eq(0), eq(0))
// val received = captor.value.execute()
//
// assertNull(received)
// verify(logger).error("Unexpected response from ODP segment endpoint, status: 400")
// verify(urlConnection).disconnect()
// }

// @Test
// fun fetchQualifiedSegments_500() {
// `when`(urlConnection.responseCode).thenReturn(500)
//
// segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
//
// verify(client).execute(captor.capture(), eq(0), eq(0))
// val received = captor.value.execute()
//
// assertNull(received)
// verify(logger).error("Unexpected response from ODP segment endpoint, status: 500")
// verify(urlConnection).disconnect()
// }

// @Test
// fun fetchQualifiedSegments_connectionFailed() {
// `when`(urlConnection.responseCode).thenReturn(200)
//
// apiEndpoint = "invalid-url"
// segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)
//
// verify(client).execute(captor.capture(), eq(0), eq(0))
// val received = captor.value.execute()
//
// assertNull(received)
// verify(logger).error(contains("Error making ODP segment request"), any())
// }
@Test
fun fetchQualifiedSegments_400() {
`when`(urlConnection.responseCode).thenReturn(400)

segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)

verify(client).execute(captor.capture(), eq(0), eq(0))
val received = captor.value.execute()

assertNull(received)
verify(logger).error("Unexpected response from ODP segment endpoint, status: 400")
verify(urlConnection).disconnect()
}

@Test
fun fetchQualifiedSegments_500() {
`when`(urlConnection.responseCode).thenReturn(500)

segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)

verify(client).execute(captor.capture(), eq(0), eq(0))
val received = captor.value.execute()

assertNull(received)
verify(logger).error("Unexpected response from ODP segment endpoint, status: 500")
verify(urlConnection).disconnect()
}

@Test
fun fetchQualifiedSegments_connectionFailed() {
`when`(urlConnection.responseCode).thenReturn(200)

apiEndpoint = "invalid-url"
segmentClient.fetchQualifiedSegments(apiKey, apiEndpoint, payload)

verify(client).execute(captor.capture(), eq(0), eq(0))
val received = captor.value.execute()

assertNull(received)
verify(logger).error(contains("Error making ODP segment request"), any())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,11 @@ open class ODPSegmentClient(private val client: ClientForODPOnly, private val lo
} else {
var errMsg = "Unexpected response from ODP segment endpoint, status: $status"
logger.error(errMsg)
// return@Request null
throw Exception(errMsg)
return@Request null
}
} catch (e: Exception) {
logger.error("Error making ODP segment request", e)
// return@Request null
throw e
return@Request null
} finally {
if (urlConnection != null) {
try {
Expand Down
Loading