Skip to content

Commit

Permalink
PI-483 Removed messaging/client dependencies (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Oct 21, 2022
1 parent 5944875 commit f1641e1
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 122 deletions.
9 changes: 1 addition & 8 deletions projects/approved-premises-and-delius/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ dependencies {
implementation(project(":libs:oauth-client"))
implementation(project(":libs:oauth-server"))

implementation("org.springframework:spring-jms")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
Expand All @@ -17,13 +16,11 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation(libs.amazon.sqs)
implementation(libs.openfeign)
implementation(libs.sentry)
implementation(libs.swagger.docs)

dev(project(":libs:dev-tools"))
dev("org.springframework.boot:spring-boot-starter-activemq")
dev("com.h2database:h2")
dev(libs.hawtio)

Expand All @@ -34,9 +31,5 @@ dependencies {
}

configure<ClassPathExtension> {
jacocoExclusions = listOf(
"**/config/**",
"**/entity/**",
"**/AppKt.class"
)
jacocoExclusions = listOf("**/AppKt.class")
}
1 change: 0 additions & 1 deletion projects/approved-premises-and-delius/deploy/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ secrets:
SPRING_DATASOURCE_URL: /delius-database/jdbc-url
SPRING_DATASOURCE_USERNAME: /approved-premises-and-delius/db-username
SPRING_DATASOURCE_PASSWORD: /approved-premises-and-delius/db-password
SPRING_JMS_TEMPLATE_DEFAULT-DESTINATION: /approved-premises-and-delius/sqs-queue-name
OAUTH2_CLIENT-ID: /approved-premises-and-delius/client-id
OAUTH2_CLIENT-SECRET: /approved-premises-and-delius/client-secret
SENTRY_DSN: /approved-premises-and-delius/sentry-dsn
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,22 @@ package uk.gov.justice.digital.hmpps

import com.github.tomakehurst.wiremock.WireMockServer
import org.junit.jupiter.api.Test
import org.mockito.Mockito.atLeastOnce
import org.mockito.kotlin.verify
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
import org.springframework.boot.test.mock.mockito.MockBean
import org.springframework.jms.core.JmsTemplate
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import uk.gov.justice.digital.hmpps.data.generator.MessageGenerator
import uk.gov.justice.digital.hmpps.jms.convertSendAndWait
import uk.gov.justice.digital.hmpps.message.Notification
import uk.gov.justice.digital.hmpps.security.withOAuth2Token
import uk.gov.justice.digital.hmpps.telemetry.TelemetryService
import java.util.concurrent.TimeoutException

@AutoConfigureMockMvc
@ActiveProfiles("integration-test")
@SpringBootTest(webEnvironment = RANDOM_PORT)
internal class IntegrationTest {
@Value("\${spring.jms.template.default-destination}") lateinit var queueName: String

@Autowired lateinit var mockMvc: MockMvc
@Autowired lateinit var wireMockServer: WireMockServer
@Autowired lateinit var jmsTemplate: JmsTemplate

@MockBean lateinit var telemetryService: TelemetryService

@Test
fun `message is logged to telemetry`() {
// Given a message
val notification = Notification(message = MessageGenerator.EXAMPLE)

// When it is received
try {
jmsTemplate.convertSendAndWait(queueName, notification)
} catch (_: TimeoutException) {
// Note: Remove this try/catch when the MessageListener logic has been implemented
}

// Then it is logged to telemetry
verify(telemetryService, atLeastOnce()).notificationReceived(notification)
}

@Test
fun `API call retuns a success response`() {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit f1641e1

Please sign in to comment.