Skip to content

Commit

Permalink
FDP-2551: Fixed integration test
Browse files Browse the repository at this point in the history
Can't predict the order and exact content, simplified to just check for a known property in the message

Signed-off-by: Sander Verbruggen <sander.verbruggen@alliander.com>
  • Loading branch information
sanderv committed Oct 30, 2024
1 parent fc83127 commit 490ea18
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: Apache-2.0
package org.gxf.crestdevicesimulator

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper
import java.net.URI
import java.time.Duration
Expand All @@ -15,17 +14,14 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.core.io.ClassPathResource

@SpringBootTest
class SimulatorIntegrationTest {

@Value("\${simulator.config.uri}") private lateinit var uri: URI

private val mapper = ObjectMapper()
private lateinit var coapServer: CoapServer
private val coapResourceStub = CoapResourceStub()
private val expectedJsonNode = mapper.readTree(ClassPathResource("messages/kod-message.json").file)

@BeforeEach
fun setup() {
Expand All @@ -39,7 +35,7 @@ class SimulatorIntegrationTest {
fun shouldSendCoapRequestToConfiguredEndpoint() {
Awaitility.await().atMost(Duration.ofSeconds(5)).untilAsserted {
val jsonNodeStub = CBORMapper().readTree(coapResourceStub.lastRequestPayload)
assertThat(jsonNodeStub).isEqualTo(expectedJsonNode)
assertThat(jsonNodeStub.has("FMC")).isTrue()
}
}
}
4 changes: 0 additions & 4 deletions application/src/integrationTest/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ spring:

simulator:
config:
scheduled-message: "classpath:messages/kod-message.json"
success-message: "classpath:messages/psk-change-success-message.json"
failure-message: "classpath:messages/psk-change-failure-message.json"
reboot-success-message: "classpath:messages/kod-reboot-success-message.json"
# Simulator will produce valid/invalid CBOR messages
produce-valid-cbor: true
# Uri of the target coap server
Expand Down
185 changes: 0 additions & 185 deletions application/src/integrationTest/resources/messages/kod-message.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 490ea18

Please sign in to comment.