DMAAP-MR - Merge MR repos
[dmaap/messagerouter/messageservice.git] / src / test / java / org / onap / dmaap / mr / cambria / service / impl / BaseTransactionDbImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
4  * ================================================================================
5  * Copyright (C) 2017 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
21  package org.onap.dmaap.mr.cambria.service.impl;
22
23 import com.att.nsa.configs.ConfigDbException;
24 import org.junit.After;
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.onap.dmaap.dmf.mr.service.impl.BaseTransactionDbImpl;
28 import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionObjDB.KeyExistsException;
29
30 import static org.junit.Assert.assertTrue;
31
32 public class BaseTransactionDbImplTest {
33
34         @Before
35         public void setUp() throws Exception {
36         }
37
38         @After
39         public void tearDown() throws Exception {
40         }
41         
42         @Test
43         public void testCreateTransactionObj() {
44                 
45                 
46                 try {
47                         
48                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
49                         service.createTransactionObj("transition");
50                 } catch (org.json.JSONException e) {
51                         // TODO Auto-generated catch block
52                         e.printStackTrace();
53                 } catch (NullPointerException e) {
54                         // TODO Auto-generated catch block
55                         //e.printStackTrace();
56                         assertTrue(true);
57                 } catch (KeyExistsException e) {
58                         // TODO Auto-generated catch block
59                         e.printStackTrace();
60                 } catch (ConfigDbException e) {
61                         // TODO Auto-generated catch block
62                         e.printStackTrace();
63                 }               
64                 
65                 String trueValue = "True";
66                 assertTrue(trueValue.equalsIgnoreCase("True"));
67                 
68         }
69         
70         @Test
71         public void testSaveTransactionObj() {
72                 
73                 
74                 try {
75                         
76                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
77                         service.saveTransactionObj(null);
78                 } catch (org.json.JSONException e) {
79                         // TODO Auto-generated catch block
80                         e.printStackTrace();
81                 } catch (NullPointerException e) {
82                         // TODO Auto-generated catch block
83                         //e.printStackTrace();
84                         assertTrue(true);
85                 } catch (ConfigDbException e) {
86                         // TODO Auto-generated catch block
87                         e.printStackTrace();
88                 }               
89                 
90                 String trueValue = "True";
91                 assertTrue(trueValue.equalsIgnoreCase("True"));
92                 
93         }
94         
95         @Test
96         public void testLoadTransactionObj() {
97                 
98                 try {
99                         
100                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
101                         service.loadTransactionObj("34");
102                 } catch (org.json.JSONException e) {
103                         // TODO Auto-generated catch block
104                         e.printStackTrace();
105                 } catch (NullPointerException e) {
106                         // TODO Auto-generated catch block
107                         //e.printStackTrace();
108                         assertTrue(true);
109                 } catch (ConfigDbException e) {
110                         // TODO Auto-generated catch block
111                         e.printStackTrace();
112                 }               
113                 
114                 String trueValue = "True";
115                 assertTrue(trueValue.equalsIgnoreCase("True"));
116                 
117         }
118         
119
120         @Test
121         public void testLoadAllTransactionObjs() {
122                 
123                 try {
124                         
125                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
126                         service.loadAllTransactionObjs();
127                 } catch (org.json.JSONException e) {
128                         // TODO Auto-generated catch block
129                         e.printStackTrace();
130                 } catch (NullPointerException e) {
131                         // TODO Auto-generated catch block
132                         //e.printStackTrace();
133                         assertTrue(true);
134                 } catch (ConfigDbException e) {
135                         // TODO Auto-generated catch block
136                         e.printStackTrace();
137                 }               
138                 
139                 String trueValue = "True";
140                 assertTrue(trueValue.equalsIgnoreCase("True"));
141                 
142         }
143
144
145         
146         
147 }