3724c8d082ec352f6068c32a58f54aba9a23117b
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / test / java / org / openecomp / dcae / apod / analytics / model / facade / tca / TCAVESResponseTest.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\r
4  * ================================================================================\r
5  *    Copyright © 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 package org.openecomp.dcae.apod.analytics.model.facade.tca;\r
22 \r
23 import org.junit.Test;\r
24 import org.openecomp.dcae.apod.analytics.model.BaseAnalyticsModelUnitTest;\r
25 \r
26 import static org.hamcrest.CoreMatchers.is;\r
27 import static org.junit.Assert.assertThat;\r
28 \r
29 /**\r
30  * @author Rajiv Singla . Creation Date: 12/16/2016.\r
31  */\r
32 public class TCAVESResponseTest extends BaseAnalyticsModelUnitTest {\r
33 \r
34     private static final String TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION = "data/json/facade/tca_ves_cef_response.json";\r
35 \r
36     @Test\r
37     public void testTCAPolicyJsonConversions() throws Exception {\r
38 \r
39         final TCAVESResponse vesCEFMessageResponse =\r
40             assertJsonConversions(TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION, TCAVESResponse.class);\r
41 \r
42         assertThat("VES CEF Message Response AAI generics VNF Id must match",\r
43                 vesCEFMessageResponse.getAai().getGenericVNFName(), is("vpp-test(?)"));\r
44 \r
45         assertThat("VES CEF Message target type must be parsed correctly as VNF",\r
46                 vesCEFMessageResponse.getTargetType(), is("VNF"));\r
47 \r
48         assertThat("VES closed Loop Name must be CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8",\r
49                 vesCEFMessageResponse.getClosedLoopControlName(),\r
50                 is("CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8"));\r
51 \r
52         assertThat("version must be 1.0.2", vesCEFMessageResponse.getVersion(), is("1.0.2"));\r
53 \r
54         assertThat("closedLoopAlarmStart must be 1478189220547",\r
55                 vesCEFMessageResponse.getClosedLoopAlarmStart(), is(1478189220547L));\r
56         assertThat("closedLoopEventClient must be tca.instance00001",\r
57                 vesCEFMessageResponse.getClosedLoopEventClient(), is("tca.instance00001"));\r
58         assertThat("target_type must be VNF", vesCEFMessageResponse.getTargetType(), is("VNF"));\r
59         assertThat("target must be VNF", vesCEFMessageResponse.getTarget(), is("generic-vnf.vnf-name"));\r
60         assertThat("aai generic vnf id must be vpp-test(?)", vesCEFMessageResponse.getAai().getGenericVNFName(),\r
61                 is("vpp-test(?)"));\r
62         assertThat("from must be DCAE", vesCEFMessageResponse.getFrom(), is("DCAE"));\r
63         assertThat("policyScope must be resource=vFirewall;type=configuration",\r
64                 vesCEFMessageResponse.getPolicyScope(), is("resource=vFirewall;type=configuration"));\r
65 \r
66         assertThat("policyName must be configuration.dcae.microservice.tca.xml",\r
67                 vesCEFMessageResponse.getPolicyName(), is("configuration.dcae.microservice.tca.xml"));\r
68 \r
69         assertThat("policyVersion must be v0.0.1",\r
70                 vesCEFMessageResponse.getPolicyVersion(), is("v0.0.1"));\r
71 \r
72         assertThat("closedLoopEventStatus is ONSET",\r
73                 vesCEFMessageResponse.getClosedLoopEventStatus(), is("ONSET"));\r
74 \r
75     }\r
76 }\r