|
20 | 20 |
|
21 | 21 | package org.onap.cps.ncmp.impl.datajobs.subscription.ncmp |
22 | 22 |
|
23 | | -import ch.qos.logback.classic.Level |
24 | | -import ch.qos.logback.classic.Logger |
25 | | -import ch.qos.logback.classic.spi.ILoggingEvent |
26 | | -import ch.qos.logback.core.read.ListAppender |
27 | 23 | import com.fasterxml.jackson.databind.ObjectMapper |
| 24 | +import org.onap.cps.ncmp.impl.datajobs.subscription.client_to_ncmp.DataJob |
28 | 25 | import org.onap.cps.ncmp.impl.datajobs.subscription.client_to_ncmp.DataJobSubscriptionOperationInEvent |
| 26 | +import org.onap.cps.ncmp.impl.datajobs.subscription.client_to_ncmp.Event |
29 | 27 | import org.onap.cps.ncmp.impl.utils.JexParser |
30 | 28 | import org.onap.cps.ncmp.utils.TestUtils |
31 | | -import org.slf4j.LoggerFactory |
32 | 29 | import spock.lang.Specification |
33 | 30 |
|
34 | 31 | class NcmpInEventConsumerSpec extends Specification { |
@@ -70,6 +67,18 @@ class NcmpInEventConsumerSpec extends Specification { |
70 | 67 | 1 * mockCmSubscriptionHandler.deleteSubscription("myDataJobId") |
71 | 68 | } |
72 | 69 |
|
| 70 | + def 'Consuming subscription request with unknown event type.'() { |
| 71 | + given: 'a subscription event with invalid event type' |
| 72 | + def invalidEvent = new DataJobSubscriptionOperationInEvent(event:new Event(dataJob: new DataJob(id:'someId')), eventType: 'invalidEventType') |
| 73 | + when: 'the event is consumed' |
| 74 | + objectUnderTest.consumeSubscriptionEvent(invalidEvent) |
| 75 | + then: 'no error thrown' |
| 76 | + noExceptionThrown() |
| 77 | + and: 'request was not delegated to be handled as CREATE or DELETE' |
| 78 | + 0 * mockCmSubscriptionHandler.deleteSubscription(_) |
| 79 | + 0 * mockCmSubscriptionHandler.createSubscription(_) |
| 80 | + } |
| 81 | + |
73 | 82 | def getDataNodeSelectorsAsXpaths(event) { |
74 | 83 | return JexParser.toXpaths(event.event.dataJob.productionJobDefinition.targetSelector.dataNodeSelector) |
75 | 84 | } |
|
0 commit comments