2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 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.dcae.apod.analytics.dmaap.domain.config;
23 import org.junit.Test;
24 import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants;
25 import org.openecomp.dcae.apod.analytics.dmaap.BaseAnalyticsDMaaPUnitTest;
27 import static org.junit.Assert.assertTrue;
30 * @author Rajiv Singla . Creation Date: 10/14/2016.
32 public class DMaaPMRPublisherConfigTest extends BaseAnalyticsDMaaPUnitTest {
36 public void testPublisherConfigDefaults() throws Exception {
38 final DMaaPMRPublisherConfig actualDefaultPublisherConfig =
39 new DMaaPMRPublisherConfig.Builder(HOST_NAME, TOPIC_NAME).build();
41 final DMaaPMRPublisherConfig expectedDefaultPublisherConfig =
42 new DMaaPMRPublisherConfig.Builder(HOST_NAME, TOPIC_NAME)
43 .setPortNumber(AnalyticsConstants.DEFAULT_PORT_NUMBER)
44 .setContentType(AnalyticsConstants.DEFAULT_CONTENT_TYPE)
45 .setProtocol(AnalyticsConstants.DEFAULT_PROTOCOL)
46 .setMaxBatchSize(AnalyticsConstants.DEFAULT_PUBLISHER_MAX_BATCH_SIZE)
47 .setMaxRecoveryQueueSize(AnalyticsConstants.DEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE)
50 assertTrue("Default Publisher Config parameters must match",
51 actualDefaultPublisherConfig.equals(expectedDefaultPublisherConfig));
57 public void testPublisherCustomConfig() throws Exception {
60 final DMaaPMRPublisherConfig actualCustomPublisherConfig = getPublisherConfig();
62 final DMaaPMRPublisherConfig expectedCustomPublisherConfig =
63 new DMaaPMRPublisherConfig.Builder(HOST_NAME, TOPIC_NAME)
64 .setPortNumber(PORT_NUMBER)
65 .setUserName(USERNAME)
66 .setUserPassword(PASSWORD)
67 .setContentType(CONTENT_TYPE)
68 .setProtocol(HTTP_PROTOCOL)
69 .setMaxBatchSize(PUBLISHER_MAX_BATCH_QUEUE_SIZE)
70 .setMaxRecoveryQueueSize(PUBLISHER_MAX_RECOVERY_QUEUE_SIZE)
73 assertTrue("Custom Publisher Config parameters must match",
74 actualCustomPublisherConfig.equals(expectedCustomPublisherConfig));