2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.dmaap.domain.config;
\r
23 import org.junit.Test;
\r
24 import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants;
\r
25 import org.openecomp.dcae.apod.analytics.dmaap.BaseAnalyticsDMaaPUnitTest;
\r
27 import static org.junit.Assert.assertTrue;
\r
30 * @author Rajiv Singla . Creation Date: 10/14/2016.
\r
32 public class DMaaPMRPublisherConfigTest extends BaseAnalyticsDMaaPUnitTest {
\r
36 public void testPublisherConfigDefaults() throws Exception {
\r
38 final DMaaPMRPublisherConfig actualDefaultPublisherConfig =
\r
39 new DMaaPMRPublisherConfig.Builder(HOST_NAME, TOPIC_NAME).build();
\r
41 final DMaaPMRPublisherConfig expectedDefaultPublisherConfig =
\r
42 new DMaaPMRPublisherConfig.Builder(HOST_NAME, TOPIC_NAME)
\r
43 .setPortNumber(AnalyticsConstants.DEFAULT_PORT_NUMBER)
\r
44 .setContentType(AnalyticsConstants.DEFAULT_CONTENT_TYPE)
\r
45 .setProtocol(AnalyticsConstants.DEFAULT_PROTOCOL)
\r
46 .setMaxBatchSize(AnalyticsConstants.DEFAULT_PUBLISHER_MAX_BATCH_SIZE)
\r
47 .setMaxRecoveryQueueSize(AnalyticsConstants.DEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE)
\r
50 assertTrue("Default Publisher Config parameters must match",
\r
51 actualDefaultPublisherConfig.equals(expectedDefaultPublisherConfig));
\r
57 public void testPublisherCustomConfig() throws Exception {
\r
60 final DMaaPMRPublisherConfig actualCustomPublisherConfig = getPublisherConfig();
\r
62 final DMaaPMRPublisherConfig expectedCustomPublisherConfig =
\r
63 new DMaaPMRPublisherConfig.Builder(HOST_NAME, TOPIC_NAME)
\r
64 .setPortNumber(PORT_NUMBER)
\r
65 .setUserName(USERNAME)
\r
66 .setUserPassword(PASSWORD)
\r
67 .setContentType(CONTENT_TYPE)
\r
68 .setProtocol(HTTP_PROTOCOL)
\r
69 .setMaxBatchSize(PUBLISHER_MAX_BATCH_QUEUE_SIZE)
\r
70 .setMaxRecoveryQueueSize(PUBLISHER_MAX_RECOVERY_QUEUE_SIZE)
\r
73 assertTrue("Custom Publisher Config parameters must match",
\r
74 actualCustomPublisherConfig.equals(expectedCustomPublisherConfig));
\r