2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 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.openecomp.sdc.be.model;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import org.openecomp.sdc.be.config.Configuration;
26 import org.openecomp.sdc.be.config.ConfigurationManager;
27 import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
28 import org.openecomp.sdc.common.api.ConfigurationSource;
29 import org.openecomp.sdc.common.impl.ExternalConfiguration;
30 import org.openecomp.sdc.common.impl.FSConfigurationSource;
34 public class ServiceTest {
36 protected static ConfigurationManager configurationManager;
37 static Configuration.EnvironmentContext environmentContext = new Configuration.EnvironmentContext();
40 public static void init() {
41 String appConfigDir = "src/test/resources/config";
42 ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
44 configurationManager = new ConfigurationManager(configurationSource);
46 Configuration configuration = new Configuration();
48 configuration.setJanusGraphInMemoryGraph(true);
49 environmentContext.setDefaultValue("General_Revenue-Bearing");
50 configuration.setEnvironmentContext(environmentContext);
52 configurationManager.setConfiguration(configuration);
55 private Service createTestSubject() {
60 public void testCtor() throws Exception {
61 new Service(new ComponentMetadataDefinition());
65 public void testGetServiceApiArtifacts() throws Exception {
67 Map<String, ArtifactDefinition> result;
70 testSubject = createTestSubject();
71 result = testSubject.getServiceApiArtifacts();
76 public void testSetServiceApiArtifacts() throws Exception {
78 Map<String, ArtifactDefinition> serviceApiArtifacts = null;
81 testSubject = createTestSubject();
82 testSubject.setServiceApiArtifacts(serviceApiArtifacts);
87 public void testGetProjectCode() throws Exception {
92 testSubject = createTestSubject();
93 result = testSubject.getProjectCode();
98 public void testGetForwardingPaths() throws Exception {
100 Map<String, ForwardingPathDataDefinition> result;
103 testSubject = createTestSubject();
104 result = testSubject.getForwardingPaths();
109 public void testSetForwardingPaths() throws Exception {
111 Map<String, ForwardingPathDataDefinition> forwardingPaths = null;
114 testSubject = createTestSubject();
115 testSubject.setForwardingPaths(forwardingPaths);
120 public void testAddForwardingPath() throws Exception {
122 ForwardingPathDataDefinition forwardingPathDataDefinition = new ForwardingPathDataDefinition();
123 ForwardingPathDataDefinition result;
126 testSubject = createTestSubject();
127 result = testSubject.addForwardingPath(forwardingPathDataDefinition);
132 public void testSetProjectCode() throws Exception {
134 String projectName = "";
137 testSubject = createTestSubject();
138 testSubject.setProjectCode(projectName);
143 public void testGetDistributionStatus() throws Exception {
145 DistributionStatusEnum result;
148 testSubject = createTestSubject();
149 result = testSubject.getDistributionStatus();
154 public void testSetDistributionStatus() throws Exception {
156 DistributionStatusEnum distributionStatus = null;
159 testSubject = createTestSubject();
160 distributionStatus = null;
161 testSubject.setDistributionStatus(distributionStatus);
162 testSubject.setDistributionStatus(DistributionStatusEnum.DISTRIBUTED);
167 public void testSetEcompGeneratedNaming() throws Exception {
169 Boolean ecompGeneratedNaming = null;
172 testSubject = createTestSubject();
173 testSubject.setEcompGeneratedNaming(ecompGeneratedNaming);
178 public void testIsEcompGeneratedNaming() throws Exception {
183 testSubject = createTestSubject();
184 result = testSubject.isEcompGeneratedNaming();
189 public void testSetNamingPolicy() throws Exception {
191 String namingPolicy = "";
194 testSubject = createTestSubject();
195 testSubject.setNamingPolicy(namingPolicy);
200 public void testGetNamingPolicy() throws Exception {
205 testSubject = createTestSubject();
206 result = testSubject.getNamingPolicy();
211 public void testGetEnvironmentContext() throws Exception {
216 testSubject = createTestSubject();
217 result = testSubject.getEnvironmentContext();
222 public void testSetEnvironmentContext() throws Exception {
224 String environmentContext = "";
227 testSubject = createTestSubject();
228 testSubject.setEnvironmentContext(environmentContext);
233 public void testSetServiceType() throws Exception {
235 String serviceType = "";
238 testSubject = createTestSubject();
239 testSubject.setServiceType(serviceType);
244 public void testGetServiceType() throws Exception {
249 testSubject = createTestSubject();
250 result = testSubject.getServiceType();
255 public void testSetServiceRole() throws Exception {
257 String serviceRole = "";
260 testSubject = createTestSubject();
261 testSubject.setServiceRole(serviceRole);
266 public void testGetServiceRole() throws Exception {
271 testSubject = createTestSubject();
272 result = testSubject.getServiceRole();
280 public void testToString() throws Exception {
285 testSubject = createTestSubject();
286 result = testSubject.toString();
291 public void testSetSpecificComponetTypeArtifacts() throws Exception {
293 Map<String, ArtifactDefinition> specificComponentTypeArtifacts = null;
296 testSubject = createTestSubject();
297 testSubject.setSpecificComponetTypeArtifacts(specificComponentTypeArtifacts);