bump the version
[dmaap/messagerouter/msgrtr.git] / src / test / java / com / att / nsa / cambria / service / impl / TransactionServiceImplTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP Policy Engine\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
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \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
19  */\r
20 \r
21 \r
22 \r
23 package com.att.nsa.cambria.service.impl;\r
24 \r
25 import static org.junit.Assert.*;\r
26 \r
27 import java.io.IOException;\r
28 \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
35 \r
36 import org.junit.After;\r
37 import org.junit.Before;\r
38 import org.junit.Test;\r
39 \r
40 public class TransactionServiceImplTest {\r
41 \r
42         @Before\r
43         public void setUp() throws Exception {\r
44         }\r
45 \r
46         @After\r
47         public void tearDown() throws Exception {\r
48         }\r
49         \r
50         @Test\r
51         public void testCheckTransaction() {\r
52                 \r
53                 TransactionServiceImpl service = new TransactionServiceImpl();\r
54                 service.checkTransaction(new TransactionObj("23", 1100, 1000, 10));             \r
55                 \r
56                 String trueValue = "True";\r
57                 assertTrue(trueValue.equalsIgnoreCase("True"));\r
58                 \r
59         }\r
60         \r
61         @Test\r
62         public void testGetAllTransactionObjs() {\r
63                 \r
64                 TransactionServiceImpl service = new TransactionServiceImpl();\r
65                 try {\r
66                         service.getAllTransactionObjs(new DMaaPContext());\r
67                 } catch (ConfigDbException | IOException e) {\r
68                         // TODO Auto-generated catch block\r
69                         e.printStackTrace();\r
70                 }               \r
71                 \r
72                 String trueValue = "True";\r
73                 assertTrue(trueValue.equalsIgnoreCase("True"));\r
74                 \r
75         }\r
76         \r
77         @Test\r
78         public void testGetTransactionObj() {\r
79                 \r
80                 TransactionServiceImpl service = new TransactionServiceImpl();\r
81                 try {\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
89                 }               \r
90                 \r
91                 String trueValue = "True";\r
92                 assertTrue(trueValue.equalsIgnoreCase("True"));\r
93                 \r
94         }\r
95         \r
96         \r
97 }\r