2 * ============LICENSE_START=======================================================
3 * Copyright (c) 2024 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an 'AS IS' BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.ncmp.api.impl.events.cmsubscription
23 import org.onap.cps.ncmp.api.impl.events.cmsubscription.producer.CmNotificationSubscriptionNcmpOutEventProducer
24 import org.onap.cps.ncmp.api.impl.events.cmsubscription.producer.CmNotificationSubscriptionDmiInEventProducer
25 import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.ncmp_to_dmi.CmNotificationSubscriptionDmiInEvent
26 import org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.ncmp_to_client.CmNotificationSubscriptionNcmpOutEvent
27 import spock.lang.Specification
29 class CmNotificationSubscriptionEventsHandlerSpec extends Specification {
31 def mockCmNotificationSubscriptionNcmpOutEventProducer = Mock(CmNotificationSubscriptionNcmpOutEventProducer)
32 def mockCmNotificationSubscriptionDmiInEventProducer = Mock(CmNotificationSubscriptionDmiInEventProducer)
34 def objectUnderTest = new CmNotificationSubscriptionEventsHandler(mockCmNotificationSubscriptionNcmpOutEventProducer,
35 mockCmNotificationSubscriptionDmiInEventProducer)
37 def 'Publish cm notification subscription ncmp out event'() {
38 given: 'an ncmp out event'
39 def cmNotificationSubscriptionNcmpOutEvent = new CmNotificationSubscriptionNcmpOutEvent()
40 when: 'the method to publish cm notification subscription ncmp out event is called'
41 objectUnderTest.publishCmNotificationSubscriptionNcmpOutEvent("some-id",
42 "some-event", cmNotificationSubscriptionNcmpOutEvent, true)
43 then: 'the parameters is delegated to the correct method once'
44 1 * mockCmNotificationSubscriptionNcmpOutEventProducer.publishCmNotificationSubscriptionNcmpOutEvent(
45 "some-id", "some-event", cmNotificationSubscriptionNcmpOutEvent, true)
48 def 'Publish cm notification subscription dmi in event'() {
49 given: 'a dmi in event'
50 def cmNotificationSubscriptionDmiInEvent = new CmNotificationSubscriptionDmiInEvent()
51 when: 'the method to publish cm notification subscription ncmp out event is called'
52 objectUnderTest.publishCmNotificationSubscriptionDmiInEvent("some-id",
53 "some-dmi", "some-event", cmNotificationSubscriptionDmiInEvent)
54 then: 'the parameters is delegated to the correct method once'
55 1 * mockCmNotificationSubscriptionDmiInEventProducer.publishCmNotificationSubscriptionDmiInEvent("some-id",
56 "some-dmi", "some-event", cmNotificationSubscriptionDmiInEvent)