summaryrefslogtreecommitdiffstats
path: root/controlloop/common/feature-controlloop-trans
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2023-08-30 14:57:10 +0100
committeradheli.tavares <adheli.tavares@est.tech>2023-09-22 16:08:42 +0100
commitfc19178b956f4474ed14e810fd911ac60f3756d0 (patch)
tree196af66a25ca190af8f2b2199f977a4e58aad8b3 /controlloop/common/feature-controlloop-trans
parentd7d54fef032a2ba3118232506a7ed37f24eb4131 (diff)
Upgrade Java 17 in policy-drools-apps
Issue-ID: POLICY-4816 Change-Id: I61d5c2c0b8bf2cc08416d91bbd84f27f2ed5c5c1 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'controlloop/common/feature-controlloop-trans')
-rw-r--r--controlloop/common/feature-controlloop-trans/pom.xml11
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java23
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java16
-rw-r--r--controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java112
-rw-r--r--controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java40
5 files changed, 99 insertions, 103 deletions
diff --git a/controlloop/common/feature-controlloop-trans/pom.xml b/controlloop/common/feature-controlloop-trans/pom.xml
index e86084a3d..27da2d77b 100644
--- a/controlloop/common/feature-controlloop-trans/pom.xml
+++ b/controlloop/common/feature-controlloop-trans/pom.xml
@@ -20,13 +20,14 @@
============LICENSE_END=========================================================
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.policy.drools-applications.controlloop.common</groupId>
<artifactId>drools-applications-common</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>feature-controlloop-trans</artifactId>
@@ -98,9 +99,8 @@
<language>jaxrs-spec</language>
<generateModels>false</generateModels>
<generateSupportingFiles>false</generateSupportingFiles>
- <sortParamsByRequiredFlag>false</sortParamsByRequiredFlag>
<importMappings>
- Response=javax.ws.rs.core.Response
+ Response=jakarta.ws.rs.core.Response
</importMappings>
<typeMappings>
<typeMapping>Integer=int</typeMapping>
@@ -109,8 +109,9 @@
<configOptions>
<useTags>true</useTags>
<sourceFolder>src/gen/java</sourceFolder>
- <dateLibrary>java11</dateLibrary>
+ <dateLibrary>java17</dateLibrary>
<interfaceOnly>true</interfaceOnly>
+ <jakarta>true</jakarta>
</configOptions>
</configuration>
</execution>
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
index 66a975024..93f204df3 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -166,16 +167,10 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
setNotificationValues(controller, notification);
switch (notification.getNotification()) {
- case REJECTED:
- case FINAL_FAILURE:
- case FINAL_SUCCESS:
- case FINAL_OPENLOOP:
+ case REJECTED, FINAL_FAILURE, FINAL_SUCCESS, FINAL_OPENLOOP:
endTransaction(controller, notification);
break;
- case ACTIVE:
- case OPERATION:
- case OPERATION_SUCCESS:
- case OPERATION_FAILURE:
+ case ACTIVE, OPERATION, OPERATION_SUCCESS, OPERATION_FAILURE:
/* any other value is an in progress transaction */
inProgressTransaction(notification);
break;
@@ -358,14 +353,14 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics {
.setEndTime(notification.getNotificationTime().toInstant());
switch (notification.getNotification()) {
- case FINAL_OPENLOOP:
- /* fall through */
- case FINAL_SUCCESS:
+ case FINAL_OPENLOOP,
+ /* fall through */
+ FINAL_SUCCESS:
trans.setStatusCode(true);
break;
- case FINAL_FAILURE:
- /* fall through */
- case REJECTED:
+ case FINAL_FAILURE,
+ /* fall through */
+ REJECTED:
trans.setStatusCode(false);
break;
default:
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java
index be4f1b69f..d6d8d1aec 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/server/restful/RestTransactionTracker.java
@@ -21,15 +21,15 @@
package org.onap.policy.drools.server.restful;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
import java.util.UUID;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.onap.policy.common.endpoints.http.server.YamlMessageBodyHandler;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.drools.apps.controlloop.feature.trans.ControlLoopMetricsManager;
diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
index ba39b2799..77ce83b83 100644
--- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
+++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,20 +22,20 @@
package org.onap.policy.drools.apps.controlloop.feature.trans;
import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.Path;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.controlloop.ControlLoopNotificationType;
@@ -47,7 +48,7 @@ import org.onap.policy.drools.system.PolicyEngineConstants;
/**
* ControlLoopMetrics Tests.
*/
-public class ControlLoopMetricsFeatureTest {
+class ControlLoopMetricsFeatureTest {
private static final String POLICY_CL_MGT = "POLICY-CL-MGT";
private static final Path configPath = SystemPersistenceConstants.getManager().getConfigurationPath();
@@ -66,39 +67,39 @@ public class ControlLoopMetricsFeatureTest {
/**
* Setup method.
*/
- @BeforeClass
+ @BeforeAll
public static void setUp() {
SystemPersistenceConstants.getManager().setConfigurationDir("src/test/resources");
testController = PolicyEngineConstants.getManager().createPolicyController("metrics",
SystemPersistenceConstants.getManager().getControllerProperties("metrics"));
}
- @AfterClass
+ @AfterAll
public static void tearDown() {
SystemPersistenceConstants.getManager().setConfigurationDir(configPath.toString());
resetStats();
}
- @Before
+ @BeforeEach
public void beforeTest() {
resetStats();
}
@Test
- public void testCacheDefaults() {
+ void testCacheDefaults() {
assertEquals(3, ControlLoopMetricsManager.getManager().getCacheSize());
assertEquals(2, ControlLoopMetricsManager.getManager().getTransactionTimeout());
assertEquals(0, ControlLoopMetricsManager.getManager().getCacheOccupancy());
}
@Test
- public void testInvalidNotifications() {
- ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification();
+ void testInvalidNotifications() {
+ var feature = new ControlLoopMetricsFeature();
+ var notification = new VirtualControlLoopNotification();
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
this.testCacheDefaults();
- UUID requestId = UUID.randomUUID();
+ var requestId = UUID.randomUUID();
notification.setRequestId(requestId);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
@@ -107,10 +108,10 @@ public class ControlLoopMetricsFeatureTest {
}
@Test
- public void testValidActiveNotification() {
- ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification();
- UUID requestId = UUID.randomUUID();
+ void testValidActiveNotification() {
+ var feature = new ControlLoopMetricsFeature();
+ var notification = new VirtualControlLoopNotification();
+ var requestId = UUID.randomUUID();
notification.setRequestId(requestId);
notification.setNotification(ControlLoopNotificationType.ACTIVE);
@@ -129,8 +130,8 @@ public class ControlLoopMetricsFeatureTest {
}
@Test
- public void testReset() {
- VirtualControlLoopNotification notification = this.generateNotification();
+ void testReset() {
+ var notification = this.generateNotification();
new ControlLoopMetricsFeature().beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT,
notification);
@@ -143,8 +144,8 @@ public class ControlLoopMetricsFeatureTest {
}
@Test
- public void testRemoveTransaction() {
- VirtualControlLoopNotification notification = this.generateNotification();
+ void testRemoveTransaction() {
+ var notification = this.generateNotification();
assertNull(ControlLoopMetricsManager.getManager().getTransaction(notification.getRequestId()));
ControlLoopMetricsManager.getManager().removeTransaction(notification.getRequestId());
@@ -155,10 +156,10 @@ public class ControlLoopMetricsFeatureTest {
}
@Test
- public void testEviction() {
- ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
+ void testEviction() {
+ var feature = new ControlLoopMetricsFeature();
for (int i = 0; i < ControlLoopMetricsManager.getManager().getCacheSize(); i++) {
- VirtualControlLoopNotification notification = generateNotification();
+ var notification = generateNotification();
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification);
assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(notification.getRequestId()));
}
@@ -166,7 +167,7 @@ public class ControlLoopMetricsFeatureTest {
assertEquals(ControlLoopMetricsManager.getManager().getCacheOccupancy(),
ControlLoopMetricsManager.getManager().getCacheOccupancy());
- VirtualControlLoopNotification overflowNotification = generateNotification();
+ var overflowNotification = generateNotification();
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, overflowNotification);
assertEquals(ControlLoopMetricsManager.getManager().getCacheOccupancy(),
ControlLoopMetricsManager.getManager().getCacheOccupancy());
@@ -194,57 +195,57 @@ public class ControlLoopMetricsFeatureTest {
}
private VirtualControlLoopNotification generateNotification() {
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification();
- UUID requestId = UUID.randomUUID();
+ var notification = new VirtualControlLoopNotification();
+ var requestId = UUID.randomUUID();
notification.setRequestId(requestId);
notification.setNotification(ControlLoopNotificationType.ACTIVE);
return notification;
}
@Test
- public void getSequenceNumber() {
- ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
+ void getSequenceNumber() {
+ var feature = new ControlLoopMetricsFeature();
assertEquals(ControlLoopMetricsFeature.FEATURE_SEQUENCE_PRIORITY, feature.getSequenceNumber());
}
@Test
- public void testSuccessControlLoop() {
- ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
+ void testSuccessControlLoop() {
+ var feature = new ControlLoopMetricsFeature();
- String activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
- VirtualControlLoopNotification active =
+ var activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
+ var active =
Serialization.gsonPretty.fromJson(activeNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, active);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
- String opStartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json");
- VirtualControlLoopNotification opStart =
+ var opStartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json");
+ var opStart =
Serialization.gsonPretty.fromJson(opStartNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, opStart);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
- String permitNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-permit.json");
- VirtualControlLoopNotification permit =
+ var permitNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-permit.json");
+ var permit =
Serialization.gsonPretty.fromJson(permitNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, permit);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
- String restartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-restart.json");
- VirtualControlLoopNotification restart =
+ var restartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-restart.json");
+ var restart =
Serialization.gsonPretty.fromJson(restartNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, restart);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
- String restartSuccessNotification =
+ var restartSuccessNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-restart-success.json");
- VirtualControlLoopNotification restartSuccess =
+ var restartSuccess =
Serialization.gsonPretty.fromJson(restartSuccessNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, restartSuccess);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
- String finalSuccessNotification =
+ var finalSuccessNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-final-success.json");
- VirtualControlLoopNotification finalSuccess =
+ var finalSuccess =
Serialization.gsonPretty.fromJson(finalSuccessNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, finalSuccess);
assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size());
@@ -264,20 +265,20 @@ public class ControlLoopMetricsFeatureTest {
}
@Test
- public void testUntrackedNotifications() throws InterruptedException {
- ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
+ void testUntrackedNotifications() throws InterruptedException {
+ var feature = new ControlLoopMetricsFeature();
- String finalSuccessNotification =
+ var finalSuccessNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-final-success.json");
- VirtualControlLoopNotification finalSuccess =
+ var finalSuccess =
Serialization.gsonPretty.fromJson(finalSuccessNotification, VirtualControlLoopNotification.class);
finalSuccess.setRequestId(UUID.randomUUID());
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, finalSuccess);
assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size());
- String opStartNotification =
+ var opStartNotification =
ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json");
- VirtualControlLoopNotification opStart =
+ var opStart =
Serialization.gsonPretty.fromJson(opStartNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, opStart);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
@@ -285,5 +286,4 @@ public class ControlLoopMetricsFeatureTest {
Thread.sleep((ControlLoopMetricsManager.getManager().getTransactionTimeout() + 1) * 1000L); // NOSONAR
assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size());
}
-
}
diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java
index 02842da65..39adb8120 100644
--- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java
+++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,24 +21,23 @@
package org.onap.policy.drools.server.restful;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import jakarta.ws.rs.client.Entity;
+import jakarta.ws.rs.core.Response;
import java.util.Collections;
import java.util.List;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Response;
import org.jetbrains.annotations.NotNull;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
-import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -49,12 +49,12 @@ import org.onap.policy.drools.persistence.SystemPersistenceConstants;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyEngineConstants;
-public class RestTransactionTrackerTest {
+class RestTransactionTrackerTest {
private static PolicyController testController;
private static HttpClient client;
- @BeforeClass
+ @BeforeAll
public static void testBeforeClass() throws Exception {
SystemPersistenceConstants.getManager().setConfigurationDir("target/test-classes");
@@ -70,7 +70,7 @@ public class RestTransactionTrackerTest {
.managed(true)
.build());
- HttpServletServer server =
+ var server =
HttpServletServerFactoryInstance
.getServerFactory()
.build("trans", "localhost", 8769, "/", true, true);
@@ -84,7 +84,7 @@ public class RestTransactionTrackerTest {
client = HttpClientFactoryInstance.getClientFactory().get("trans");
}
- @AfterClass
+ @AfterAll
public static void testAfterClass() {
HttpClientFactoryInstance.getClientFactory().destroy();
HttpServletServerFactoryInstance.getServerFactory().destroy();
@@ -93,7 +93,7 @@ public class RestTransactionTrackerTest {
}
@Test
- public void testConfiguration() {
+ void testConfiguration() {
equals(get("cacheSize", Response.Status.OK.getStatusCode()), Integer.class, 3);
equals(get("timeout", Response.Status.OK.getStatusCode()), Integer.class, 2);
@@ -111,7 +111,7 @@ public class RestTransactionTrackerTest {
}
@Test
- public void testTransactions() {
+ void testTransactions() {
equals(get("/inprogress", Response.Status.OK.getStatusCode()), List.class, Collections.emptyList());
ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
@@ -120,8 +120,8 @@ public class RestTransactionTrackerTest {
List.class).isEmpty());
get("/inprogress/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.NOT_FOUND.getStatusCode());
- String activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
- VirtualControlLoopNotification active =
+ var activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json");
+ var active =
Serialization.gsonPretty.fromJson(activeNotification, VirtualControlLoopNotification.class);
feature.beforeDeliver(testController, Topic.CommInfrastructure.DMAAP, "POLICY-CL-MGT", active);
assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size());
@@ -133,12 +133,12 @@ public class RestTransactionTrackerTest {
}
private Response get(String contextPath, int statusCode) {
- Response response = client.get(contextPath);
+ var response = client.get(contextPath);
return checkResponse(statusCode, response);
}
private Response put(String contextPath, String body, int statusCode) {
- Response response = client.put(contextPath, Entity.json(body), Collections.emptyMap());
+ var response = client.put(contextPath, Entity.json(body), Collections.emptyMap());
return checkResponse(statusCode, response);
}