Merge "Fix sonar issues in SchemaGenerator"
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / config / AAIDmaapEventJMSConsumerBeanTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Nokia. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *    http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.aai.config;
22
23 import static org.junit.Assert.assertNotNull;
24
25 import org.apache.activemq.ActiveMQConnectionFactory;
26 import org.apache.activemq.broker.BrokerService;
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 import org.onap.aai.dmaap.AAIDmaapEventJMSConsumer;
30 import org.onap.aai.dmaap.AAIDmaapEventJMSProducer;
31 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.beans.factory.annotation.Qualifier;
33 import org.springframework.boot.test.mock.mockito.MockBean;
34 import org.springframework.context.ApplicationContext;
35 import org.springframework.test.context.ActiveProfiles;
36 import org.springframework.test.context.ContextConfiguration;
37 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
38 import org.springframework.test.context.support.AnnotationConfigContextLoader;
39
40 /**
41  * Created by Bogumil Zebek on 6/25/18.
42  */
43 @RunWith(SpringJUnit4ClassRunner.class)
44 @ContextConfiguration(classes = {DmaapConfig.class,
45     EventClientPublisher.class}, loader = AnnotationConfigContextLoader.class)
46 @ActiveProfiles(profiles = "dmaap")
47 public class AAIDmaapEventJMSConsumerBeanTest {
48
49     @MockBean
50     AAIDmaapEventJMSProducer jmsProducer;
51
52     @MockBean
53     BrokerService brokerService;
54
55     @MockBean
56     ActiveMQConnectionFactory activeMQConnectionFactory;
57
58     @Autowired
59     @Qualifier("jmsConsumer")
60     AAIDmaapEventJMSConsumer jmsConsumer;
61
62     @Autowired
63     private ApplicationContext ctx;
64
65     @Test
66     public void shouldCreateJmsConsumerProperly_allDependenciesInjectedByContainer() {
67         assertNotNull(jmsConsumer);
68     }
69
70 }