Refactor babel-related code to not update parameter values
[aai/model-loader.git] / src / test / java / org / onap / aai / modelloader / distribution / NotificationIntegrationTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2024 Deutsche Telekom AG 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
10  *
11  *       http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20 package org.onap.aai.modelloader.distribution;
21
22 import static org.junit.jupiter.api.Assertions.assertTrue;
23
24 import java.util.concurrent.CountDownLatch;
25 import java.util.concurrent.TimeUnit;
26
27 import org.junit.jupiter.api.Disabled;
28 import org.junit.jupiter.api.Test;
29 import org.onap.aai.modelloader.notification.NotificationDataImpl;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.beans.factory.annotation.Value;
32 import org.springframework.boot.test.context.SpringBootTest;
33 import org.springframework.kafka.core.KafkaTemplate;
34 import org.springframework.kafka.test.context.EmbeddedKafka;
35 import org.springframework.test.annotation.DirtiesContext;
36
37 @DirtiesContext
38 @SpringBootTest(properties = { "model-loader.sdc.connection.enabled=true"})
39 @EmbeddedKafka(partitions = 1, ports = 9092, topics = {"${topics.distribution.notification}"})
40 public class NotificationIntegrationTest {
41
42     @Autowired EventCallbackAspect eventCallbackAspect;
43
44     @Autowired
45     private KafkaTemplate<String, NotificationDataImpl> kafkaTemplate;
46
47     @Value("${topics.distribution.notification}")
48     private String topic;
49
50     @Test
51     @Disabled("This test is not yet implemented")
52     public void thatActivateCallbackIsCalled()
53       throws Exception {
54         NotificationDataImpl notificationData = new NotificationDataImpl();
55         notificationData.setDistributionID("distributionID");
56     
57         // TODO: send distribution event here
58         kafkaTemplate.send(topic, notificationData);
59
60         // TODO: mock distribution client requests to /sdc/v1/artifactTypes
61         // TODO: mock distribution client requests to /sdc/v1/distributionKafkaData
62
63         // aspect will wait for EventCallback.activateCallback to be called
64         eventCallbackAspect.setCountDownLatch(new CountDownLatch(1));
65         boolean callbackCalled = eventCallbackAspect.getCountDownLatch().await(10, TimeUnit.SECONDS);
66         assertTrue(callbackCalled);
67     }
68 }