2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 Ericsson
6 * ================================================================================
7 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.appc.messageadapter.impl;
26 import static org.junit.Assert.assertTrue;
28 import javax.ws.rs.core.Response.Status;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.mockito.Mockito;
33 import org.onap.appc.domainmodel.lcm.CommonHeader;
34 import org.onap.appc.domainmodel.lcm.ResponseContext;
35 import org.onap.appc.domainmodel.lcm.VNFOperation;
36 import org.onap.appc.srvcomm.messaging.MessagingConnector;
37 import com.att.eelf.configuration.EELFLogger;
38 import com.att.eelf.configuration.EELFManager;
39 import com.fasterxml.jackson.core.JsonProcessingException;
41 public class MessageAdapterImplTest {
43 private final MessagingConnector connector = Mockito.mock(MessagingConnector.class);
44 private static final EELFLogger logger = EELFManager.getInstance().getLogger(MessageAdapterImpl.class);
45 private final MessageAdapterImpl impl = new MessageAdapterImpl();
53 public void testSuccess() throws JsonProcessingException {
55 ResponseContext context = new ResponseContext();
56 context.setPayload("payload");
57 org.onap.appc.domainmodel.lcm.Status status = new org.onap.appc.domainmodel.lcm.Status();
59 status.setMessage("success");
60 context.setStatus(status);
61 CommonHeader commonHeader = new CommonHeader();
62 commonHeader.setRequestId("test123");
63 commonHeader.setSubRequestId("test456");
64 context.setCommonHeader(commonHeader);
65 Mockito.when(connector.publishMessage(Mockito.any(), Mockito.any(),Mockito.any())).thenReturn(true);
66 assertTrue(impl.post(VNFOperation.Start, "test", context));