Catalog alignment
[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 testCopyConstructor() throws Exception {
58                 ServiceMetadataDataDefinition testSubject;
59
60                 // default test
61                 testSubject = createTestSubject();
62                 ServiceMetadataDataDefinition serviceMetadataDataDefinition = new ServiceMetadataDataDefinition(testSubject);
63         }
64         
65         @Test
66         public void testGetDistributionStatus() throws Exception {
67                 ServiceMetadataDataDefinition testSubject;
68                 String result;
69
70                 // default test
71                 testSubject = createTestSubject();
72                 result = testSubject.getDistributionStatus();
73         }
74
75         
76         @Test
77         public void testSetDistributionStatus() throws Exception {
78                 ServiceMetadataDataDefinition testSubject;
79                 String distributionStatus = "";
80
81                 // default test
82                 testSubject = createTestSubject();
83                 testSubject.setDistributionStatus(distributionStatus);
84         }
85
86         
87         @Test
88         public void testGetServiceType() throws Exception {
89                 ServiceMetadataDataDefinition testSubject;
90                 String result;
91
92                 // default test
93                 testSubject = createTestSubject();
94                 result = testSubject.getServiceType();
95         }
96
97         
98         @Test
99         public void testSetServiceType() throws Exception {
100                 ServiceMetadataDataDefinition testSubject;
101                 String serviceType = "";
102
103                 // default test
104                 testSubject = createTestSubject();
105                 testSubject.setServiceType(serviceType);
106         }
107
108         
109         @Test
110         public void testGetServiceRole() throws Exception {
111                 ServiceMetadataDataDefinition testSubject;
112                 String result;
113
114                 // default test
115                 testSubject = createTestSubject();
116                 result = testSubject.getServiceRole();
117         }
118
119         
120         @Test
121         public void testSetServiceRole() throws Exception {
122                 ServiceMetadataDataDefinition testSubject;
123                 String serviceRole = "";
124
125                 // default test
126                 testSubject = createTestSubject();
127                 testSubject.setServiceRole(serviceRole);
128         }
129
130         
131         @Test
132         public void testIsEcompGeneratedNaming() throws Exception {
133                 ServiceMetadataDataDefinition testSubject;
134                 Boolean result;
135
136                 // default test
137                 testSubject = createTestSubject();
138                 result = testSubject.isEcompGeneratedNaming();
139         }
140
141         
142         @Test
143         public void testSetEcompGeneratedNaming() throws Exception {
144                 ServiceMetadataDataDefinition testSubject;
145                 Boolean ecompGeneratedNaming = null;
146
147                 // default test
148                 testSubject = createTestSubject();
149                 testSubject.setEcompGeneratedNaming(ecompGeneratedNaming);
150         }
151
152         
153         @Test
154         public void testGetNamingPolicy() throws Exception {
155                 ServiceMetadataDataDefinition testSubject;
156                 String result;
157
158                 // default test
159                 testSubject = createTestSubject();
160                 result = testSubject.getNamingPolicy();
161         }
162
163         
164         @Test
165         public void testSetNamingPolicy() throws Exception {
166                 ServiceMetadataDataDefinition testSubject;
167                 String namingPolicy = "";
168
169                 // default test
170                 testSubject = createTestSubject();
171                 testSubject.setNamingPolicy(namingPolicy);
172         }
173
174         
175         @Test
176         public void testToString() throws Exception {
177                 ServiceMetadataDataDefinition testSubject;
178                 String result;
179
180                 // default test
181                 testSubject = createTestSubject();
182                 result = testSubject.toString();
183         }
184
185         
186         @Test
187         public void testHashCode() throws Exception {
188                 ServiceMetadataDataDefinition testSubject;
189                 int result;
190
191                 // default test
192                 testSubject = createTestSubject();
193                 result = testSubject.hashCode();
194         }
195
196         @Test
197         public void testgetActualComponentType() throws Exception {
198                 ServiceMetadataDataDefinition testSubject;
199                 String result;
200
201                 // default test
202                 testSubject = createTestSubject();
203                 result = testSubject.getActualComponentType();
204                 testSubject.setComponentType(ComponentTypeEnum.PRODUCT);
205                 result = testSubject.getActualComponentType();
206         }
207         
208         @Test
209         public void testEquals() throws Exception {
210                 ServiceMetadataDataDefinition testSubject;
211                 Object obj = null;
212                 boolean result;
213
214                 // test 1
215                 testSubject = createTestSubject();
216                 obj = null;
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);
223         }
224 }