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.datatypes.components;
23 import org.junit.Assert;
24 import org.junit.Before;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27 import org.openecomp.sdc.be.config.Configuration;
28 import org.openecomp.sdc.be.config.ConfigurationManager;
29 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
30 import org.openecomp.sdc.be.utils.DummyConfigurationManager;
32 import static org.mockito.Mockito.mock;
33 import static org.mockito.Mockito.when;
36 public class ServiceMetadataDataDefinitionTest {
38 private Configuration.EnvironmentContext environmentContext = mock(Configuration.EnvironmentContext.class);
39 private static final String DEFAULT_ENVIRONMENT = "General_Revenue-Bearing";
41 public static void setup() {
42 new DummyConfigurationManager();
46 public void beforeTest() {
47 when(environmentContext.getDefaultValue()).thenReturn(DEFAULT_ENVIRONMENT);
48 when(ConfigurationManager.getConfigurationManager().getConfiguration().getEnvironmentContext())
49 .thenReturn(environmentContext);
52 private ServiceMetadataDataDefinition createTestSubject() {
53 return new ServiceMetadataDataDefinition();
57 public void testCopyConstructor() throws Exception {
58 ServiceMetadataDataDefinition testSubject;
61 testSubject = createTestSubject();
62 ServiceMetadataDataDefinition serviceMetadataDataDefinition = new ServiceMetadataDataDefinition(testSubject);
66 public void testGetDistributionStatus() throws Exception {
67 ServiceMetadataDataDefinition testSubject;
71 testSubject = createTestSubject();
72 result = testSubject.getDistributionStatus();
77 public void testSetDistributionStatus() throws Exception {
78 ServiceMetadataDataDefinition testSubject;
79 String distributionStatus = "";
82 testSubject = createTestSubject();
83 testSubject.setDistributionStatus(distributionStatus);
88 public void testGetServiceType() throws Exception {
89 ServiceMetadataDataDefinition testSubject;
93 testSubject = createTestSubject();
94 result = testSubject.getServiceType();
99 public void testSetServiceType() throws Exception {
100 ServiceMetadataDataDefinition testSubject;
101 String serviceType = "";
104 testSubject = createTestSubject();
105 testSubject.setServiceType(serviceType);
110 public void testGetServiceRole() throws Exception {
111 ServiceMetadataDataDefinition testSubject;
115 testSubject = createTestSubject();
116 result = testSubject.getServiceRole();
121 public void testSetServiceRole() throws Exception {
122 ServiceMetadataDataDefinition testSubject;
123 String serviceRole = "";
126 testSubject = createTestSubject();
127 testSubject.setServiceRole(serviceRole);
132 public void testIsEcompGeneratedNaming() throws Exception {
133 ServiceMetadataDataDefinition testSubject;
137 testSubject = createTestSubject();
138 result = testSubject.isEcompGeneratedNaming();
143 public void testSetEcompGeneratedNaming() throws Exception {
144 ServiceMetadataDataDefinition testSubject;
145 Boolean ecompGeneratedNaming = null;
148 testSubject = createTestSubject();
149 testSubject.setEcompGeneratedNaming(ecompGeneratedNaming);
154 public void testGetNamingPolicy() throws Exception {
155 ServiceMetadataDataDefinition testSubject;
159 testSubject = createTestSubject();
160 result = testSubject.getNamingPolicy();
165 public void testSetNamingPolicy() throws Exception {
166 ServiceMetadataDataDefinition testSubject;
167 String namingPolicy = "";
170 testSubject = createTestSubject();
171 testSubject.setNamingPolicy(namingPolicy);
176 public void testToString() throws Exception {
177 ServiceMetadataDataDefinition testSubject;
181 testSubject = createTestSubject();
182 result = testSubject.toString();
187 public void testHashCode() throws Exception {
188 ServiceMetadataDataDefinition testSubject;
192 testSubject = createTestSubject();
193 result = testSubject.hashCode();
197 public void testgetActualComponentType() throws Exception {
198 ServiceMetadataDataDefinition testSubject;
202 testSubject = createTestSubject();
203 result = testSubject.getActualComponentType();
204 testSubject.setComponentType(ComponentTypeEnum.PRODUCT);
205 result = testSubject.getActualComponentType();
209 public void testEquals() throws Exception {
210 ServiceMetadataDataDefinition testSubject;
215 testSubject = createTestSubject();
217 result = testSubject.equals(obj);
218 Assert.assertEquals(false, result);
219 result = testSubject.equals(testSubject);
220 Assert.assertEquals(true, result);
221 result = testSubject.equals(new ServiceMetadataDataDefinition());
222 Assert.assertEquals(true, result);