Make Service base type optional
[sdc.git] / common-be / src / test / java / org / openecomp / sdc / be / datatypes / components / ServiceMetadataDataDefinitionTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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.openecomp.sdc.be.datatypes.components;
22
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;
31
32 import static org.mockito.Mockito.mock;
33 import static org.mockito.Mockito.when;
34
35
36 public class ServiceMetadataDataDefinitionTest {
37
38         private Configuration.EnvironmentContext environmentContext = mock(Configuration.EnvironmentContext.class);
39         private static final String DEFAULT_ENVIRONMENT = "General_Revenue-Bearing";
40         @BeforeClass
41         public static void setup() {
42         new DummyConfigurationManager();
43     }
44
45     @Before
46         public void beforeTest() {
47                 when(environmentContext.getDefaultValue()).thenReturn(DEFAULT_ENVIRONMENT);
48                 when(ConfigurationManager.getConfigurationManager().getConfiguration().getEnvironmentContext())
49                 .thenReturn(environmentContext);
50         }
51
52         private ServiceMetadataDataDefinition createTestSubject() {
53                 return new ServiceMetadataDataDefinition();
54         }
55
56         @Test
57         public void testGetDistributionStatus() throws Exception {
58                 ServiceMetadataDataDefinition testSubject;
59                 String result;
60
61                 // default test
62                 testSubject = createTestSubject();
63                 result = testSubject.getDistributionStatus();
64         }
65
66         
67         @Test
68         public void testSetDistributionStatus() throws Exception {
69                 ServiceMetadataDataDefinition testSubject;
70                 String distributionStatus = "";
71
72                 // default test
73                 testSubject = createTestSubject();
74                 testSubject.setDistributionStatus(distributionStatus);
75         }
76
77         
78         @Test
79         public void testGetServiceType() throws Exception {
80                 ServiceMetadataDataDefinition testSubject;
81                 String result;
82
83                 // default test
84                 testSubject = createTestSubject();
85                 result = testSubject.getServiceType();
86         }
87
88         
89         @Test
90         public void testSetServiceType() throws Exception {
91                 ServiceMetadataDataDefinition testSubject;
92                 String serviceType = "";
93
94                 // default test
95                 testSubject = createTestSubject();
96                 testSubject.setServiceType(serviceType);
97         }
98
99         
100         @Test
101         public void testGetServiceRole() throws Exception {
102                 ServiceMetadataDataDefinition testSubject;
103                 String result;
104
105                 // default test
106                 testSubject = createTestSubject();
107                 result = testSubject.getServiceRole();
108         }
109
110         
111         @Test
112         public void testSetServiceRole() throws Exception {
113                 ServiceMetadataDataDefinition testSubject;
114                 String serviceRole = "";
115
116                 // default test
117                 testSubject = createTestSubject();
118                 testSubject.setServiceRole(serviceRole);
119         }
120
121         
122         @Test
123         public void testIsEcompGeneratedNaming() throws Exception {
124                 ServiceMetadataDataDefinition testSubject;
125                 Boolean result;
126
127                 // default test
128                 testSubject = createTestSubject();
129                 result = testSubject.isEcompGeneratedNaming();
130         }
131
132         
133         @Test
134         public void testSetEcompGeneratedNaming() throws Exception {
135                 ServiceMetadataDataDefinition testSubject;
136                 Boolean ecompGeneratedNaming = null;
137
138                 // default test
139                 testSubject = createTestSubject();
140                 testSubject.setEcompGeneratedNaming(ecompGeneratedNaming);
141         }
142
143         
144         @Test
145         public void testGetNamingPolicy() throws Exception {
146                 ServiceMetadataDataDefinition testSubject;
147                 String result;
148
149                 // default test
150                 testSubject = createTestSubject();
151                 result = testSubject.getNamingPolicy();
152         }
153
154         
155         @Test
156         public void testSetNamingPolicy() throws Exception {
157                 ServiceMetadataDataDefinition testSubject;
158                 String namingPolicy = "";
159
160                 // default test
161                 testSubject = createTestSubject();
162                 testSubject.setNamingPolicy(namingPolicy);
163         }
164
165         
166         @Test
167         public void testToString() throws Exception {
168                 ServiceMetadataDataDefinition testSubject;
169                 String result;
170
171                 // default test
172                 testSubject = createTestSubject();
173                 result = testSubject.toString();
174         }
175
176         
177         @Test
178         public void testHashCode() throws Exception {
179                 ServiceMetadataDataDefinition testSubject;
180                 int result;
181
182                 // default test
183                 testSubject = createTestSubject();
184                 result = testSubject.hashCode();
185         }
186
187         @Test
188         public void testgetActualComponentType() throws Exception {
189                 ServiceMetadataDataDefinition testSubject;
190                 String result;
191
192                 // default test
193                 testSubject = createTestSubject();
194                 result = testSubject.getActualComponentType();
195                 testSubject.setComponentType(ComponentTypeEnum.PRODUCT);
196                 result = testSubject.getActualComponentType();
197         }
198         
199         @Test
200         public void testEquals() throws Exception {
201                 ServiceMetadataDataDefinition testSubject;
202                 Object obj = null;
203                 boolean result;
204
205                 // test 1
206                 testSubject = createTestSubject();
207                 obj = null;
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);
214         }
215 }