Sorted out unit-test libraries in onboarding
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / test / java / org / openecomp / sdcrests / vendorlicense / rest / mapping / MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdcrests.vendorlicense.rest.mapping;
18
19 import static org.testng.Assert.assertEquals;
20
21 import java.util.Arrays;
22 import java.util.Collections;
23 import java.util.HashSet;
24 import java.util.Set;
25 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
26 import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
27 import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
28 import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
29 import org.testng.annotations.Test;
30
31
32 public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest {
33
34     @Test
35     public void testReferencingFeatureGroups() {
36         EntitlementPoolEntity source = new EntitlementPoolEntity();
37         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
38         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
39                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
40         Set<String> param = new HashSet<>(Collections.singletonList("a3ad0c7a-9f4c-44d2-8c0c-b4b47cd6d264"));
41         source.setReferencingFeatureGroups(param);
42         mapper.doMapping(source, target);
43         assertEquals(target.getReferencingFeatureGroups(), param);
44     }
45
46     @Test
47     public void testDescription() {
48         EntitlementPoolEntity source = new EntitlementPoolEntity();
49         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
50         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
51                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
52         String param = "58191782-5de2-4d42-b8ca-119707d38150";
53         source.setDescription(param);
54         mapper.doMapping(source, target);
55         assertEquals(target.getDescription(), param);
56     }
57
58     @Test
59     public void testIncrements() {
60         EntitlementPoolEntity source = new EntitlementPoolEntity();
61         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
62         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
63                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
64         String param = "ea6b2eab-f959-41c2-9a09-2898eb5401be";
65         source.setIncrements(param);
66         mapper.doMapping(source, target);
67         assertEquals(target.getIncrements(), param);
68     }
69
70     @Test
71     public void testExpiryDate() {
72         EntitlementPoolEntity source = new EntitlementPoolEntity();
73         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
74         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
75                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
76         String param = "7e27d6a4-78be-44df-b099-dd41317586ba";
77         source.setExpiryDate(param);
78         mapper.doMapping(source, target);
79         assertEquals(target.getExpiryDate(), param);
80     }
81
82     @Test
83     public void testId() {
84         EntitlementPoolEntity source = new EntitlementPoolEntity();
85         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
86         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
87                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
88         String param = "e2163b3f-971e-4523-a5bc-0e6f7dd44e37";
89         source.setId(param);
90         mapper.doMapping(source, target);
91         assertEquals(target.getId(), param);
92     }
93
94     @Test
95     public void testThresholdValue() {
96         EntitlementPoolEntity source = new EntitlementPoolEntity();
97         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
98         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
99                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
100         Integer param = 2146099790;
101         source.setThresholdValue(param);
102         mapper.doMapping(source, target);
103         assertEquals(target.getThresholdValue(), param);
104     }
105
106     @Test
107     public void testName() {
108         EntitlementPoolEntity source = new EntitlementPoolEntity();
109         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
110         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
111                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
112         mapper.doMapping(source, target);
113         assertEquals(target.getName(), source.getName());
114         String param = "f8faa28a-435d-4cea-98ee-de7a46b52ec5";
115         source.setName(param);
116         mapper.doMapping(source, target);
117         assertEquals(target.getName(), param);
118     }
119
120     @Test
121     public void testOperationalScope() {
122         EntitlementPoolEntity source = new EntitlementPoolEntity();
123         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
124         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
125                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
126         MultiChoiceOrOther<OperationalScope> param = new MultiChoiceOrOther<>();
127         param.setChoices(new HashSet(Arrays.asList("a", "b")));
128         source.setOperationalScope(param);
129         mapper.doMapping(source, target);
130         assertEquals(target.getOperationalScope().getChoices(), param.getChoices());
131     }
132
133     @Test
134     public void testStartDate() {
135         EntitlementPoolEntity source = new EntitlementPoolEntity();
136         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
137         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
138                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
139         String param = "afeadea1-9fb7-4d2d-bcc3-3ef298ed1802";
140         source.setStartDate(param);
141         mapper.doMapping(source, target);
142         assertEquals(target.getStartDate(), param);
143     }
144
145     @Test
146     public void testManufacturerReferenceNumber() {
147         EntitlementPoolEntity source = new EntitlementPoolEntity();
148         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
149         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = new
150             MapEntitlementPoolEntityToEntitlementPoolEntityDto();
151
152         String param = "02402e1e-7092-485a-9574-46e2d49cca97";
153         source.setManufacturerReferenceNumber(param);
154         mapper.doMapping(source, target);
155         assertEquals(target.getManufacturerReferenceNumber(), param);
156     }
157 }