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