From dd7e58347bcc818a22c8c606597fefd1c980d0f4 Mon Sep 17 00:00:00 2001
From: Oleksandr Zhevedenko <720803+Net-burst@users.noreply.github.com>
Date: Thu, 2 May 2024 10:23:49 -0400
Subject: [PATCH] Housekeeping: Remove PG leftovers (#3112)
---
docs/config-app.md | 5 --
pom.xml | 31 +++--------
.../prebid/server/health/HealthMonitor.java | 38 -------------
.../spring/config/AopConfiguration.java | 52 ------------------
src/main/resources/application.yaml | 5 --
.../server/health/HealthMonitorTest.java | 54 -------------------
.../org/prebid/server/it/IntegrationTest.java | 3 --
.../server/it/test-application.properties | 1 -
8 files changed, 7 insertions(+), 182 deletions(-)
delete mode 100644 src/main/java/org/prebid/server/health/HealthMonitor.java
delete mode 100644 src/main/java/org/prebid/server/spring/config/AopConfiguration.java
delete mode 100644 src/test/java/org/prebid/server/health/HealthMonitorTest.java
diff --git a/docs/config-app.md b/docs/config-app.md
index a2f3b7a891b..c27b8980f3e 100644
--- a/docs/config-app.md
+++ b/docs/config-app.md
@@ -204,11 +204,6 @@ Also, each bidder could have its own bidder-specific options.
- `admin-endpoints.tracelog.on-application-port` - when equals to `false` endpoint will be bound to `admin.port`.
- `admin-endpoints.tracelog.protected` - when equals to `true` endpoint will be protected by basic authentication configured in `admin-endpoints.credentials`
-- `admin-endpoints.e2eadmin.enabled` - if equals to `true` the endpoint will be available.
-- `admin-endpoints.e2eadmin.path` - the server context path where the endpoint will be accessible.
-- `admin-endpoints.e2eadmin.on-application-port` - when equals to `false` endpoint will be bound to `admin.port`.
-- `admin-endpoints.e2eadmin.protected` - when equals to `true` endpoint will be protected by basic authentication configured in `admin-endpoints.credentials`
-
- `admin-endpoints.collected-metrics.enabled` - if equals to `true` the endpoint will be available.
- `admin-endpoints.collected-metrics.path` - the server context path where the endpoint will be accessible.
- `admin-endpoints.collected-metrics.on-application-port` - when equals to `false` endpoint will be bound to `admin.port`.
diff --git a/pom.xml b/pom.xml
index 5edefec9fc8..2496ff6a6bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,6 @@
4.11.0
3.24.2
2.35.1
- 4.2.0
9.4.53.v20231009
5.4.0
2.2.220
@@ -66,7 +65,6 @@
4.0.15
1.17.4
5.14.0
- 1.9.9.1
1.12.14
@@ -127,10 +125,6 @@
org.springframework.boot
spring-boot-starter
-
- org.springframework.boot
- spring-boot-starter-aop
-
jakarta.annotation
jakarta.annotation-api
@@ -409,12 +403,6 @@
${assertj.version}
test
-
- org.awaitility
- awaitility
- ${awaitility.version}
- test
-
org.springframework.boot
spring-boot-starter-test
@@ -619,6 +607,7 @@
false
${skipUnitTests}
+ ${surefire.jacoco.args}
@@ -788,18 +777,22 @@
com/iab/openrtb/**
**/proto/**
**/model/**
+ **/functional/**
org/prebid/server/spring/config/**
- prepare-agent
+ before-unit-test-execution
prepare-agent
+
+ surefire.jacoco.args
+
- report
+ after-unit-test-execution
report
@@ -914,9 +907,6 @@
org.apache.maven.plugins
maven-failsafe-plugin
-
- -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-
${mockserver.version}
${project.version}
@@ -953,13 +943,6 @@
-
-
- org.aspectj
- aspectjweaver
- ${aspectj.version}
-
-
org.apache.maven.plugins
diff --git a/src/main/java/org/prebid/server/health/HealthMonitor.java b/src/main/java/org/prebid/server/health/HealthMonitor.java
deleted file mode 100644
index 3fc8a53ed2a..00000000000
--- a/src/main/java/org/prebid/server/health/HealthMonitor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.prebid.server.health;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.concurrent.atomic.LongAdder;
-
-/**
- * Used to gather statistics and calculate the health index indicator.
- */
-public class HealthMonitor {
-
- private final LongAdder totalCounter = new LongAdder();
-
- private final LongAdder successCounter = new LongAdder();
-
- /**
- * Increments total number of requests.
- */
- public void incTotal() {
- totalCounter.increment();
- }
-
- /**
- * Increments succeeded number of requests.
- */
- public void incSuccess() {
- successCounter.increment();
- }
-
- /**
- * Returns value between 0.0 ... 1.0 where 1.0 is indicated 100% healthy.
- */
- public BigDecimal calculateHealthIndex() {
- final BigDecimal success = BigDecimal.valueOf(successCounter.sumThenReset());
- final BigDecimal total = BigDecimal.valueOf(totalCounter.sumThenReset());
- return total.longValue() == 0 ? BigDecimal.ONE : success.divide(total, 2, RoundingMode.HALF_EVEN);
- }
-}
diff --git a/src/main/java/org/prebid/server/spring/config/AopConfiguration.java b/src/main/java/org/prebid/server/spring/config/AopConfiguration.java
deleted file mode 100644
index 736ca55a494..00000000000
--- a/src/main/java/org/prebid/server/spring/config/AopConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.prebid.server.spring.config;
-
-import io.vertx.core.Future;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.prebid.server.health.HealthMonitor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.stereotype.Component;
-
-@Configuration
-public class AopConfiguration {
-
- @Bean
- HealthMonitor healthMonitor() {
- return new HealthMonitor();
- }
-
- @Aspect
- @Component
- static class HealthMonitorAspect {
-
- @Autowired
- HealthMonitor healthMonitor;
-
- @Around(value = "execution(* org.prebid.server.vertx.httpclient.HttpClient.*(..)) "
- + "|| execution(* org.prebid.server.settings.ApplicationSettings.*(..)) "
- + "|| execution(* org.prebid.server.geolocation.GeoLocationService.*(..))")
- public Future> around(ProceedingJoinPoint joinPoint) {
- try {
- return ((Future>) joinPoint.proceed())
- .map(this::handleSucceedRequest)
- .recover(this::handleFailRequest);
- } catch (Throwable e) {
- throw new IllegalStateException("Error while processing health monitoring", e);
- }
- }
-
- private Future handleFailRequest(Throwable throwable) {
- healthMonitor.incTotal();
- return Future.failedFuture(throwable);
- }
-
- private T handleSucceedRequest(T result) {
- healthMonitor.incTotal();
- healthMonitor.incSuccess();
- return result;
- }
- }
-}
diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml
index 94a483a7797..b899795f418 100644
--- a/src/main/resources/application.yaml
+++ b/src/main/resources/application.yaml
@@ -67,11 +67,6 @@ admin-endpoints:
path: /pbs-admin/tracelog
on-application-port: false
protected: true
- e2eadmin:
- enabled: false
- path: /pbs-admin/e2eAdmin/*
- on-application-port: false
- protected: true
collected-metrics:
enabled: false
path: /collected-metrics
diff --git a/src/test/java/org/prebid/server/health/HealthMonitorTest.java b/src/test/java/org/prebid/server/health/HealthMonitorTest.java
deleted file mode 100644
index adf8f6fbe66..00000000000
--- a/src/test/java/org/prebid/server/health/HealthMonitorTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.prebid.server.health;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.math.BigDecimal;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class HealthMonitorTest {
-
- private HealthMonitor healthMonitor;
-
- @Before
- public void setUp() {
- healthMonitor = new HealthMonitor();
- }
-
- @Test
- public void calculateHealthIndexShouldReturnFullHealthIfNoRequestsSubmitted() {
- // when
- final BigDecimal result = healthMonitor.calculateHealthIndex();
-
- // then
- assertThat(result).isEqualTo(BigDecimal.ONE);
- }
-
- @Test
- public void calculateHealthIndexShouldReturnExpectedResult() {
- // when
- healthMonitor.incTotal();
- healthMonitor.incTotal();
- healthMonitor.incTotal();
- healthMonitor.incSuccess();
-
- final BigDecimal result = healthMonitor.calculateHealthIndex();
-
- // then
- assertThat(result).isEqualTo(new BigDecimal("0.33"));
- }
-
- @Test
- public void calculateHealthIndexShouldResetResult() {
- // when
- healthMonitor.incTotal();
- healthMonitor.incSuccess();
- healthMonitor.calculateHealthIndex();
-
- final BigDecimal result = healthMonitor.calculateHealthIndex();
-
- // then
- assertThat(result).isEqualTo(BigDecimal.ONE);
- }
-}
diff --git a/src/test/java/org/prebid/server/it/IntegrationTest.java b/src/test/java/org/prebid/server/it/IntegrationTest.java
index 119537ba161..aa519ea5a30 100644
--- a/src/test/java/org/prebid/server/it/IntegrationTest.java
+++ b/src/test/java/org/prebid/server/it/IntegrationTest.java
@@ -73,8 +73,6 @@ public abstract class IntegrationTest extends VertxTest {
private static final String HOST_AND_PORT = "localhost:" + WIREMOCK_PORT;
private static final String CACHE_PATH = "/cache";
private static final String CACHE_ENDPOINT = "http://" + HOST_AND_PORT + CACHE_PATH;
- private static final String USER_SERVICE_PATH = "/user-data-details";
- private static final String USER_SERVICE_ENDPOINT = "http://" + HOST_AND_PORT + USER_SERVICE_PATH;
@BeforeClass
public static void setUp() throws IOException {
@@ -252,7 +250,6 @@ private static String replaceStaticInfo(String json) {
.replaceAll("\\{\\{ cache.resource_url }}", CACHE_ENDPOINT + "?uuid=")
.replaceAll("\\{\\{ cache.host }}", HOST_AND_PORT)
.replaceAll("\\{\\{ cache.path }}", CACHE_PATH)
- .replaceAll("\\{\\{ userservice_uri }}", USER_SERVICE_ENDPOINT)
.replaceAll("\\{\\{ event.url }}", "http://localhost:8080/event?");
}
diff --git a/src/test/resources/org/prebid/server/it/test-application.properties b/src/test/resources/org/prebid/server/it/test-application.properties
index 29114f9d3fb..28f6c7fc5b3 100644
--- a/src/test/resources/org/prebid/server/it/test-application.properties
+++ b/src/test/resources/org/prebid/server/it/test-application.properties
@@ -504,7 +504,6 @@ admin-endpoints.logging-changelevel.enabled=true
admin-endpoints.logging-changelevel.protected=false
admin-endpoints.tracelog.enabled=true
admin-endpoints.tracelog.protected=false
-admin-endpoints.e2eadmin.enabled=false
status-response=ok
analytics.log.enabled=true
gdpr.host-vendor-id=1