bump the version
[dmaap/messagerouter/msgrtr.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 static org.junit.Assert.*;
24
25 import java.io.ByteArrayInputStream;
26 import java.io.IOException;
27 import java.io.InputStream;
28
29 import org.onap.dmaap.dmf.mr.CambriaApiException;
30 import org.onap.dmaap.dmf.mr.backends.ConsumerFactory.UnavailableException;
31 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
32 import org.onap.dmaap.dmf.mr.metabroker.Broker.TopicExistsException;
33 import org.onap.dmaap.dmf.mr.service.impl.BaseTransactionDbImpl;
34 import org.onap.dmaap.dmf.mr.transaction.DMaaPTransactionObjDB.KeyExistsException;
35 import com.att.nsa.configs.ConfigDbException;
36 import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
37 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
38
39 import org.junit.After;
40 import org.junit.Before;
41 import org.junit.Test;
42
43 public class BaseTransactionDbImplTest {
44
45         @Before
46         public void setUp() throws Exception {
47         }
48
49         @After
50         public void tearDown() throws Exception {
51         }
52         
53         @Test
54         public void testCreateTransactionObj() {
55                 
56                 
57                 try {
58                         
59                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
60                         service.createTransactionObj("transition");
61                 } catch (org.json.JSONException e) {
62                         // TODO Auto-generated catch block
63                         e.printStackTrace();
64                 } catch (NullPointerException e) {
65                         // TODO Auto-generated catch block
66                         //e.printStackTrace();
67                         assertTrue(true);
68                 } catch (KeyExistsException e) {
69                         // TODO Auto-generated catch block
70                         e.printStackTrace();
71                 } catch (ConfigDbException e) {
72                         // TODO Auto-generated catch block
73                         e.printStackTrace();
74                 }               
75                 
76                 String trueValue = "True";
77                 assertTrue(trueValue.equalsIgnoreCase("True"));
78                 
79         }
80         
81         @Test
82         public void testSaveTransactionObj() {
83                 
84                 
85                 try {
86                         
87                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
88                         service.saveTransactionObj(null);
89                 } catch (org.json.JSONException e) {
90                         // TODO Auto-generated catch block
91                         e.printStackTrace();
92                 } catch (NullPointerException e) {
93                         // TODO Auto-generated catch block
94                         //e.printStackTrace();
95                         assertTrue(true);
96                 } catch (ConfigDbException e) {
97                         // TODO Auto-generated catch block
98                         e.printStackTrace();
99                 }               
100                 
101                 String trueValue = "True";
102                 assertTrue(trueValue.equalsIgnoreCase("True"));
103                 
104         }
105         
106         @Test
107         public void testLoadTransactionObj() {
108                 
109                 try {
110                         
111                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
112                         service.loadTransactionObj("34");
113                 } catch (org.json.JSONException e) {
114                         // TODO Auto-generated catch block
115                         e.printStackTrace();
116                 } catch (NullPointerException e) {
117                         // TODO Auto-generated catch block
118                         //e.printStackTrace();
119                         assertTrue(true);
120                 } catch (ConfigDbException e) {
121                         // TODO Auto-generated catch block
122                         e.printStackTrace();
123                 }               
124                 
125                 String trueValue = "True";
126                 assertTrue(trueValue.equalsIgnoreCase("True"));
127                 
128         }
129         
130
131         @Test
132         public void testLoadAllTransactionObjs() {
133                 
134                 try {
135                         
136                         BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
137                         service.loadAllTransactionObjs();
138                 } catch (org.json.JSONException e) {
139                         // TODO Auto-generated catch block
140                         e.printStackTrace();
141                 } catch (NullPointerException e) {
142                         // TODO Auto-generated catch block
143                         //e.printStackTrace();
144                         assertTrue(true);
145                 } catch (ConfigDbException e) {
146                         // TODO Auto-generated catch block
147                         e.printStackTrace();
148                 }               
149                 
150                 String trueValue = "True";
151                 assertTrue(trueValue.equalsIgnoreCase("True"));
152                 
153         }
154
155
156         
157         
158 }