db7cbd72c60e4ed2bfb9ae6f0cc699bfc14e4dfa
[ccsdk/sli.git] /
1 /*
2  * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
3  * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
4  * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
5  * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
6  * Vestibulum commodo. Ut rhoncus gravida arcu.
7  */
8
9 package org.onap.ccsdk.sli.northbound.dmaapclient;
10
11 import static org.junit.Assert.assertTrue;
12
13 import java.util.Properties;
14
15 import org.junit.Before;
16 import org.junit.Test;
17
18 public class TestSdncPserverDmaapReceiver {
19     private static final String aaiInput = "{\r\n" + 
20             "    \"cambria.partition\": \"AAI\",\r\n" + 
21             "    \"event-header\": {\r\n" + 
22             "        \"severity\": \"NORMAL\",\r\n" + 
23             "        \"entity-type\": \"pserver\",\r\n" + 
24             "        \"top-entity-type\": \"pserver\",\r\n" + 
25             "        \"entity-link\": \"https://aai.com:8443/aai/v11/cloud-infrastructure/pservers/pserver/a3d3d3d3/\",\r\n" + 
26             "        \"event-type\": \"AAI-EVENT\",\r\n" + 
27             "        \"domain\": \"e2e\",\r\n" + 
28             "        \"action\": \"UPDATE\",\r\n" + 
29             "        \"sequence-number\": \"0\",\r\n" + 
30             "        \"id\": \"20170415000111-1234\",\r\n" + 
31             "        \"source-name\": \"testclient\",\r\n" + 
32             "        \"version\": \"v11\",\r\n" + 
33             "        \"timestamp\": \"20170415-00:01:11:979\"\r\n" + 
34             "    },\r\n" + 
35             "    \"entity\": {\r\n" + 
36             "        \"hostname\": \"host1\",\r\n" + 
37             "        \"ptnii-equip-name\": \"lat111\",\r\n" + 
38             "        \"equip-type\": \"server\",\r\n" + 
39             "        \"equip-vendor\": \"HP\",\r\n" + 
40             "        \"equip-model\": \"model1\",\r\n" + 
41             "        \"fqdn\": \"l.global.net\",\r\n" + 
42             "        \"ipv4-oam-address\": \"12.12.12.12\",\r\n" + 
43             "        \"in-maint\": false,\r\n" + 
44             "        \"resource-version\": \"11111111111\",\r\n" + 
45             "        \"purpose\": \"Gamma\",\r\n" + 
46             "        \"relationship-list\": {\r\n" + 
47             "            \"relationship\": [\r\n" + 
48             "                {\r\n" + 
49             "                    \"related-to\": \"complex\",\r\n" + 
50             "                    \"relationship-data\": [\r\n" + 
51             "                        {\r\n" + 
52             "                            \"relationship-value\": \"L1L2L3\",\r\n" + 
53             "                            \"relationship-key\": \"complex.physical-location-id\"\r\n" + 
54             "                        }\r\n" + 
55             "                    ],\r\n" + 
56             "                    \"related-link\": \"https://aai.com:8443/aai/v11/cloud-infrastructure/complexes/complex/cmpl1\"\r\n" + 
57             "                }\r\n" + 
58             "            ]\r\n" + 
59             "        },\r\n" + 
60             "        \"p-interfaces\": {\r\n" + 
61             "            \"p-interface\": []\r\n" + 
62             "        },\r\n" + 
63             "        \"lag-interfaces\": {\r\n" + 
64             "            \"lag-interface\": []\r\n" + 
65             "        }\r\n" + 
66             "    }\r\n" + 
67             "}";
68     
69         @Before
70         public void setUp() throws Exception {
71         }
72
73         @Test
74         public void test() throws Exception {
75                 Properties props = new Properties();
76  
77             String rpcMsgbody = new SdncAaiDmaapConsumer(props).publish("src/main/resources/template-pserver.vt", aaiInput);
78
79         assertTrue(rpcMsgbody.indexOf("input") != -1); 
80         assertTrue(rpcMsgbody.indexOf("payload") != -1); 
81         assertTrue(rpcMsgbody.indexOf("common-header") != -1);
82         }
83
84
85 }