1 /*******************************************************************************
2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property
6 * ===================================================================
7 * Modifications Copyright (c) 2019 IBM.
8 * ===================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ============LICENSE_END=============================================
22 * ====================================================================
23 *******************************************************************************/
25 package org.onap.music.unittests.jsonobjects;
27 import static org.junit.Assert.*;
28 import java.util.HashMap;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.onap.music.datastore.jsonobjects.JsonUpdate;
34 public class JsonUpdateTest {
40 ju = new JsonUpdate();
45 public void testGetConditions() {
46 Map<String,Object> mapSo = new HashMap<>();
47 mapSo.put("key1","one");
48 mapSo.put("key2","two");
49 ju.setConditions(mapSo);
50 assertEquals("one",ju.getConditions().get("key1"));
54 public void testGetRow_specification() {
55 Map<String,Object> mapSo = new HashMap<>();
56 mapSo.put("key1","one");
57 mapSo.put("key2","two");
58 ju.setRow_specification(mapSo);
59 assertEquals("one",ju.getRow_specification().get("key1"));
63 public void testGetKeyspaceName() {
64 String keyspace = "keyspace";
65 ju.setKeyspaceName(keyspace);
66 assertEquals(keyspace,ju.getKeyspaceName());
70 public void testGetTableName() {
71 String table = "table";
72 ju.setTableName(table);
73 assertEquals(table,ju.getTableName());
77 public void testGetConsistencyInfo() {
78 Map<String, String> mapSs = new HashMap<>();
79 mapSs.put("k1", "one");
80 ju.setConsistencyInfo(mapSs);
81 assertEquals("one",ju.getConsistencyInfo().get("k1"));
85 public void testGetTtl() {
87 assertEquals("2000",ju.getTtl());
91 public void testGetTimestamp() {
92 ju.setTimestamp("20:00");
93 assertEquals("20:00",ju.getTimestamp());
98 public void testGetValues() {
99 Map<String,Object> cons = new HashMap<>();
100 cons.put("val1","one");
101 cons.put("val2","two");
103 assertEquals("one",ju.getValues().get("val1"));
107 public void testSerialize() {
108 assertTrue(ju.serialize() instanceof byte[]);