2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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 * ============LICENSE_END=========================================================
21 package org.onap.policy.aai;
23 import static org.junit.Assert.assertEquals;
26 import java.nio.file.Files;
27 import org.junit.Test;
28 import org.onap.policy.aai.util.Serialization;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
32 public class RelatedToPropertyTest {
33 private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class);
36 public void test() throws Exception {
37 // deserialize json and verify fields are populated properly
38 String json = new String(Files.readAllBytes(
39 new File("src/test/resources/org/onap/policy/aai/RelatedToProperty.json").toPath()));
41 RelatedToProperty relatedToProperty = Serialization.gsonPretty.fromJson(json, RelatedToProperty.class);
43 assertEquals("generic-vnf.vnf-name", relatedToProperty.getPropertyKey());
44 assertEquals("vLoadBalancerMS-Vnf-0809-1", relatedToProperty.getPropertyValue());
46 logger.info(Serialization.gsonPretty.toJson(relatedToProperty));
48 // verify that setXxx methods work
49 relatedToProperty.setPropertyKey("a key");
50 relatedToProperty.setPropertyValue("a value");
52 assertEquals("a key", relatedToProperty.getPropertyKey());
53 assertEquals("a value", relatedToProperty.getPropertyValue());