aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>2021-08-24 11:20:54 +0200
committerPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>2021-08-24 15:06:14 +0200
commit373aa4076b59a63eae8440a338e2836902e9ebe4 (patch)
tree5c5e94b14bb1d16ae8c6c9c9833e9858384689dd /src/test/java
parent0277b1831312d847877e7fe2c4bdcfe66034a8ed (diff)
Update DCAE SDK library
Issue-ID: DCAEGEN2-2719 Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> Change-Id: If4086ddf60747b4d87c5067a68df748a7dc2c689
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java4
-rw-r--r--src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java23
2 files changed, 13 insertions, 14 deletions
diff --git a/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java b/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
index 49132f1e..1aa54257 100644
--- a/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
+++ b/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2020-2021 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.
@@ -43,7 +43,7 @@ public class ApplicationConfigurationListenerTest {
private ApplicationConfigurationListener applicationConfigurationListener;
@Test
- public void shouldStopJobAndCloseConnectionWhenErrorOccurredDuringListenAtConsulChange() {
+ public void shouldStopJobAndCloseConnectionWhenErrorOccurredDuringListenAtConfigChange() {
// given
Mockito.doThrow(new RuntimeException("Simulate exception")).when(configurationHandler).startListen(any());
diff --git a/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java b/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
index 7b1af1de..8ad1dd0a 100644
--- a/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
+++ b/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.s
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.s
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,9 +41,9 @@ import java.time.Duration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class CbsConfigurationHandlerTest {
@@ -67,9 +67,8 @@ public class CbsConfigurationHandlerTest {
@Test
public void shouldCreateCbsConfigurationHandler() {
// given
-
- when(cbsConfigurationHandler.createCbsClient(cbsClientConfiguration)).thenReturn(cbsClient);
- when(cbsClientConfigurationProvider.get()).thenReturn(cbsClientConfiguration);
+ doReturn(cbsClient).when(cbsConfigurationHandler).createCbsClient(cbsClientConfiguration);
+ doReturn(cbsClientConfiguration).when(cbsClientConfigurationProvider).get();
// when
final Disposable handler = cbsConfigurationHandler.startListen(Duration.ofMinutes(5));
@@ -81,10 +80,10 @@ public class CbsConfigurationHandlerTest {
@Test
public void shouldUpdateAppConfigurationWhenConfigurationIsValid() {
// given
- final JsonObject configuration = createConsulConfiguration(VES_CONSUL_CONFIG);
+ final JsonObject configuration = createConfiguration(VES_CONSUL_CONFIG);
// when
- this.cbsConfigurationHandler.handleConfigurationFromConsul(configuration);
+ this.cbsConfigurationHandler.handleConfiguration(configuration);
// then
final ArgumentCaptor<Option<JSONObject>> acConfiguration = ArgumentCaptor.forClass(Option.class);
@@ -93,12 +92,12 @@ public class CbsConfigurationHandlerTest {
}
@Test
- public void shouldReportAnErrorWhenConsulReturnsEmptyConfiguration() {
+ public void shouldReportAnErrorWhenConfigHandlerReturnsEmptyConfiguration() {
// given
- final JsonObject configuration = createConsulConfiguration("{}");
+ final JsonObject configuration = createConfiguration("{}");
// when
- assertThatThrownBy(() -> this.cbsConfigurationHandler.handleConfigurationFromConsul(configuration))
+ assertThatThrownBy(() -> this.cbsConfigurationHandler.handleConfiguration(configuration))
.isInstanceOf(IllegalArgumentException.class).hasMessageContaining(String.format("Invalid application configuration: %s ", "{}"));
// then
@@ -109,8 +108,8 @@ public class CbsConfigurationHandlerTest {
return new JSONObject(vesConfig).toString();
}
- private JsonObject createConsulConfiguration(String vesConsulConfig) {
- return new JsonParser().parse(vesConsulConfig).getAsJsonObject();
+ private JsonObject createConfiguration(String vesConfig) {
+ return new JsonParser().parse(vesConfig).getAsJsonObject();
}