-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pivotal ID # 177413307: Report Submissions With Errors (#368)
* Pivotal ID # 177413307: Report Submissions With Errors - Slack notification for submission with errors at processing level - Create a new queue to log the problems in order to be used for later verification
- Loading branch information
1 parent
c85b64f
commit 096005e
Showing
17 changed files
with
256 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
coverage=0.84 | ||
coverage=0.41 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
commons/commons-http/src/test/kotlin/ebi/ac/uk/commons/http/slack/NotificationsSenderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ebi.ac.uk.commons.http.slack | ||
|
||
import io.mockk.every | ||
import io.mockk.impl.annotations.MockK | ||
import io.mockk.junit5.MockKExtension | ||
import io.mockk.slot | ||
import io.mockk.verify | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.http.HttpEntity | ||
import org.springframework.http.MediaType.APPLICATION_JSON | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.client.RestTemplate | ||
import org.springframework.web.client.postForEntity | ||
import java.util.Optional | ||
|
||
@ExtendWith(MockKExtension::class) | ||
class NotificationsSenderTest( | ||
@MockK private val restTemplate: RestTemplate | ||
) { | ||
private val testInstance = NotificationsSender(restTemplate, "http://notifications:8080") | ||
|
||
@Test | ||
fun send() { | ||
val requestSlot = slot<HttpEntity<Notification>>() | ||
val notification = Report("system", "subsystem", "result") | ||
|
||
every { | ||
restTemplate.postForEntity<String>("http://notifications:8080", capture(requestSlot)) | ||
} returns ResponseEntity.of(Optional.of("")) | ||
|
||
testInstance.send(notification) | ||
|
||
val request = requestSlot.captured | ||
assertThat(request.headers.contentType).isEqualTo(APPLICATION_JSON) | ||
assertThat(request.headers.accept).containsExactly(APPLICATION_JSON) | ||
assertThat(request.body).isEqualTo(notification.asNotification()) | ||
verify(exactly = 1) { restTemplate.postForEntity<String>("http://notifications:8080", request) } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...odel-extended/src/main/kotlin/ebi/ac/uk/extended/events/FailedSubmissionRequestMessage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ebi.ac.uk.extended.events | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import ebi.ac.uk.extended.model.FileMode | ||
|
||
data class FailedSubmissionRequestMessage( | ||
@JsonProperty("accNo") | ||
val accNo: String, | ||
|
||
@JsonProperty("version") | ||
val version: Int, | ||
|
||
@JsonProperty("fileMode") | ||
val fileMode: FileMode, | ||
|
||
@JsonProperty("draftKey") | ||
val draftKey: String?, | ||
|
||
@JsonProperty("errorMessage") | ||
val errorMessage: String? | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.