Push variuos changes
[music.git] / jar / src / test / java / org / onap / music / unittests / jsonobjects / JsonUpdateTest.java
1 /*******************************************************************************
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2018 AT&T Intellectual Property
6  * ===================================================================
7  *  Licensed under the Apache License, Version 2.0 (the "License");
8  *  you may not use this file except in compliance with the License.
9  *  You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *  Unless required by applicable law or agreed to in writing, software
14  *  distributed under the License is distributed on an "AS IS" BASIS,
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *  See the License for the specific language governing permissions and
17  *  limitations under the License.
18  *  
19  * ============LICENSE_END=============================================
20  * ====================================================================
21  *******************************************************************************/
22
23 package org.onap.music.unittests.jsonobjects;
24
25 import static org.junit.Assert.*;
26 import java.util.HashMap;
27 import java.util.Map;
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.onap.music.datastore.jsonobjects.JsonUpdate;
31
32 public class JsonUpdateTest {
33     
34     JsonUpdate ju = null;
35     
36     @Before
37     public void init() {
38         ju = new JsonUpdate();
39     }
40     
41
42     @Test
43     public void testGetConditions() {
44         Map<String,Object>  mapSo = new HashMap<>();
45         mapSo.put("key1","one");
46         mapSo.put("key2","two");
47         ju.setConditions(mapSo);
48         assertEquals("one",ju.getConditions().get("key1"));
49     }
50
51     @Test
52     public void testGetRow_specification() {
53         Map<String,Object>  mapSo = new HashMap<>();
54         mapSo.put("key1","one");
55         mapSo.put("key2","two");
56         ju.setRow_specification(mapSo);
57         assertEquals("one",ju.getRow_specification().get("key1"));
58     }
59
60     @Test
61     public void testGetKeyspaceName() {
62         String keyspace = "keyspace";
63         ju.setKeyspaceName(keyspace);
64         assertEquals(keyspace,ju.getKeyspaceName());
65     }
66
67     @Test
68     public void testGetTableName() {
69         String table = "table";
70         ju.setTableName(table);
71         assertEquals(table,ju.getTableName());
72    }
73
74     @Test
75     public void testGetConsistencyInfo() {
76         Map<String, String> mapSs = new HashMap<>();
77         mapSs.put("k1", "one");
78         ju.setConsistencyInfo(mapSs);
79         assertEquals("one",ju.getConsistencyInfo().get("k1"));
80     }
81
82     @Test
83     public void testGetTtl() {
84         ju.setTtl("2000");
85         assertEquals("2000",ju.getTtl());
86     }
87
88     @Test
89     public void testGetTimestamp() {
90         ju.setTimestamp("20:00");
91         assertEquals("20:00",ju.getTimestamp());
92
93     }
94
95     @Test
96     public void testGetValues() {
97         Map<String,Object> cons = new HashMap<>();
98         cons.put("val1","one");
99         cons.put("val2","two");
100         ju.setValues(cons);
101         assertEquals("one",ju.getValues().get("val1"));
102     }
103
104 }