2 * ========================LICENSE_START=================================
5 * Copyright (C) 2023 Nordix Foundation
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.oran.pmlog;
23 import static org.junit.jupiter.api.Assertions.assertNotNull;
25 import org.junit.jupiter.api.Test;
26 import org.springframework.beans.factory.annotation.Autowired;
27 import org.springframework.boot.test.context.SpringBootTest;
28 import org.springframework.test.context.TestPropertySource;
31 @TestPropertySource(properties = { "server.http-port=8080" }) // Set the http-port property
32 class BeanFactoryTest {
35 private BeanFactory beanFactory;
38 void testApplicationConfigBean() {
39 // Ensure that the ApplicationConfig bean is created
40 assertNotNull(beanFactory.getApplicationConfig());
44 void testServletContainerBean() {
45 // Ensure that the ServletWebServerFactory bean is created
46 assertNotNull(beanFactory.servletContainer());
50 void testKafkaTopicListenerBean() {
51 // Ensure that the KafkaTopicListener bean is created with ApplicationConfig dependency
52 assertNotNull(beanFactory.getKafkaTopicListener(beanFactory.getApplicationConfig()));
56 void testInfluxStoreBean() {
57 // Ensure that the InfluxStore bean is created with ApplicationConfig and KafkaTopicListener dependencies
58 assertNotNull(beanFactory.getInfluxStore(beanFactory.getApplicationConfig(), beanFactory.getKafkaTopicListener(beanFactory.getApplicationConfig())));