2 * ============LICENSE_START=======================================================
3 * Datafile Collector Service
4 * ================================================================================
5 * Copyright (C) 2018 NOKIA 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.onap.dcaegen2.collectors.datafile.service.config;
23 import org.junit.jupiter.api.Assertions;
24 import org.junit.jupiter.api.Test;
25 import org.onap.dcaegen2.collectors.datafile.config.DmaapConsumerConfiguration;
26 import org.onap.dcaegen2.collectors.datafile.config.ImmutableDmaapConsumerConfiguration;
28 class DmaapConsumerConfigurationTest {
31 void builder_shouldBuildConfigurationObject() {
34 DmaapConsumerConfiguration configuration;
35 String consumerId = "1";
36 String dmaapHostName = "localhost";
37 Integer dmaapPortNumber = 2222;
38 String dmaapTopicName = "temp";
39 String dmaapProtocol = "http";
40 String dmaapUserName = "admin";
41 String dmaapUserPassword = "admin";
42 String dmaapContentType = "application/json";
43 String consumerGroup = "other";
44 Integer timeoutMs = 1000;
45 Integer messageLimit = 1000;
48 configuration = new ImmutableDmaapConsumerConfiguration.Builder()
49 .consumerId(consumerId)
50 .dmaapHostName(dmaapHostName)
51 .dmaapPortNumber(dmaapPortNumber)
52 .dmaapTopicName(dmaapTopicName)
53 .dmaapProtocol(dmaapProtocol)
54 .dmaapUserName(dmaapUserName)
55 .dmaapUserPassword(dmaapUserPassword)
56 .dmaapContentType(dmaapContentType)
57 .consumerGroup(consumerGroup)
59 .messageLimit(messageLimit)
63 Assertions.assertNotNull(configuration);
64 Assertions.assertEquals(consumerId, configuration.consumerId());
65 Assertions.assertEquals(dmaapHostName, configuration.dmaapHostName());
66 Assertions.assertEquals(dmaapPortNumber, configuration.dmaapPortNumber());
67 Assertions.assertEquals(dmaapTopicName, configuration.dmaapTopicName());
68 Assertions.assertEquals(dmaapProtocol, configuration.dmaapProtocol());
69 Assertions.assertEquals(dmaapUserName, configuration.dmaapUserName());
70 Assertions.assertEquals(dmaapUserPassword, configuration.dmaapUserPassword());
71 Assertions.assertEquals(consumerGroup, configuration.consumerGroup());
72 Assertions.assertEquals(timeoutMs, configuration.timeoutMs());
73 Assertions.assertEquals(messageLimit, configuration.messageLimit());