Add partner-name header sending to SDC
[vid.git] / vid-app-common / src / test / java / org / onap / vid / asdc / beans / ServiceTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 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
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  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.vid.asdc.beans;
22
23 import static org.junit.Assert.*;
24
25 import java.util.ArrayList;
26 import java.util.Collection;
27
28 import org.junit.After;
29 import org.junit.Test;
30
31 public class ServiceTest {
32
33     private Service service;
34     private Service.LifecycleState lifecycleState;
35     private Collection<Artifact> artifacts;
36     private Collection<SubResource> resources;
37
38
39     @org.junit.Before
40     public void setup() {
41         service = new Service();
42     }
43
44     @Test
45     public void testGetName_shouldNotNull() {
46         service.setName("service1");
47         String result = service.getName();
48         assertNotNull(result);
49
50     }
51
52     @Test
53     public void testGetVersion_shouldNotNull() {
54
55         service.setVersion("version");
56         String result = service.getVersion();
57         assertNotNull(result);
58     }
59
60     @Test
61     public void testLifeCycleState_shouldNotNull() {
62         service.setLifecycleState(Service.LifecycleState.CERTIFICATION_IN_PROGRESS);
63         Service.LifecycleState result = service.getLifecycleState();
64         assertNotNull(result);
65     }
66
67     @Test
68     public void getToscaModelURL_shouldNotNull() {
69         service.setToscaModelURL("URL");
70         String result = service.getToscaModelURL();
71         assertNotNull(result);
72     }
73
74
75     @Test
76     public void getCategory_shouldNotNull() {
77         service.setCategory("category");
78         String result = service.getCategory();
79         assertNotNull(result);
80     }
81
82     @Test
83     public void getLastUpdaterUserId_shouldNotNull() {
84         service.set("lastUpdaterUserId");
85         String result = service.getLastUpdaterUserId();
86         assertNotNull(result);
87     }
88
89     @Test
90     public void getLastUpdaterFullName_shouldNotNull() {
91         service.setLastUpdaterFullName("lastUpdaterFullName");
92         String result = service.getLastUpdaterFullName();
93         assertNotNull(result);
94     }
95
96
97     @Test
98     public void getDistributionStatus_shouldNotNull() {
99         service.setDistributionStatus("distributionStatus");
100         String result = service.getDistributionStatus();
101         assertNotNull(result);
102     }
103
104     @Test
105     public void getArtifacts_shouldNotNull() {
106         artifacts = new ArrayList<>();
107         Artifact artifact = new Artifact();
108         artifact.setArtifactDescription("artifactDescription");
109         artifacts.add(artifact);
110         service.setArtifacts(artifacts);
111         Collection<Artifact> result = service.getArtifacts();
112         assertNotNull(result);
113     }
114
115     @Test
116     public void getResources_shouldNotNull() {
117         artifacts = new ArrayList<>();
118         Artifact artifact = new Artifact();
119         artifact.setArtifactDescription("artifactDescription");
120         resources = new ArrayList<>();
121         SubResource subResource = new SubResource();
122         subResource.setArtifacts(artifacts);
123         service.setResources(resources);
124         assertNotNull(service.getResources());
125     }
126
127
128     @After
129     public void tearDown() {
130         service = null;
131         lifecycleState = null;
132     }
133 }
134