[DMAAP-BC] Fix failing jenkins
[dmaap/buscontroller.git] / dmaap-bc / src / test / java / org / onap / dmaap / dbcapi / service / MirrorMakerServiceTestMockito.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
4  * ================================================================================
5  * Copyright (C) 2019 AT&T 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.dmaap.dbcapi.service;
21
22 import static org.junit.Assert.assertEquals;
23
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
26 import org.junit.BeforeClass;
27 import org.junit.Rule;
28 import org.junit.Test;
29 import org.junit.rules.ExpectedException;
30 import org.junit.runner.RunWith;
31 import org.mockito.Mock;
32 import org.mockito.Spy;
33 import org.mockito.runners.MockitoJUnitRunner;
34 import org.onap.aaf.cadi.filter.CadiFilter;
35 import org.onap.dmaap.dbcapi.model.MirrorMaker;
36 import org.onap.dmaap.dbcapi.util.DmaapConfig;
37
38 @RunWith(MockitoJUnitRunner.class)
39 public class MirrorMakerServiceTestMockito {
40
41     @Spy
42     private MirrorMakerService service;
43
44     @Mock
45     private CadiFilter cadiFilterMock;
46     @Mock
47     private HttpServletRequest servletRequest;
48     @Mock
49     private HttpServletResponse servletResponse;
50    
51     @Mock
52     private DmaapConfig dmaapConfig;
53     
54     @Mock
55     private MirrorMaker mm = new MirrorMaker();
56
57     @Rule
58     public ExpectedException thrown = ExpectedException.none();
59
60     @BeforeClass
61     public static void setUpClass() throws Exception {
62         System.setProperty("ConfigFile", "src/test/resources/dmaapbc.properties");
63     }
64
65     @Test
66     public void init_normalConstructor() {
67         assertEquals( MirrorMakerService.getProvUserPwd(), MirrorMakerService.PROV_PWD_DEFAULT);
68         assertEquals( MirrorMakerService.getDefaultConsumerPort(), MirrorMakerService.TARGET_REPLICATION_PORT_DEFAULT);
69         assertEquals( MirrorMakerService.getDefaultProducerPort(), MirrorMakerService.SOURCE_REPLICATION_PORT_DEFAULT);
70     }
71
72 }