Catalog alignment
[sdc.git] / catalog-fe / src / test / java / org / openecomp / sdc / fe / impl / MdcDataTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  * Modifications copyright (c) 2019 Nokia
20  * ================================================================================
21  */
22 package org.openecomp.sdc.fe.impl;
23
24 import org.junit.Test;
25
26 import static org.junit.Assert.assertEquals;
27
28 public class MdcDataTest {
29
30         private static final String INSTANCE_ID = "INSTANCE_ID";
31         private static final String USER_ID = "USER_ID";
32         private static final String REMOTE_ADDRESS = "REMOTE_ADDRESS";
33         private static final String LOCAL_ADDRESS = "LOCAL_ADDRESS";
34         private static final long TRANSACTION_START_TIME = 123L;
35
36         @Test
37         public void testGetTransactionStartTimeIsSetByConstructor() {
38                 MdcData testSubject = createTestSubject();
39                 assertEquals(testSubject.getTransactionStartTime(), Long.valueOf(TRANSACTION_START_TIME));
40         }
41
42         @Test
43         public void testGetUserIdIsSetByConstructor() {
44                 MdcData testSubject = createTestSubject();
45                 assertEquals(testSubject.getUserId(), USER_ID);
46         }
47
48         @Test
49         public void testGetRemoteAddrIsSetByConstructor() {
50                 MdcData testSubject = createTestSubject();
51                 assertEquals(testSubject.getRemoteAddr(), REMOTE_ADDRESS);
52         }
53
54         @Test
55         public void testGetLocalAddrIsSetByConstructor() {
56                 MdcData testSubject = createTestSubject();
57                 assertEquals(testSubject.getLocalAddr(), LOCAL_ADDRESS);
58         }
59
60         @Test
61         public void testGetServiceInstanceIDIsSetByConstructor(){
62                 MdcData testSubject = createTestSubject();
63                 assertEquals(testSubject.getServiceInstanceID(), INSTANCE_ID);
64         }
65
66         private MdcData createTestSubject() {
67                 return new MdcData(INSTANCE_ID, USER_ID, REMOTE_ADDRESS, LOCAL_ADDRESS, TRANSACTION_START_TIME);
68         }
69
70 }