diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2020-09-22 12:16:46 -0400 |
---|---|---|
committer | Singal, Kapil (ks220y) <ks220y@att.com> | 2020-09-22 13:49:05 -0400 |
commit | 1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch) | |
tree | 4a821659cf3b50cf946cbb535d528be8508e9fff /ms/blueprintsprocessor/modules/commons/dmaap-lib/src | |
parent | d97021cd756d63402545fdc2e14ac7611c3da118 (diff) |
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation
Issue-ID: CCSDK-2852
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons/dmaap-lib/src')
6 files changed, 63 insertions, 57 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt index 8ccd8cd56..dfe95733f 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt @@ -28,8 +28,7 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher * Representation of DMAAP client service for AAF auth type. */ class AafAuthDmaapClientService( - private val clientProps: - AafAuthDmaapClientProperties + private val clientProps: AafAuthDmaapClientProperties ) : BluePrintDmaapClientService { diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt index cbde4d003..82c3f3a80 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt @@ -96,7 +96,8 @@ interface BluePrintDmaapClientService { } catch (e: IOException) { log.warn( "Unable to cleanly close the connection from the " + - "client $client", e + "client $client", + e ) } } diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt index 44ed5316b..20d9afdef 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt @@ -39,8 +39,9 @@ open class BluePrintDmaapLibConfiguration class DmaapLibConstants { companion object { + const val SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY = "blueprint" + - "-dmaap-lib-property-service" + "-dmaap-lib-property-service" const val TYPE_HTTP_NO_AUTH = "HTTPNOAUTH" const val TYPE_HTTP_AAF_AUTH = "HTTPAAF" } diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt index a3eed159f..e5c9d432f 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt @@ -70,21 +70,21 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi * node. */ fun blueprintDmaapClientService(jsonNode: JsonNode): - BluePrintDmaapClientService { - val dmaapProps = dmaapClientProperties(jsonNode) - return blueprintDmaapClientService(dmaapProps) - } + BluePrintDmaapClientService { + val dmaapProps = dmaapClientProperties(jsonNode) + return blueprintDmaapClientService(dmaapProps) + } /** * Returns the DMAAP client by providing the input properties as a * selector string. */ fun blueprintDmaapClientService(selector: String): - BluePrintDmaapClientService { - val prefix = "blueprintsprocessor.dmaapclient.$selector" - val dmaapProps = dmaapClientProperties(prefix) - return blueprintDmaapClientService(dmaapProps) - } + BluePrintDmaapClientService { + val prefix = "blueprintsprocessor.dmaapclient.$selector" + val dmaapProps = dmaapClientProperties(prefix) + return blueprintDmaapClientService(dmaapProps) + } /** * Returns the DMAAP client properties from the type of connection it @@ -114,7 +114,7 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi else -> { throw BluePrintProcessorException( "DMAAP adaptor($type) is " + - "not supported" + "not supported" ) } } @@ -149,7 +149,7 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi else -> { throw BluePrintProcessorException( "DMAAP adaptor($type) is " + - "not supported" + "not supported" ) } } @@ -160,24 +160,24 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi * Returns DMAAP client service according to the type of client properties. */ private fun blueprintDmaapClientService(clientProps: DmaapClientProperties): - BluePrintDmaapClientService { - when (clientProps) { - is HttpNoAuthDmaapClientProperties -> { - return HttpNoAuthDmaapClientService(clientProps) - } - - is AafAuthDmaapClientProperties -> { - return AafAuthDmaapClientService(clientProps) - } - - else -> { - throw BluePrintProcessorException( - "Unable to get the DMAAP " + + BluePrintDmaapClientService { + when (clientProps) { + is HttpNoAuthDmaapClientProperties -> { + return HttpNoAuthDmaapClientService(clientProps) + } + + is AafAuthDmaapClientProperties -> { + return AafAuthDmaapClientService(clientProps) + } + + else -> { + throw BluePrintProcessorException( + "Unable to get the DMAAP " + "client" - ) + ) + } } } - } /** * Parses the event.properties file which contains the default values for diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt index a3e347adc..d4adfcaac 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt @@ -29,7 +29,7 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher */ class HttpNoAuthDmaapClientService( private val clientProps: - HttpNoAuthDmaapClientProperties + HttpNoAuthDmaapClientProperties ) : BluePrintDmaapClientService { diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt index 3fb7f6802..e6043caae 100644 --- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt +++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt @@ -50,17 +50,21 @@ import kotlin.test.assertNotNull @EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class]) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) @ContextConfiguration( - classes = [BluePrintDmaapLibConfiguration::class, TestController::class, - BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class] + classes = [ + BluePrintDmaapLibConfiguration::class, TestController::class, + BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class + ] ) @TestPropertySource( - properties = ["server.port=9111", + properties = [ + "server.port=9111", "blueprintsprocessor.dmaapclient.aai.topic=cds_aai", "blueprintsprocessor.dmaapclient.aai.type=HTTPNOAUTH", "blueprintsprocessor.dmaapclient.aai.host=127.0.0.1:9111", "blueprintsprocessor.dmaapclient.multi.topic=cds_multi1,cds_multi2", "blueprintsprocessor.dmaapclient.multi.type=HTTPNOAUTH", - "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"] + "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111" + ] ) class TestDmaapEventPublisher { @@ -77,8 +81,8 @@ class TestDmaapEventPublisher { strList.add( "{\n" + - " \"a\" : \"hello\"\n" + - "}" + " \"a\" : \"hello\"\n" + + "}" ) dmaapClient.sendMessage(strList) val msgs = dmaapClient.close(2) @@ -95,8 +99,8 @@ class TestDmaapEventPublisher { fun testEventPropertiesWithSingleMsg() { val dmaapClient = dmaapService.blueprintDmaapClientService("aai") val str: String = "{\n" + - " \"a\" : \"hello\"\n" + - "}" + " \"a\" : \"hello\"\n" + + "}" dmaapClient.sendMessage(str) val msgs = dmaapClient.close(2) assertEquals(msgs!!.size, 1) @@ -114,8 +118,8 @@ class TestDmaapEventPublisher { strList.add( "{\n" + - " \"a\" : \"hello\"\n" + - "}" + " \"a\" : \"hello\"\n" + + "}" ) dmaapClient.sendMessage(strList) val msgs = dmaapClient.close(2) @@ -132,10 +136,10 @@ class TestDmaapEventPublisher { @Test fun testMultiTopicPropertiesWithJsonInput() { val jsonString = "{\n" + - " \"topic\" : \"cds_json1,cds_json2\",\n" + - " \"type\" : \"HTTPNOAUTH\",\n" + - " \"host\" : \"127.0.0.1:9111\"\n" + - "}" + " \"topic\" : \"cds_json1,cds_json2\",\n" + + " \"type\" : \"HTTPNOAUTH\",\n" + + " \"host\" : \"127.0.0.1:9111\"\n" + + "}" val mapper = ObjectMapper() val node = mapper.readTree(jsonString) val strList = mutableListOf<String>() @@ -143,8 +147,8 @@ class TestDmaapEventPublisher { strList.add( "{\n" + - " \"a\" : \"hello\"\n" + - "}" + " \"a\" : \"hello\"\n" + + "}" ) dmaapClient.sendMessage(strList) val msgs = dmaapClient.close(2) @@ -165,13 +169,13 @@ class TestDmaapEventPublisher { strList.add( "{\n" + - " \"a\" : \"hello\"\n" + - "}" + " \"a\" : \"hello\"\n" + + "}" ) strList.add( "{\n" + - " \"a\" : \"second\"\n" + - "}" + " \"a\" : \"second\"\n" + + "}" ) dmaapClient.sendMessage(strList) val msgs = dmaapClient.close(2) @@ -190,8 +194,9 @@ class TestDmaapEventPublisher { ) assertNotNull(properties, "failed to create property bean") assertNotNull( - properties.host, "failed to get url property" + - " in property bean" + properties.host, + "failed to get url property" + + " in property bean" ) } @@ -221,11 +226,11 @@ open class TestController { */ @PostMapping(path = ["/{topic}"]) fun postTopic(@PathVariable(value = "topic") topic: String): - ResponseEntity<Any> { - var a = "{\n" + + ResponseEntity<Any> { + var a = "{\n" + " \"message\" : \"The message is published into $topic " + "topic\"\n" + "}" - return ResponseEntity(a, HttpStatus.OK) - } + return ResponseEntity(a, HttpStatus.OK) + } } |