2 * ============LICENSE_START=======================================================
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
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.vid.asdc.beans;
23 import static org.junit.Assert.*;
25 import java.util.ArrayList;
26 import java.util.Collection;
28 import org.junit.After;
29 import org.junit.Test;
31 public class ServiceTest {
33 private Service service;
34 private Service.LifecycleState lifecycleState;
35 private Collection<Artifact> artifacts;
36 private Collection<SubResource> resources;
41 service = new Service();
45 public void testGetName_shouldNotNull() {
46 service.setName("service1");
47 String result = service.getName();
48 assertNotNull(result);
53 public void testGetVersion_shouldNotNull() {
55 service.setVersion("version");
56 String result = service.getVersion();
57 assertNotNull(result);
61 public void testLifeCycleState_shouldNotNull() {
62 service.setLifecycleState(Service.LifecycleState.CERTIFICATION_IN_PROGRESS);
63 Service.LifecycleState result = service.getLifecycleState();
64 assertNotNull(result);
68 public void getToscaModelURL_shouldNotNull() {
69 service.setToscaModelURL("URL");
70 String result = service.getToscaModelURL();
71 assertNotNull(result);
76 public void getCategory_shouldNotNull() {
77 service.setCategory("category");
78 String result = service.getCategory();
79 assertNotNull(result);
83 public void getLastUpdaterUserId_shouldNotNull() {
84 service.set("lastUpdaterUserId");
85 String result = service.getLastUpdaterUserId();
86 assertNotNull(result);
90 public void getLastUpdaterFullName_shouldNotNull() {
91 service.setLastUpdaterFullName("lastUpdaterFullName");
92 String result = service.getLastUpdaterFullName();
93 assertNotNull(result);
98 public void getDistributionStatus_shouldNotNull() {
99 service.setDistributionStatus("distributionStatus");
100 String result = service.getDistributionStatus();
101 assertNotNull(result);
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);
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());
129 public void tearDown() {
131 lifecycleState = null;