<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>sdk</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
<name>dcaegen2-services-sdk</name>
<description>Common SDK repo for all DCAE Services</description>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-rest-services</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
* ============LICENSE_START=======================================================
* DCAEGEN2-SERVICES-SDK
* ================================================================================
- * Copyright (C) 2019 Nokia. All rights reserved.
+ * Copyright (C) 2019-2020 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @since 1.1.2
*/
public static @NotNull Mono<CbsClient> createCbsClient(CbsClientConfiguration configuration) {
- return Mono.defer(() -> {
- final RxHttpClient httpClient = buildHttpClient(configuration.trustStoreKeys());
- final CbsLookup cbsLookup = new CbsLookup();
- return cbsLookup.lookup(configuration)
- .map(addr -> new CbsClientImpl(httpClient, configuration.appName(), addr, configuration.protocol()));
- });
+ return Mono.fromCallable(() -> buildHttpClient(configuration.trustStoreKeys()))
+ .cache()
+ .flatMap(httpClient -> createCbsClientMono(httpClient, configuration));
}
private static RxHttpClient buildHttpClient(TrustStoreKeys trustStoreKeys) {
? RxHttpClientFactory.create(trustStoreKeys)
: RxHttpClientFactory.create();
}
+
+ private static Mono<CbsClient> createCbsClientMono(RxHttpClient httpClient,
+ CbsClientConfiguration configuration) {
+ return new CbsLookup().lookup(configuration)
+ .map(addr -> new CbsClientImpl(httpClient, configuration.appName(), addr, configuration.protocol()));
+ }
}
--- /dev/null
+/*
+ * ============LICENSE_START====================================
+ * DCAEGEN2-SERVICES-SDK
+ * =========================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * =========================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================
+ */
+
+package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api;
+
+
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.net.URISyntaxException;
+import java.nio.file.Paths;
+import org.junit.jupiter.api.Test;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.ImmutableCbsClientConfiguration;
+import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableTrustStoreKeys;
+import org.onap.dcaegen2.services.sdk.security.ssl.Passwords;
+import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeysStore;
+import reactor.core.publisher.Mono;
+
+class CbsClientFactoryTest {
+
+ @Test
+ void shouldAllowMultipleSubscriptions() throws URISyntaxException {
+ //given
+ ImmutableCbsClientConfiguration sampleConfiguration = ImmutableCbsClientConfiguration.builder()
+ .protocol("https")
+ .appName("dcae-component")
+ .trustStoreKeys(ImmutableTrustStoreKeys.builder()
+ .trustStore(SecurityKeysStore.fromPath(
+ Paths.get(CbsClientFactoryTest.class.getResource("/test-certs/trust.jks").toURI())))
+ .trustStorePassword(Passwords.fromResource("/test-certs/trust.pass"))
+ .build())
+ .hostname("config-binding-service")
+ .port(10443)
+ .build();
+
+ //when
+ Mono<CbsClient> cbsClient = CbsClientFactory.createCbsClient(sampleConfiguration);
+
+ //then
+ assertThatCode(() -> {
+ CbsClient client1 = cbsClient.block();
+ CbsClient client2 = cbsClient.block();
+ assertThat(client1).isNotNull();
+ assertThat(client2).isNotNull();
+ }).doesNotThrowAnyException();
+ }
+}
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-rest-services</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-rest-services</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-rest-services</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
<parent>
<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>sdk</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk.security</groupId>
<artifactId>dcaegen2-services-sdk-security</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>sdk</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk.security</groupId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk.security</groupId>
<artifactId>dcaegen2-services-sdk-security</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>ssl</artifactId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-services</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>dcaegen2-services-sdk-services-external-schema-manager</artifactId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-services</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>dcaegen2-services-sdk-services-hvvesclient</artifactId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>hvvesclient-producer</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>hvvesclient-producer-api</artifactId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>hvvesclient-producer</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>hvvesclient-producer-ct</artifactId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>hvvesclient-producer</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>hvvesclient-producer-impl</artifactId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-services-hvvesclient</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<artifactId>hvvesclient-producer</artifactId>
<parent>
<artifactId>dcaegen2-services-sdk-services-hvvesclient</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>High Volume VES Collector Client :: Protobuf</name>
<parent>
<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>sdk</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<parent>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
<artifactId>dcaegen2-services-sdk-standardization</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<parent>
<artifactId>dcaegen2-sdk-moher-api</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>Monitoring and Healthcheck :: Health state</name>
<parent>
<artifactId>dcaegen2-sdk-moher-api</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>Monitoring and Healthcheck :: Metrics</name>
<parent>
<artifactId>dcaegen2-services-sdk-standardization</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>Monitoring and Healthcheck</name>
<parent>
<artifactId>dcaegen2-sdk-moher-api</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>Monitoring and Healthcheck :: Server Adapters</name>
<parent>
<artifactId>dcaegen2-sdk-moher-server-adapters</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>Monitoring and Healthcheck :: Server Adapters :: Reactor Netty</name>
<parent>
<artifactId>dcaegen2-sdk-moher-server-adapters</artifactId>
<groupId>org.onap.dcaegen2.services.sdk</groupId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
</parent>
<name>Monitoring and Healthcheck :: Server Adapters :: Spring Webflux</name>
<parent>
<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>sdk</artifactId>
- <version>1.4.3-SNAPSHOT</version>
+ <version>1.4.4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
major=1
minor=4
-patch=3
+patch=4
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT