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