2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.notification.services.impl;
23 import org.junit.Assert;
24 import org.junit.Before;
25 import org.junit.Test;
27 import org.openecomp.sdc.destinationprovider.DestinationProvider;
28 import org.openecomp.sdc.destinationprovider.impl.MulticastDestination;
29 import org.openecomp.sdc.destinationprovider.impl.UnicastDestination;
30 import org.openecomp.sdc.notification.dtos.Event;
31 import org.openecomp.sdc.notification.services.PropagationService;
32 import org.openecomp.sdc.notification.services.SubscriptionService;
34 import static org.mockito.Mockito.verify;
39 * @since July 13, 2017
41 public class NotificationPropagationManagerImplTest {
43 private PropagationService propagationServiceMock;
45 private SubscriptionService subscriptionServiceMock;
47 private Event eventMock;
49 private ArgumentCaptor<DestinationProvider> destinationProviderCaptor;
53 private NotificationPropagationManagerImpl notificationPropagationManager;
56 public void setUp() throws Exception {
57 MockitoAnnotations.initMocks(this);
61 public void shouldCallPropagationServiceNotifyWithMulticastDestinationWhenNotifySubscribers()
63 notificationPropagationManager.notifySubscribers(eventMock);
64 verify(propagationServiceMock).notify(Matchers.eq(eventMock), destinationProviderCaptor
66 Assert.assertTrue(destinationProviderCaptor.getValue() instanceof MulticastDestination);
71 public void shouldCallPropagationServiceNotifyWithUnicastDestinationWhenDirectNotification()
73 notificationPropagationManager.directNotification(eventMock, "aaa");
74 verify(propagationServiceMock).notify(Matchers.eq(eventMock), destinationProviderCaptor
76 Assert.assertTrue(destinationProviderCaptor.getValue() instanceof UnicastDestination);