2 * ============LICENSE_START=======================================================
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
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=========================================================
20 package org.onap.aai.modelloader.distribution;
22 import static org.junit.jupiter.api.Assertions.assertTrue;
24 import java.util.concurrent.CountDownLatch;
25 import java.util.concurrent.TimeUnit;
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;
38 @SpringBootTest(properties = { "model-loader.sdc.connection.enabled=true"})
39 @EmbeddedKafka(partitions = 1, ports = 9092, topics = {"${topics.distribution.notification}"})
40 public class NotificationIntegrationTest {
42 @Autowired EventCallbackAspect eventCallbackAspect;
45 private KafkaTemplate<String, NotificationDataImpl> kafkaTemplate;
47 @Value("${topics.distribution.notification}")
51 @Disabled("This test is not yet implemented")
52 public void thatActivateCallbackIsCalled()
54 NotificationDataImpl notificationData = new NotificationDataImpl();
55 notificationData.setDistributionID("distributionID");
57 // TODO: send distribution event here
58 kafkaTemplate.send(topic, notificationData);
60 // TODO: mock distribution client requests to /sdc/v1/artifactTypes
61 // TODO: mock distribution client requests to /sdc/v1/distributionKafkaData
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);