2  * ============LICENSE_START=======================================================
 
   3  * DCAEGEN2-SERVICES-SDK
 
   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.services.sdk.rest.services.dmaap.client.config;
 
  23 import static org.junit.jupiter.api.Assertions.assertEquals;
 
  25 import org.junit.jupiter.api.Test;
 
  26 import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
 
  27 import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.ImmutableDmaapPublisherConfiguration;
 
  29 class DmaapPublisherConfigurationTest {
 
  33     void builder_shouldBuildConfigurationObject() {
 
  36         DmaapPublisherConfiguration configuration;
 
  37         String dmaapHostName = "localhost";
 
  38         Integer dmaapPortNumber = 2222;
 
  39         String dmaapTopicName = "temp";
 
  40         String dmaapProtocol = "http";
 
  41         String dmaapUserName = "admin";
 
  42         String dmaapUserPassword = "admin";
 
  43         String dmaapContentType = "application/json";
 
  44         String trustStorePath = "trustStorePath";
 
  45         String trustStorePasswordPath = "trustStorePasswordPath";
 
  46         String keyStorePath = "keyStorePath";
 
  47         String keyStorePasswordPath = "keyStorePasswordPath";
 
  48         Boolean enableDmaapCertAuth = true;
 
  51         configuration = new ImmutableDmaapPublisherConfiguration.Builder()
 
  52                 .dmaapHostName(dmaapHostName)
 
  53                 .dmaapPortNumber(dmaapPortNumber)
 
  54                 .dmaapTopicName(dmaapTopicName)
 
  55                 .dmaapProtocol(dmaapProtocol)
 
  56                 .dmaapUserName(dmaapUserName)
 
  57                 .dmaapUserPassword(dmaapUserPassword)
 
  58                 .dmaapContentType(dmaapContentType)
 
  59                 .trustStorePath(trustStorePath)
 
  60                 .trustStorePasswordPath(trustStorePasswordPath)
 
  61                 .keyStorePath(keyStorePath)
 
  62                 .keyStorePasswordPath(keyStorePasswordPath)
 
  63                 .enableDmaapCertAuth(enableDmaapCertAuth)
 
  67         assertEquals("DmaapPublisherConfiguration{dmaapHostName=localhost, dmaapPortNumber=2222, "
 
  68                 + "dmaapTopicName=temp, dmaapProtocol=http, dmaapUserName=admin, dmaapUserPassword=admin, "
 
  69                 + "dmaapContentType=application/json, trustStorePath=trustStorePath, "
 
  70                 + "trustStorePasswordPath=trustStorePasswordPath, keyStorePath=keyStorePath, "
 
  71                 + "keyStorePasswordPath=keyStorePasswordPath, enableDmaapCertAuth=true}", configuration.toString());