7796da5c5dbcc14984b1c04e37953002d473990e
[dcaegen2/services/prh.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * PNF-REGISTRATION-HANDLER
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.dcaegen2.services.service.config;
22
23 import org.junit.jupiter.api.Assertions;
24 import org.junit.jupiter.api.Test;
25 import org.onap.dcaegen2.services.config.DmaapPublisherConfiguration;
26 import org.onap.dcaegen2.services.config.ImmutableDmaapPublisherConfiguration;
27
28 public class DmaapPublisherConfigurationTest {
29
30     // Given
31     private DmaapPublisherConfiguration configuration;
32     private String dmaapHostName = "localhost";
33     private Integer dmaapPortNumber = 2222;
34     private String dmaapTopicName = "temp";
35     private String dmaapProtocol = "http";
36     private String dmaapUserName = "admin";
37     private String dmaapUserPassword = "admin";
38     private String dmaapContentType = "application/json";
39
40
41     @Test
42     public void builder_shouldBuildConfigurationObject() {
43         // When
44         configuration = new ImmutableDmaapPublisherConfiguration.Builder()
45                 .dmaapHostName(dmaapHostName)
46                 .dmaapPortNumber(dmaapPortNumber)
47                 .dmaapTopicName(dmaapTopicName)
48                 .dmaapProtocol(dmaapProtocol)
49                 .dmaapUserName(dmaapUserName)
50                 .dmaapUserPassword(dmaapUserPassword)
51                 .dmaapContentType(dmaapContentType)
52                 .build();
53
54         // Then
55         Assertions.assertNotNull(configuration);
56         Assertions.assertEquals(dmaapHostName, configuration.dmaapHostName());
57         Assertions.assertEquals(dmaapPortNumber, configuration.dmaapPortNumber());
58         Assertions.assertEquals(dmaapTopicName, configuration.dmaapTopicName());
59         Assertions.assertEquals(dmaapProtocol, configuration.dmaapProtocol());
60         Assertions.assertEquals(dmaapUserName, configuration.dmaapUserName());
61         Assertions.assertEquals(dmaapUserPassword, configuration.dmaapUserPassword());
62     }
63 }