update the package name
[dmaap/messagerouter/msgrtr.git] / src / test / java / org / onap / dmaap / mr / cambria / service / impl / TransactionServiceImplTest.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
22
23  package org.onap.dmaap.mr.cambria.service.impl;
24
25 import static org.junit.Assert.*;
26
27 import java.io.IOException;
28
29 import com.att.aft.dme2.internal.jettison.json.JSONException;
30 import org.onap.dmaap.dmf.mr.beans.DMaaPContext;
31 import org.onap.dmaap.dmf.mr.service.impl.TransactionServiceImpl;
32 import org.onap.dmaap.dmf.mr.transaction.TransactionObj;
33 import com.att.nsa.configs.ConfigDbException;
34 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
35
36 import org.junit.After;
37 import org.junit.Before;
38 import org.junit.Test;
39
40 public class TransactionServiceImplTest {
41
42         @Before
43         public void setUp() throws Exception {
44         }
45
46         @After
47         public void tearDown() throws Exception {
48         }
49         
50         @Test
51         public void testCheckTransaction() {
52                 
53                 TransactionServiceImpl service = new TransactionServiceImpl();
54                 service.checkTransaction(new TransactionObj("23", 1100, 1000, 10));             
55                 
56                 String trueValue = "True";
57                 assertTrue(trueValue.equalsIgnoreCase("True"));
58                 
59         }
60         
61         @Test
62         public void testGetAllTransactionObjs() {
63                 
64                 TransactionServiceImpl service = new TransactionServiceImpl();
65                 try {
66                         service.getAllTransactionObjs(new DMaaPContext());
67                 } catch (ConfigDbException | IOException e) {
68                         // TODO Auto-generated catch block
69                         e.printStackTrace();
70                 }               
71                 
72                 String trueValue = "True";
73                 assertTrue(trueValue.equalsIgnoreCase("True"));
74                 
75         }
76         
77         @Test
78         public void testGetTransactionObj() {
79                 
80                 TransactionServiceImpl service = new TransactionServiceImpl();
81                 try {
82                         service.getTransactionObj(new DMaaPContext(), "23");
83                 } catch (ConfigDbException | IOException e) {
84                         // TODO Auto-generated catch block
85                         e.printStackTrace();
86                 } catch (JSONException e) {
87                         // TODO Auto-generated catch block
88                         e.printStackTrace();
89                 }               
90                 
91                 String trueValue = "True";
92                 assertTrue(trueValue.equalsIgnoreCase("True"));
93                 
94         }
95         
96         
97 }