2 * ============LICENSE_START=======================================================
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
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.onap.dmaap.mr.cambria.service.impl;
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;
30 import static org.junit.Assert.assertTrue;
32 public class BaseTransactionDbImplTest {
35 public void setUp() throws Exception {
39 public void tearDown() throws Exception {
43 public void testCreateTransactionObj() {
48 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
49 service.createTransactionObj("transition");
50 } catch (org.json.JSONException e) {
51 // TODO Auto-generated catch block
53 } catch (NullPointerException e) {
54 // TODO Auto-generated catch block
55 //e.printStackTrace();
57 } catch (KeyExistsException e) {
58 // TODO Auto-generated catch block
60 } catch (ConfigDbException e) {
61 // TODO Auto-generated catch block
65 String trueValue = "True";
66 assertTrue(trueValue.equalsIgnoreCase("True"));
71 public void testSaveTransactionObj() {
76 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
77 service.saveTransactionObj(null);
78 } catch (org.json.JSONException e) {
79 // TODO Auto-generated catch block
81 } catch (NullPointerException e) {
82 // TODO Auto-generated catch block
83 //e.printStackTrace();
85 } catch (ConfigDbException e) {
86 // TODO Auto-generated catch block
90 String trueValue = "True";
91 assertTrue(trueValue.equalsIgnoreCase("True"));
96 public void testLoadTransactionObj() {
100 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
101 service.loadTransactionObj("34");
102 } catch (org.json.JSONException e) {
103 // TODO Auto-generated catch block
105 } catch (NullPointerException e) {
106 // TODO Auto-generated catch block
107 //e.printStackTrace();
109 } catch (ConfigDbException e) {
110 // TODO Auto-generated catch block
114 String trueValue = "True";
115 assertTrue(trueValue.equalsIgnoreCase("True"));
121 public void testLoadAllTransactionObjs() {
125 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
126 service.loadAllTransactionObjs();
127 } catch (org.json.JSONException e) {
128 // TODO Auto-generated catch block
130 } catch (NullPointerException e) {
131 // TODO Auto-generated catch block
132 //e.printStackTrace();
134 } catch (ConfigDbException e) {
135 // TODO Auto-generated catch block
139 String trueValue = "True";
140 assertTrue(trueValue.equalsIgnoreCase("True"));