2 * ============LICENSE_START======================================================= ONAP : SO
3 * ================================================================================ Copyright (C) 2018 TechMahindra
4 * ================================================================================ Licensed under the Apache License,
5 * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
12 * specific language governing permissions and limitations under the License.
13 * ============LICENSE_END=========================================================
15 package org.onap.so.bpmn.core.domain;
17 import static org.junit.Assert.*;
18 import com.fasterxml.jackson.databind.ObjectMapper;
19 import org.junit.Test;
20 import java.io.IOException;
22 public class AllottedResourceTest {
23 private AllottedResource ar = new AllottedResource();
26 public void testAllottedResource() {
27 ar.setAllottedResourceType("allottedResourceType");
28 ar.setAllottedResourceRole("allottedResourceRole");
29 ar.setProvidingServiceModelName("providingServiceModelName");
30 ar.setProvidingServiceModelInvariantUuid("providingServiceModelInvariantUuid");
31 ar.setProvidingServiceModelUuid("providingServiceModelUuid");
32 ar.setNfFunction("nfFunction");
33 ar.setNfType("nfType");
34 ar.setNfRole("nfRole");
35 ar.setNfNamingCode("nfNamingCode");
36 ar.setOrchestrationStatus("orchestrationStatus");
37 assertEquals(ar.getAllottedResourceType(), "allottedResourceType");
38 assertEquals(ar.getAllottedResourceRole(), "allottedResourceRole");
39 assertEquals(ar.getProvidingServiceModelName(), "providingServiceModelName");
40 assertEquals(ar.getProvidingServiceModelInvariantUuid(), "providingServiceModelInvariantUuid");
41 assertEquals(ar.getProvidingServiceModelUuid(), "providingServiceModelUuid");
42 assertEquals(ar.getNfFunction(), "nfFunction");
43 assertEquals(ar.getNfType(), "nfType");
44 assertEquals(ar.getNfRole(), "nfRole");
45 assertEquals(ar.getNfNamingCode(), "nfNamingCode");
46 assertEquals(ar.getOrchestrationStatus(), "orchestrationStatus");
51 public void allottedResourceMapperTest() throws IOException {
52 String jsonStr = "{\"allottedResourceType\": \"code123\", \"resourceInput\": \"sample\"}";
53 ObjectMapper objectMapper = new ObjectMapper();
54 AllottedResource vnfResource = objectMapper.readValue(jsonStr, AllottedResource.class);
56 assertTrue(vnfResource != null);