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
23 package com.att.nsa.cambria.service.impl;
\r
25 import static org.junit.Assert.*;
\r
27 import java.io.IOException;
\r
29 import com.att.aft.dme2.internal.jettison.json.JSONException;
\r
30 import com.att.dmf.mr.beans.DMaaPContext;
\r
31 import com.att.dmf.mr.service.impl.TransactionServiceImpl;
\r
32 import com.att.dmf.mr.transaction.TransactionObj;
\r
33 import com.att.nsa.configs.ConfigDbException;
\r
34 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
\r
36 import org.junit.After;
\r
37 import org.junit.Before;
\r
38 import org.junit.Test;
\r
40 public class TransactionServiceImplTest {
\r
43 public void setUp() throws Exception {
\r
47 public void tearDown() throws Exception {
\r
51 public void testCheckTransaction() {
\r
53 TransactionServiceImpl service = new TransactionServiceImpl();
\r
54 service.checkTransaction(new TransactionObj("23", 1100, 1000, 10));
\r
56 String trueValue = "True";
\r
57 assertTrue(trueValue.equalsIgnoreCase("True"));
\r
62 public void testGetAllTransactionObjs() {
\r
64 TransactionServiceImpl service = new TransactionServiceImpl();
\r
66 service.getAllTransactionObjs(new DMaaPContext());
\r
67 } catch (ConfigDbException | IOException e) {
\r
68 // TODO Auto-generated catch block
\r
69 e.printStackTrace();
\r
72 String trueValue = "True";
\r
73 assertTrue(trueValue.equalsIgnoreCase("True"));
\r
78 public void testGetTransactionObj() {
\r
80 TransactionServiceImpl service = new TransactionServiceImpl();
\r
82 service.getTransactionObj(new DMaaPContext(), "23");
\r
83 } catch (ConfigDbException | IOException e) {
\r
84 // TODO Auto-generated catch block
\r
85 e.printStackTrace();
\r
86 } catch (JSONException e) {
\r
87 // TODO Auto-generated catch block
\r
88 e.printStackTrace();
\r
91 String trueValue = "True";
\r
92 assertTrue(trueValue.equalsIgnoreCase("True"));
\r