Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCoreBPMN / src / test / java / org / onap / so / bpmn / core / domain / ServiceInstanceTest.java
1 /*
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
6  * of the License at
7  * 
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * 
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=========================================================
14  */
15 package org.onap.so.bpmn.core.domain;
16
17 import static org.junit.Assert.*;
18 import java.io.IOException;
19 import java.util.Map;
20 import com.fasterxml.jackson.databind.ObjectMapper;
21 import org.junit.Test;
22
23 public class ServiceInstanceTest {
24
25     private ServiceInstance si = new ServiceInstance();
26     Map serviceParams;
27     Configuration config = new Configuration();
28     ModelInfo model = new ModelInfo();
29
30     @Test
31     public void testServiceInstance() {
32         si.setServiceType("serviceType");
33         si.setServiceId("serviceId");
34         si.setServiceParams(serviceParams);
35         si.setInstanceId("instanceId");
36         si.setInstanceName("instanceName");
37         si.setOrchestrationStatus("orchestrationStatus");
38         si.setConfiguration(config);
39         si.setModelInfo(model);
40         si.setEnvironmentContext("environmentContext");
41         si.setWorkloadContext("workloadContext");
42         assertEquals(si.getServiceType(), "serviceType");
43         assertEquals(si.getServiceId(), "serviceId");
44         assertEquals(si.getServiceParams(), serviceParams);
45         assertEquals(si.getInstanceId(), "instanceId");
46         assertEquals(si.getInstanceName(), "instanceName");
47         assertEquals(si.getOrchestrationStatus(), "orchestrationStatus");
48         assertEquals(si.getConfiguration(), config);
49         assertEquals(si.getModelInfo(), model);
50         assertEquals(si.getEnvironmentContext(), "environmentContext");
51         assertEquals(si.getWorkloadContext(), "workloadContext");
52
53
54     }
55
56     @Test
57     public void serviceInstanceMapperTest() throws IOException {
58         String jsonStr = "{\"workloadContext\": \"code123\", \"resourceOrder\": \"sample\"}";
59         ObjectMapper objectMapper = new ObjectMapper();
60         ServiceInstance serviceInstance = objectMapper.readValue(jsonStr, ServiceInstance.class);
61         assertTrue(serviceInstance != null);
62     }
63
64 }