bump the version
[dmaap/messagerouter/msgrtr.git] / src / test / java / com / att / nsa / cambria / service / impl / MetricsServiceImplTest.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 package com.att.nsa.cambria.service.impl;\r
23 \r
24 import static org.junit.Assert.*;\r
25 \r
26 import java.io.IOException;\r
27 \r
28 import org.junit.After;\r
29 import org.junit.Before;\r
30 import org.junit.Test;\r
31 \r
32 import com.att.dmf.mr.CambriaApiException;\r
33 import com.att.dmf.mr.beans.DMaaPContext;\r
34 import com.att.dmf.mr.service.impl.MetricsServiceImpl;\r
35 \r
36 public class MetricsServiceImplTest {\r
37 \r
38         @Before\r
39         public void setUp() throws Exception {\r
40         }\r
41 \r
42         @After\r
43         public void tearDown() throws Exception {\r
44         }\r
45         \r
46         @Test\r
47         public void testGet() {\r
48                 \r
49                 MetricsServiceImpl service = new MetricsServiceImpl();\r
50                 try {\r
51                         service.get(new DMaaPContext());\r
52                 } catch (org.json.JSONException e) {\r
53                         // TODO Auto-generated catch block\r
54                         e.printStackTrace();\r
55                 } catch (NullPointerException e) {\r
56                         // TODO Auto-generated catch block\r
57                         //e.printStackTrace();\r
58                         assertTrue(true);\r
59                 } catch (IOException e) {\r
60                         // TODO Auto-generated catch block\r
61                         e.printStackTrace();\r
62                 }               \r
63                 \r
64                 String trueValue = "True";\r
65                 assertTrue(trueValue.equalsIgnoreCase("True"));\r
66                 \r
67         }\r
68         \r
69         \r
70         @Test\r
71         public void testGetMetricByName() {\r
72                 \r
73                 MetricsServiceImpl service = new MetricsServiceImpl();\r
74                 try {\r
75                         service.getMetricByName(new DMaaPContext(), "uptime");\r
76                 } catch (org.json.JSONException e) {\r
77                         // TODO Auto-generated catch block\r
78                         e.printStackTrace();\r
79                 } catch (NullPointerException e) {\r
80                         // TODO Auto-generated catch block\r
81                         //e.printStackTrace();\r
82                         assertTrue(true);\r
83                 } catch (IOException e) {\r
84                         // TODO Auto-generated catch block\r
85                         e.printStackTrace();\r
86                 } catch (CambriaApiException 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