2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2018 Nokia Solutions and Networks
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=========================================================
23 package org.onap.appc.listener.LCM.model;
25 import static org.junit.Assert.assertEquals;
26 import static org.onap.appc.listener.TestUtil.JSON_INPUT_BODY_STR;
28 import com.fasterxml.jackson.databind.JsonNode;
29 import org.junit.Before;
30 import org.junit.Test;
31 import org.onap.appc.listener.util.Mapper;
33 public class DmaapIncomingMessageTest {
35 private DmaapIncomingMessage dmaapIncomingMessage;
39 dmaapIncomingMessage = new DmaapIncomingMessage();
43 public void should_set_default_cambria_partition_when_initialized() {
45 assertEquals("APP-C", dmaapIncomingMessage.getCambriaPartition());
49 public void toString_should_return_valid_string_representation() {
50 JsonNode jsonNode = Mapper.toJsonNodeFromJsonString(JSON_INPUT_BODY_STR);
52 dmaapIncomingMessage.setVersion("test-version");
53 dmaapIncomingMessage.setType("test-type");
54 dmaapIncomingMessage.setCorrelationID("test-correlation-id");
55 dmaapIncomingMessage.setCambriaPartition("test-cambria-partition");
56 dmaapIncomingMessage.setRpcName("test-rpc-name");
57 dmaapIncomingMessage.setBody(jsonNode);
59 assertEquals("DmaapIncomingMessage{DmaapMessage{" +
60 "version='" + dmaapIncomingMessage.getVersion() + '\'' +
61 ", type='" + dmaapIncomingMessage.getType() + '\'' +
62 ", correlationId='" + dmaapIncomingMessage.getCorrelationID() + '\'' +
63 ", cambriaPartition='" + dmaapIncomingMessage.getCambriaPartition() + '\'' +
64 ", rpcName='" + dmaapIncomingMessage.getRpcName() + '\'' +
65 ", body=" + dmaapIncomingMessage.getBody() +
66 "}}", dmaapIncomingMessage.toString());