Catalog alignment
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / distribution / engine / ArtifactInfoImplTest.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.components.distribution.engine;
22
23 import mockit.Deencapsulation;
24 import org.junit.Assert;
25 import org.junit.Test;
26 import org.openecomp.sdc.be.components.BeConfDependentTest;
27 import org.openecomp.sdc.be.model.ArtifactDefinition;
28 import org.openecomp.sdc.be.model.ComponentInstance;
29 import org.openecomp.sdc.be.model.Service;
30 import org.openecomp.sdc.common.api.ArtifactTypeEnum;
31
32 import java.util.Collection;
33 import java.util.HashMap;
34 import java.util.LinkedList;
35 import java.util.List;
36 import java.util.Map;
37
38 public class ArtifactInfoImplTest extends BeConfDependentTest {
39
40         private ArtifactInfoImpl createTestSubject() {
41                 return new ArtifactInfoImpl();
42         }
43
44         @Test
45         public void testConvertToArtifactInfoImpl() throws Exception {
46                 Service service = new Service();
47                 ComponentInstance resourceInstance = new ComponentInstance();
48                 Collection<ArtifactDefinition> list = new LinkedList<>();
49                 ArtifactDefinition artifactDefinition = new ArtifactDefinition();
50                 List<ArtifactInfoImpl> result;
51
52                 // test 1
53                 result = ArtifactInfoImpl.convertToArtifactInfoImpl(service, resourceInstance, list);
54                 Assert.assertEquals(new LinkedList<>(), result);
55
56                 // test 2
57                 artifactDefinition.setUniqueId("mock");
58                 list.add(artifactDefinition);
59                 result = ArtifactInfoImpl.convertToArtifactInfoImpl(service, resourceInstance, list);
60                 Assert.assertFalse(result.isEmpty());
61
62                 // test 3
63                 artifactDefinition.setGeneratedFromId("mock");
64                 result = ArtifactInfoImpl.convertToArtifactInfoImpl(service, resourceInstance, list);
65                 Assert.assertFalse(result.isEmpty());
66         }
67
68         @Test
69         public void testConvertServiceArtifactToArtifactInfoImpl() throws Exception {
70                 Service service = new Service();
71                 Collection<ArtifactDefinition> list = new LinkedList<>();
72                 ArtifactDefinition artifactDefinition = new ArtifactDefinition();
73                 List<ArtifactInfoImpl> result = new LinkedList<>();
74
75                 // test 1
76                 result = ArtifactInfoImpl.convertServiceArtifactToArtifactInfoImpl(service, list);
77                 Assert.assertEquals(new LinkedList<>(), result);
78
79                 // test 2
80                 artifactDefinition.setUniqueId("mock");
81                 list.add(artifactDefinition);
82
83                 result = ArtifactInfoImpl.convertServiceArtifactToArtifactInfoImpl(service, list);
84                 Assert.assertFalse(result.isEmpty());
85
86                 // test 3
87                 artifactDefinition.setGeneratedFromId("mock");
88
89                 result = ArtifactInfoImpl.convertServiceArtifactToArtifactInfoImpl(service, list);
90                 Assert.assertFalse(result.isEmpty());
91         }
92
93         @Test
94         public void testGetUpdatedRequiredArtifactsFromNamesToUuids() throws Exception {
95                 ArtifactDefinition artifactDefinition = null;
96                 Map<String, ArtifactDefinition> artifacts = new HashMap<String, ArtifactDefinition>();
97                 List<String> result;
98
99                 // test 1
100                 artifactDefinition = null;
101                 result = Deencapsulation.invoke(ArtifactInfoImpl.class, "getUpdatedRequiredArtifactsFromNamesToUuids",
102                                 new Object[] { ArtifactDefinition.class, artifacts.getClass() });
103                 Assert.assertEquals(null, result);
104
105                 // test 2
106                 artifactDefinition = new ArtifactDefinition();
107                 result = Deencapsulation.invoke(ArtifactInfoImpl.class, "getUpdatedRequiredArtifactsFromNamesToUuids",
108                                 new Object[] { ArtifactDefinition.class, artifacts.getClass() });
109                 Assert.assertEquals(null, result);
110         }
111
112         @Test
113         public void testGetArtifactName() throws Exception {
114                 ArtifactInfoImpl testSubject;
115                 String result;
116
117                 // default test
118                 testSubject = createTestSubject();
119                 result = testSubject.getArtifactName();
120         }
121
122         @Test
123         public void testSetArtifactName() throws Exception {
124                 ArtifactInfoImpl testSubject;
125                 String artifactName = "";
126
127                 // default test
128                 testSubject = createTestSubject();
129                 testSubject.setArtifactName(artifactName);
130         }
131
132         @Test
133         public void testGetArtifactType() throws Exception {
134                 ArtifactInfoImpl testSubject;
135                 ArtifactTypeEnum result;
136
137                 // default test
138                 testSubject = createTestSubject();
139                 result = testSubject.getArtifactType();
140         }
141
142         @Test
143         public void testSetArtifactType() throws Exception {
144                 ArtifactInfoImpl testSubject;
145                 ArtifactTypeEnum artifactType = null;
146
147                 // default test
148                 testSubject = createTestSubject();
149                 testSubject.setArtifactType(ArtifactTypeEnum.AAI_SERVICE_MODEL);
150         }
151
152         @Test
153         public void testGetArtifactURL() throws Exception {
154                 ArtifactInfoImpl testSubject;
155                 String result;
156
157                 // default test
158                 testSubject = createTestSubject();
159                 result = testSubject.getArtifactURL();
160         }
161
162         @Test
163         public void testSetArtifactURL() throws Exception {
164                 ArtifactInfoImpl testSubject;
165                 String artifactURL = "";
166
167                 // default test
168                 testSubject = createTestSubject();
169                 testSubject.setArtifactURL(artifactURL);
170         }
171
172         @Test
173         public void testGetArtifactChecksum() throws Exception {
174                 ArtifactInfoImpl testSubject;
175                 String result;
176
177                 // default test
178                 testSubject = createTestSubject();
179                 result = testSubject.getArtifactChecksum();
180         }
181
182         @Test
183         public void testSetArtifactChecksum() throws Exception {
184                 ArtifactInfoImpl testSubject;
185                 String artifactChecksum = "";
186
187                 // default test
188                 testSubject = createTestSubject();
189                 testSubject.setArtifactChecksum(artifactChecksum);
190         }
191
192         @Test
193         public void testGetArtifactDescription() throws Exception {
194                 ArtifactInfoImpl testSubject;
195                 String result;
196
197                 // default test
198                 testSubject = createTestSubject();
199                 result = testSubject.getArtifactDescription();
200         }
201
202         @Test
203         public void testSetArtifactDescription() throws Exception {
204                 ArtifactInfoImpl testSubject;
205                 String artifactDescription = "";
206
207                 // default test
208                 testSubject = createTestSubject();
209                 testSubject.setArtifactDescription(artifactDescription);
210         }
211
212         @Test
213         public void testGetArtifactTimeout() throws Exception {
214                 ArtifactInfoImpl testSubject;
215                 Integer result;
216
217                 // default test
218                 testSubject = createTestSubject();
219                 result = testSubject.getArtifactTimeout();
220         }
221
222         @Test
223         public void testSetArtifactTimeout() throws Exception {
224                 ArtifactInfoImpl testSubject;
225                 Integer artifactTimeout = 0;
226
227                 // default test
228                 testSubject = createTestSubject();
229                 testSubject.setArtifactTimeout(artifactTimeout);
230         }
231
232         @Test
233         public void testGetRelatedArtifacts() throws Exception {
234                 ArtifactInfoImpl testSubject;
235                 List<String> result;
236
237                 // default test
238                 testSubject = createTestSubject();
239                 result = testSubject.getRelatedArtifacts();
240         }
241
242         @Test
243         public void testSetRelatedArtifacts() throws Exception {
244                 ArtifactInfoImpl testSubject;
245                 List<String> relatedArtifacts = null;
246
247                 // default test
248                 testSubject = createTestSubject();
249                 testSubject.setRelatedArtifacts(relatedArtifacts);
250         }
251
252         @Test
253         public void testToString() throws Exception {
254                 ArtifactInfoImpl testSubject;
255                 String result;
256
257                 // default test
258                 testSubject = createTestSubject();
259                 result = testSubject.toString();
260         }
261
262         @Test
263         public void testGetArtifactUUID() throws Exception {
264                 ArtifactInfoImpl testSubject;
265                 String result;
266
267                 // default test
268                 testSubject = createTestSubject();
269                 result = testSubject.getArtifactUUID();
270         }
271
272         @Test
273         public void testSetArtifactUUID() throws Exception {
274                 ArtifactInfoImpl testSubject;
275                 String artifactUUID = "";
276
277                 // default test
278                 testSubject = createTestSubject();
279                 testSubject.setArtifactUUID(artifactUUID);
280         }
281
282         @Test
283         public void testGetArtifactVersion() throws Exception {
284                 ArtifactInfoImpl testSubject;
285                 String result;
286
287                 // default test
288                 testSubject = createTestSubject();
289                 result = testSubject.getArtifactVersion();
290         }
291
292         @Test
293         public void testSetArtifactVersion() throws Exception {
294                 ArtifactInfoImpl testSubject;
295                 String artifactVersion = "";
296
297                 // default test
298                 testSubject = createTestSubject();
299                 testSubject.setArtifactVersion(artifactVersion);
300         }
301
302         @Test
303         public void testGetGeneratedFromUUID() throws Exception {
304                 ArtifactInfoImpl testSubject;
305                 String result;
306
307                 // default test
308                 testSubject = createTestSubject();
309                 result = testSubject.getGeneratedFromUUID();
310         }
311
312         @Test
313         public void testSetGeneratedFromUUID() throws Exception {
314                 ArtifactInfoImpl testSubject;
315                 String generatedFromUUID = "";
316
317                 // default test
318                 testSubject = createTestSubject();
319                 testSubject.setGeneratedFromUUID(generatedFromUUID);
320         }
321
322 }