bc2df10ce310902b3640e6df9806b6f882d8e2de
[cps.git] /
1 /*
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
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.ncmp.impl.cmnotificationsubscription
22
23 import org.onap.cps.ncmp.impl.cmnotificationsubscription.dmi.DmiInEventProducer
24 import org.onap.cps.ncmp.impl.cmnotificationsubscription.ncmp.NcmpOutEventProducer
25 import org.onap.cps.ncmp.impl.cmnotificationsubscription_1_0_0.ncmp_to_client.NcmpOutEvent
26 import org.onap.cps.ncmp.impl.cmnotificationsubscription_1_0_0.ncmp_to_dmi.DmiInEvent
27 import spock.lang.Specification
28
29 class EventsFacadeSpec extends Specification {
30
31     def mockCmNotificationSubscriptionNcmpOutEventProducer = Mock(NcmpOutEventProducer)
32     def mockCmNotificationSubscriptionDmiInEventProducer = Mock(DmiInEventProducer)
33
34     def objectUnderTest = new EventsFacade(mockCmNotificationSubscriptionNcmpOutEventProducer,
35         mockCmNotificationSubscriptionDmiInEventProducer)
36
37     def 'Publish cm notification subscription ncmp out event'() {
38         given: 'an ncmp out event'
39             def ncmpOutEvent = new NcmpOutEvent()
40         when: 'the method to publish cm notification subscription ncmp out event is called'
41             objectUnderTest.publishNcmpOutEvent("some-id",
42                 "some-event", ncmpOutEvent, true)
43         then: 'the parameters is delegated to the correct method once'
44             1 * mockCmNotificationSubscriptionNcmpOutEventProducer.publishNcmpOutEvent(
45                 "some-id", "some-event", ncmpOutEvent, true)
46     }
47
48     def 'Publish cm notification subscription dmi in event'() {
49         given: 'a dmi in event'
50             def dmiInEvent = new DmiInEvent()
51         when: 'the method to publish cm notification subscription ncmp out event is called'
52             objectUnderTest.publishDmiInEvent("some-id",
53                 "some-dmi", "some-event", dmiInEvent)
54         then: 'the parameters is delegated to the correct method once'
55             1 * mockCmNotificationSubscriptionDmiInEventProducer.publishDmiInEvent("some-id",
56                 "some-dmi", "some-event", dmiInEvent)
57     }
58 }