2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap;
23 import static org.junit.Assert.assertEquals;
25 import java.io.IOException;
26 import java.text.ParseException;
28 import org.junit.Test;
29 import org.openecomp.mso.apihandlerinfra.tenantisolation.dmaap.CreateEcompOperationEnvironmentBean;
31 import com.fasterxml.jackson.databind.ObjectMapper;
33 public class AsdcDmaapClientTest {
35 private final String fileLocation = "src/test/resources/org/openecomp/mso/client/asdc/create-ecompoe/";
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" ;
47 public void verifyasdcCreateoeRequest() throws IOException, ParseException{
49 ObjectMapper mapper = new ObjectMapper();
51 String expected = "{\"operationalEnvironmentId\":\"28122015552391\",\"operationalEnvironmentName\":\"Operational Environment Name\",\"operationalEnvironmentType\":\"ECOMP\",\"tenantContext\":\"TEST\",\"workloadContext\":\"ECOMP_E2E-IST\",\"action\":\"Create\"}";
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);
62 String actual = mapper.writeValueAsString(cBean);
64 assertEquals("payloads are equal", expected, actual);