0455c943e4a14dd5a64eeecfa8e2a45c5d9e736d
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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  */
20
21 package org.onap.so.apihandlerinfra.tenantisolation.dmaap;
22
23 import static org.junit.Assert.assertEquals;
24 import java.io.IOException;
25 import java.text.ParseException;
26 import org.junit.Test;
27 import org.onap.so.apihandlerinfra.BaseTest;
28 import com.fasterxml.jackson.databind.ObjectMapper;
29
30 public class SDCDmaapClientTest extends BaseTest {
31
32     private final String fileLocation = "src/test/resources/org/onap/so/client/asdc/create-ecompoe/";
33
34     private static final String operationalEnvironmentId = "28122015552391";
35     private static final String operationalEnvironmentName = "Operational Environment Name";
36     private static final String operationalEnvironmentType = "ECOMP";
37     private static final String tenantContext = "TEST";
38     private static final String workloadContext = "ECOMP_E2E-IST";
39     private static final String action = "Create";
40
41
42
43     @Test
44     public void verifyasdcCreateoeRequest() throws IOException, ParseException {
45
46         ObjectMapper mapper = new ObjectMapper();
47
48         String expected =
49                 "{\"operationalEnvironmentId\":\"28122015552391\",\"operationalEnvironmentName\":\"Operational Environment Name\",\"operationalEnvironmentType\":\"ECOMP\",\"tenantContext\":\"TEST\",\"workloadContext\":\"ECOMP_E2E-IST\",\"action\":\"Create\"}";
50
51
52         CreateEcompOperationEnvironmentBean cBean = new CreateEcompOperationEnvironmentBean();
53         cBean.setOperationalEnvironmentId(operationalEnvironmentId);
54         cBean.setoperationalEnvironmentName(operationalEnvironmentName);
55         cBean.setoperationalEnvironmentType(operationalEnvironmentType);
56         cBean.settenantContext(tenantContext);
57         cBean.setworkloadContext(workloadContext);
58         cBean.setaction(action);
59
60         String actual = mapper.writeValueAsString(cBean);
61
62         assertEquals("payloads are equal", expected, actual);
63     }
64
65
66
67 }