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.springframework.beans.factory.annotation.Autowired;
30 import org.springframework.beans.factory.annotation.Value;
31 import org.springframework.boot.test.context.SpringBootTest;
32 import org.springframework.kafka.core.KafkaTemplate;
33 import org.springframework.kafka.test.context.EmbeddedKafka;
34 import org.springframework.test.annotation.DirtiesContext;
37 @SpringBootTest(properties = { "model-loader.sdc.connection.enabled=true"})
38 @EmbeddedKafka(partitions = 1, brokerProperties = { "listeners=PLAINTEXT://localhost:9092", "port=9092" })
39 public class NotificationIntegrationTest {
41 @Autowired EventCallbackAspect eventCallbackAspect;
44 private KafkaTemplate<String, String> kafkaTemplate;
46 @Value("${test.topic}")
50 @Disabled("This test is not yet implemented")
51 public void thatActivateCallbackIsCalled()
55 // TODO: send distribution event here
56 kafkaTemplate.send(topic, data);
58 // TODO: mock distribution client requests to /sdc/v1/artifactTypes
59 // TODO: mock distribution client requests to /sdc/v1/distributionKafkaData
61 // aspect will wait for EventCallback.activateCallback to be called
62 eventCallbackAspect.setCountDownLatch(new CountDownLatch(1));
63 boolean callbackCalled = eventCallbackAspect.getCountDownLatch().await(10, TimeUnit.SECONDS);
64 assertTrue(callbackCalled);