AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-api-handler-infra / src / test / java / org / openecomp / mso / apihandlerinfra / tenantisolation / dmaap / AsdcDmaapClientTest.java
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.openecomp.mso.apihandlerinfra.tenantisolation.dmaap;
22
23 import static org.junit.Assert.assertEquals;
24
25 import java.io.IOException;
26 import java.text.ParseException;
27
28 import org.junit.Test;
29 import org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap.CreateEcompOperationEnvironmentBean;
30
31 import com.fasterxml.jackson.databind.ObjectMapper;
32
33 public class AsdcDmaapClientTest {
34         
35         private final String fileLocation = "src/test/resources/org/openecomp/mso/client/asdc/create-ecompoe/";
36                 
37         private static final String operationalEnvironmentId =  "28122015552391";
38         private static final String operationalEnvironmentName = "Operational Environment Name";
39         private static final String operationalEnvironmentType = "ECOMP";
40         private static final String tenantContext = "TEST";
41         private static final String workloadContext = "ECOMP_E2E-IST";
42         private static final String action = "Create" ; 
43         
44
45         
46         @Test
47         public void verifyasdcCreateoeRequest() throws IOException, ParseException{
48                 
49                 ObjectMapper mapper = new ObjectMapper();
50         
51                 String expected = "{\"operationalEnvironmentId\":\"28122015552391\",\"operationalEnvironmentName\":\"Operational Environment Name\",\"operationalEnvironmentType\":\"ECOMP\",\"tenantContext\":\"TEST\",\"workloadContext\":\"ECOMP_E2E-IST\",\"action\":\"Create\"}";
52         
53                 
54                 CreateEcompOperationEnvironmentBean cBean = new CreateEcompOperationEnvironmentBean();
55                 cBean.setOperationalEnvironmentId(operationalEnvironmentId);
56                 cBean.setoperationalEnvironmentName(operationalEnvironmentName);
57                 cBean.setoperationalEnvironmentType(operationalEnvironmentType);
58                 cBean.settenantContext(tenantContext);
59                 cBean.setworkloadContext(workloadContext);
60                 cBean.setaction(action);
61                 
62                 String actual = mapper.writeValueAsString(cBean);
63                 
64                 assertEquals("payloads are equal", expected, actual);
65         }
66         
67         
68         
69 }