Changed to unmaintained
[appc.git] / appc-event-listener / appc-event-listener-bundle / src / test / java / org / onap / appc / listener / LCM / model / InputBodyTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2018 Nokia Solutions and Networks
8  * =============================================================================
9  * Modifications Copyright (C) 2019 IBM.
10  * =============================================================================
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  * 
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  * 
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  * 
23  * ============LICENSE_END=========================================================
24  */
25 package org.onap.appc.listener.LCM.model;
26
27 import static org.junit.Assert.assertEquals;
28 import static org.junit.Assert.assertFalse;
29 import static org.junit.Assert.assertTrue;
30 import static org.onap.appc.listener.TestUtil.buildActionIdentifiers;
31 import static org.onap.appc.listener.TestUtil.buildCommonHeader;
32
33 import org.junit.Before;
34 import org.junit.Test;
35
36 public class InputBodyTest {
37
38     private InputBody inputBody;
39
40     @Before
41     public void setup() {
42         inputBody = new InputBody();
43     }
44
45     @Test
46     public void should_set_properties() {
47
48         CommonHeader testCommonHeader = buildCommonHeader();
49         ActionIdentifiers testActionIdentifiers = buildActionIdentifiers();
50
51         inputBody.setCommonHeader(testCommonHeader);
52         inputBody.setActionIdentifiers(testActionIdentifiers);
53         inputBody.setAction("test-action");
54         inputBody.setPayload("{\"payload\": \"value\"");
55
56         assertEquals(testCommonHeader, inputBody.getCommonHeader());
57         assertEquals(testActionIdentifiers, inputBody.getActionIdentifiers());
58         assertEquals("test-action", inputBody.getAction());
59         assertEquals("{\"payload\": \"value\"", inputBody.getPayload());
60     }
61
62     @Test
63     public void should_verify_if_is_valid() {
64
65         assertFalse(inputBody.isValid());
66         inputBody.setCommonHeader(buildCommonHeader());
67         assertTrue(inputBody.isValid());
68     }
69     
70     @Test
71     public void testPayLoadAsString()
72     {
73         inputBody.setPayloadAsString("payload");
74         assertEquals("payload", inputBody.getPayload());
75     }
76
77
78 }