Onboarding upload control
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / test / java / org / openecomp / sdcrests / vsp / rest / mapping / VspUploadStatusRecordMapperTest.java
1 /*
2  * -
3  *  ============LICENSE_START=======================================================
4  *  Copyright (C) 2022 Nordix Foundation.
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  *  SPDX-License-Identifier: Apache-2.0
19  *  ============LICENSE_END=========================================================
20  */
21
22 package org.openecomp.sdcrests.vsp.rest.mapping;
23
24 import static org.junit.jupiter.api.Assertions.assertEquals;
25
26 import java.util.Date;
27 import java.util.UUID;
28 import org.junit.jupiter.api.Test;
29 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspUploadStatusRecord;
30 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspUploadStatus;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspUploadStatusDto;
32
33 class VspUploadStatusRecordMapperTest {
34
35     @Test
36     void fullMappingTest() {
37         //given
38         final VspUploadStatusRecordMapper vspUploadStatusRecordMapper = new VspUploadStatusRecordMapper();
39         final var vspUploadStatus = new VspUploadStatusRecord();
40         vspUploadStatus.setVspId("vspId");
41         vspUploadStatus.setVspVersionId("vspVersionId");
42         vspUploadStatus.setStatus(VspUploadStatus.UPLOADING);
43         vspUploadStatus.setLockId(UUID.randomUUID());
44         vspUploadStatus.setIsComplete(true);
45         vspUploadStatus.setCreated(new Date());
46         vspUploadStatus.setUpdated(new Date());
47         final var vspUploadStatusDto = new VspUploadStatusDto();
48         //when
49         vspUploadStatusRecordMapper.doMapping(vspUploadStatus, vspUploadStatusDto);
50         //then
51         assertEquals(vspUploadStatus.getVspId(), vspUploadStatusDto.getVspId());
52         assertEquals(vspUploadStatus.getVspVersionId(), vspUploadStatusDto.getVspVersionId());
53         assertEquals(vspUploadStatus.getStatus(), vspUploadStatusDto.getStatus());
54         assertEquals(vspUploadStatus.getLockId(), vspUploadStatusDto.getLockId());
55         assertEquals(vspUploadStatus.getIsComplete(), vspUploadStatusDto.isComplete());
56         assertEquals(vspUploadStatus.getCreated(), vspUploadStatusDto.getCreated());
57         assertEquals(vspUploadStatus.getUpdated(), vspUploadStatusDto.getUpdated());
58     }
59 }