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 static org.junit.Assert.*;
25 import java.io.ByteArrayInputStream;
26 import java.io.IOException;
27 import java.io.InputStream;
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;
39 import org.junit.After;
40 import org.junit.Before;
41 import org.junit.Test;
43 public class BaseTransactionDbImplTest {
46 public void setUp() throws Exception {
50 public void tearDown() throws Exception {
54 public void testCreateTransactionObj() {
59 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
60 service.createTransactionObj("transition");
61 } catch (org.json.JSONException e) {
62 // TODO Auto-generated catch block
64 } catch (NullPointerException e) {
65 // TODO Auto-generated catch block
66 //e.printStackTrace();
68 } catch (KeyExistsException e) {
69 // TODO Auto-generated catch block
71 } catch (ConfigDbException e) {
72 // TODO Auto-generated catch block
76 String trueValue = "True";
77 assertTrue(trueValue.equalsIgnoreCase("True"));
82 public void testSaveTransactionObj() {
87 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
88 service.saveTransactionObj(null);
89 } catch (org.json.JSONException e) {
90 // TODO Auto-generated catch block
92 } catch (NullPointerException e) {
93 // TODO Auto-generated catch block
94 //e.printStackTrace();
96 } catch (ConfigDbException e) {
97 // TODO Auto-generated catch block
101 String trueValue = "True";
102 assertTrue(trueValue.equalsIgnoreCase("True"));
107 public void testLoadTransactionObj() {
111 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
112 service.loadTransactionObj("34");
113 } catch (org.json.JSONException e) {
114 // TODO Auto-generated catch block
116 } catch (NullPointerException e) {
117 // TODO Auto-generated catch block
118 //e.printStackTrace();
120 } catch (ConfigDbException e) {
121 // TODO Auto-generated catch block
125 String trueValue = "True";
126 assertTrue(trueValue.equalsIgnoreCase("True"));
132 public void testLoadAllTransactionObjs() {
136 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
137 service.loadAllTransactionObjs();
138 } catch (org.json.JSONException e) {
139 // TODO Auto-generated catch block
141 } catch (NullPointerException e) {
142 // TODO Auto-generated catch block
143 //e.printStackTrace();
145 } catch (ConfigDbException e) {
146 // TODO Auto-generated catch block
150 String trueValue = "True";
151 assertTrue(trueValue.equalsIgnoreCase("True"));