aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/test/java/org/openecomp/sdcrests/item/rest/mapping/MapActivityLogEntityToDtoTest.java
blob: 3bfc3f7afcb0e216d003a37613cdb2b393758ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright © 2016-2018 European Support Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openecomp.sdcrests.item.rest.mapping;

import static org.junit.Assert.assertEquals;

import java.util.Date;
import org.junit.Test;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.activitylog.dao.type.ActivityType;
import org.openecomp.sdcrests.item.types.ActivityLogDto;

/**
 * This class was generated.
 */
public class MapActivityLogEntityToDtoTest {

    @Test()
    public void testConversion() {

        final ActivityLogEntity source = new ActivityLogEntity();

        final String id = "e8ad437b-8d86-4819-954f-57fb9161a912";
        source.setId(id);

        final ActivityType type = ActivityType.Upload_Artifact;
        source.setType(type);

        final String user = "278dbb70-469d-4a5f-bea2-bc62fa9d4671";
        source.setUser(user);

        final Date timestamp = new Date();
        source.setTimestamp(timestamp);

        final String comment = "1cf631a9-016b-4914-9ced-ded9d5ba9469";
        source.setComment(comment);

        final boolean success = true;
        source.setSuccess(true);

        final String message = "9b5e29e9-b47a-4ece-b8a0-b68f4b346e3b";
        source.setMessage(message);

        final ActivityLogDto target = new ActivityLogDto();
        final MapActivityLogEntityToDto mapper = new MapActivityLogEntityToDto();
        mapper.doMapping(source, target);

        assertEquals(id, target.getId());
        assertEquals(timestamp, target.getTimestamp());
        assertEquals(type.name(), target.getType());
        assertEquals(comment, target.getComment());
        assertEquals(user, target.getUser());
        assertEquals(success, target.getStatus().isSuccess());
        assertEquals(message, target.getStatus().getMessage());
    }
}