Changed to unmaintained
[appc.git] / appc-config / appc-config-adaptor / provider / src / test / java / org / onap / appc / ccadaptor / XmlUtilTest.java
1 \r
2 /*============LICENSE_START=======================================================\r
3  * ONAP : APPC\r
4  *================================================================================\r
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
6  * Copyright © 2017 Amdocs\r
7  * ================================================================================\r
8  * Licensed under the Apache License, Version 2.0 (the "License");\r
9  * you may not use this file except in compliance with the License.\r
10  * You may obtain a copy of the License at \r
11  *\r
12  *    http://www.apache.org/licenses/LICENSE-2.0\r
13 \r
14  * Unless required by applicable law or agreed to in writing, software\r
15  * distributed under the License is distributed on an "AS IS" BASIS,\r
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17  * See the License for the specific language governing permissions and\r
18  * limitations under the License.\r
19  *============LICENSE_END=========================================================\r
20  */\r
21 \r
22 package org.onap.appc.ccadaptor;\r
23 \r
24 import java.util.HashMap;\r
25 import java.util.Map;\r
26 \r
27 import org.junit.Assert;\r
28 import org.junit.Test;\r
29 \r
30 public class XmlUtilTest {\r
31 \r
32    @Test\r
33     public void testXml() {\r
34         Map<String, String> varmap = new HashMap<String, String>();\r
35         varmap.put("network.data", "test");\r
36         String xmlData = XmlUtil.getXml(varmap, "network");\r
37         Assert.assertEquals("<data>test</data>\n", xmlData);\r
38     }\r
39  \r
40     @Test\r
41     public void testXml2 () {\r
42         Map<String, String> varmap = new HashMap<String, String>();\r
43         varmap.put("network.data", "testData");\r
44         varmap.put("network.dt[0]", "test0");\r
45         varmap.put("network.dt[1]", "test1");\r
46         varmap.put("network.dt_length", "2");\r
47         String xmlData = XmlUtil.getXml(varmap, "network");\r
48         Assert.assertTrue(xmlData.contains("<data>testData</data>") );\r
49         Assert.assertTrue(xmlData.contains("test0</dt>") );\r
50         Assert.assertTrue(xmlData.contains("test1</dt>") );\r
51         Assert.assertTrue(xmlData.contains("<dt_length>2") );\r
52     }\r
53 }\r