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 testGetDistributionStatus() throws Exception {
58 ServiceMetadataDataDefinition testSubject;
62 testSubject = createTestSubject();
63 result = testSubject.getDistributionStatus();
68 public void testSetDistributionStatus() throws Exception {
69 ServiceMetadataDataDefinition testSubject;
70 String distributionStatus = "";
73 testSubject = createTestSubject();
74 testSubject.setDistributionStatus(distributionStatus);
79 public void testGetServiceType() throws Exception {
80 ServiceMetadataDataDefinition testSubject;
84 testSubject = createTestSubject();
85 result = testSubject.getServiceType();
90 public void testSetServiceType() throws Exception {
91 ServiceMetadataDataDefinition testSubject;
92 String serviceType = "";
95 testSubject = createTestSubject();
96 testSubject.setServiceType(serviceType);
101 public void testGetServiceRole() throws Exception {
102 ServiceMetadataDataDefinition testSubject;
106 testSubject = createTestSubject();
107 result = testSubject.getServiceRole();
112 public void testSetServiceRole() throws Exception {
113 ServiceMetadataDataDefinition testSubject;
114 String serviceRole = "";
117 testSubject = createTestSubject();
118 testSubject.setServiceRole(serviceRole);
123 public void testIsEcompGeneratedNaming() throws Exception {
124 ServiceMetadataDataDefinition testSubject;
128 testSubject = createTestSubject();
129 result = testSubject.isEcompGeneratedNaming();
134 public void testSetEcompGeneratedNaming() throws Exception {
135 ServiceMetadataDataDefinition testSubject;
136 Boolean ecompGeneratedNaming = null;
139 testSubject = createTestSubject();
140 testSubject.setEcompGeneratedNaming(ecompGeneratedNaming);
145 public void testGetNamingPolicy() throws Exception {
146 ServiceMetadataDataDefinition testSubject;
150 testSubject = createTestSubject();
151 result = testSubject.getNamingPolicy();
156 public void testSetNamingPolicy() throws Exception {
157 ServiceMetadataDataDefinition testSubject;
158 String namingPolicy = "";
161 testSubject = createTestSubject();
162 testSubject.setNamingPolicy(namingPolicy);
167 public void testToString() throws Exception {
168 ServiceMetadataDataDefinition testSubject;
172 testSubject = createTestSubject();
173 result = testSubject.toString();
178 public void testHashCode() throws Exception {
179 ServiceMetadataDataDefinition testSubject;
183 testSubject = createTestSubject();
184 result = testSubject.hashCode();
188 public void testgetActualComponentType() throws Exception {
189 ServiceMetadataDataDefinition testSubject;
193 testSubject = createTestSubject();
194 result = testSubject.getActualComponentType();
195 testSubject.setComponentType(ComponentTypeEnum.PRODUCT);
196 result = testSubject.getActualComponentType();
200 public void testEquals() throws Exception {
201 ServiceMetadataDataDefinition testSubject;
206 testSubject = createTestSubject();
208 result = testSubject.equals(obj);
209 Assert.assertEquals(false, result);
210 result = testSubject.equals(testSubject);
211 Assert.assertEquals(true, result);
212 result = testSubject.equals(new ServiceMetadataDataDefinition());
213 Assert.assertEquals(true, result);