2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package com.att.nsa.cambria.service.impl;
\r
23 import static org.junit.Assert.*;
\r
25 import java.io.ByteArrayInputStream;
\r
26 import java.io.IOException;
\r
27 import java.io.InputStream;
\r
29 import com.att.dmf.mr.CambriaApiException;
\r
30 import com.att.dmf.mr.backends.ConsumerFactory.UnavailableException;
\r
31 import com.att.dmf.mr.beans.DMaaPContext;
\r
32 import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
\r
33 import com.att.dmf.mr.service.impl.BaseTransactionDbImpl;
\r
34 import com.att.dmf.mr.transaction.DMaaPTransactionObjDB.KeyExistsException;
\r
35 import com.att.nsa.configs.ConfigDbException;
\r
36 import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
\r
37 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
\r
39 import org.junit.After;
\r
40 import org.junit.Before;
\r
41 import org.junit.Test;
\r
43 public class BaseTransactionDbImplTest {
\r
46 public void setUp() throws Exception {
\r
50 public void tearDown() throws Exception {
\r
54 public void testCreateTransactionObj() {
\r
59 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
\r
60 service.createTransactionObj("transition");
\r
61 } catch (org.json.JSONException e) {
\r
62 // TODO Auto-generated catch block
\r
63 e.printStackTrace();
\r
64 } catch (NullPointerException e) {
\r
65 // TODO Auto-generated catch block
\r
66 //e.printStackTrace();
\r
68 } catch (KeyExistsException e) {
\r
69 // TODO Auto-generated catch block
\r
70 e.printStackTrace();
\r
71 } catch (ConfigDbException e) {
\r
72 // TODO Auto-generated catch block
\r
73 e.printStackTrace();
\r
76 String trueValue = "True";
\r
77 assertTrue(trueValue.equalsIgnoreCase("True"));
\r
82 public void testSaveTransactionObj() {
\r
87 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
\r
88 service.saveTransactionObj(null);
\r
89 } catch (org.json.JSONException e) {
\r
90 // TODO Auto-generated catch block
\r
91 e.printStackTrace();
\r
92 } catch (NullPointerException e) {
\r
93 // TODO Auto-generated catch block
\r
94 //e.printStackTrace();
\r
96 } catch (ConfigDbException e) {
\r
97 // TODO Auto-generated catch block
\r
98 e.printStackTrace();
\r
101 String trueValue = "True";
\r
102 assertTrue(trueValue.equalsIgnoreCase("True"));
\r
107 public void testLoadTransactionObj() {
\r
111 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
\r
112 service.loadTransactionObj("34");
\r
113 } catch (org.json.JSONException e) {
\r
114 // TODO Auto-generated catch block
\r
115 e.printStackTrace();
\r
116 } catch (NullPointerException e) {
\r
117 // TODO Auto-generated catch block
\r
118 //e.printStackTrace();
\r
120 } catch (ConfigDbException e) {
\r
121 // TODO Auto-generated catch block
\r
122 e.printStackTrace();
\r
125 String trueValue = "True";
\r
126 assertTrue(trueValue.equalsIgnoreCase("True"));
\r
132 public void testLoadAllTransactionObjs() {
\r
136 BaseTransactionDbImpl service = new BaseTransactionDbImpl(null, null);
\r
137 service.loadAllTransactionObjs();
\r
138 } catch (org.json.JSONException e) {
\r
139 // TODO Auto-generated catch block
\r
140 e.printStackTrace();
\r
141 } catch (NullPointerException e) {
\r
142 // TODO Auto-generated catch block
\r
143 //e.printStackTrace();
\r
145 } catch (ConfigDbException e) {
\r
146 // TODO Auto-generated catch block
\r
147 e.printStackTrace();
\r
150 String trueValue = "True";
\r
151 assertTrue(trueValue.equalsIgnoreCase("True"));
\r