if ("subscriptionCreated".equals(subscriptionType)) {
sendSubscriptionResponseMessage(eventKey, "subscriptionCreatedStatus",
formSubscriptionEventResponse(subscriptionEvent));
+ } else if ("subscriptionDeleted".equals(subscriptionType)) {
+ sendSubscriptionResponseMessage(eventKey, "subscriptionDeletedStatus",
+ formSubscriptionEventResponse(subscriptionEvent));
}
}
}
final String subscriptionType,
final String dmiName) {
try {
- return CloudEventBuilder.v1().withId(UUID.randomUUID().toString())
+ return CloudEventBuilder.v1()
+ .withId(UUID.randomUUID().toString())
.withSource(URI.create(dmiName))
.withType(subscriptionType)
.withDataSchema(URI.create("urn:cps:" + SubscriptionEventResponse.class.getName() + ":1.0.0"))
def subscriptionEvent = objectMapper.readValue(jsonData, SubscriptionEvent.class)
objectUnderTest.cmAvcSubscriptionResponseTopic = testTopic
def cloudEvent = CloudEventBuilder.v1().withId(UUID.randomUUID().toString()).withSource(URI.create('test-ncmp-dmi'))
- .withType("subscriptionCreated")
+ .withType(subscriptionType)
.withDataSchema(URI.create("urn:cps:" + SubscriptionEvent.class.getName() + ":1.0.0"))
.withExtension("correlationid", eventKey)
.withTime(OffsetDateTime.ofInstant(timestamp.toInstant(), ZoneId.of("UTC")))
objectUnderTest.consumeSubscriptionEvent(testEventSent)
then: 'no exception is thrown'
noExceptionThrown()
+ where: 'given #senario'
+ scenario | subscriptionType
+ 'Subscription Create Event' | "subscriptionCreated"
+ 'Subscription Delete Event' | "subscriptionDeleted"
}
def 'Consume invalid message.'() {