From 9ed5e9cb10cbdf49c9767956cdc305253d337711 Mon Sep 17 00:00:00 2001 From: Oleksandr Zhevedenko <720803+Net-burst@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:51:58 -0400 Subject: [PATCH 1/5] Remove PG leftovers --- docs/config-app.md | 5 -- pom.xml | 11 ---- .../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, 169 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 0ae973cf9f5..38b1d6a195b 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 abbd1a513e1..0465ec4c25a 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,6 @@ 3.0.14 1.17.4 5.14.0 - 1.9.9.1 1.12.14 @@ -905,9 +904,6 @@ org.apache.maven.plugins maven-failsafe-plugin - - -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" - ${mockserver.version} ${project.version} @@ -944,13 +940,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 b31305ace9f..f1eefe19492 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 From 5c176c9558930cf85c8645b8f87407e8e5a1e1f0 Mon Sep 17 00:00:00 2001 From: Oleksandr Zhevedenko <720803+Net-burst@users.noreply.github.com> Date: Thu, 11 Apr 2024 16:39:47 -0400 Subject: [PATCH 2/5] Remove AOP leftovers --- pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pom.xml b/pom.xml index 0465ec4c25a..431fbbbc199 100644 --- a/pom.xml +++ b/pom.xml @@ -129,10 +129,6 @@ org.springframework.boot spring-boot-starter - - org.springframework.boot - spring-boot-starter-aop - javax.annotation javax.annotation-api From ef1c2017b68e9321c558d5ecb050f49547a0f416 Mon Sep 17 00:00:00 2001 From: Oleksandr Zhevedenko <720803+Net-burst@users.noreply.github.com> Date: Thu, 11 Apr 2024 16:41:13 -0400 Subject: [PATCH 3/5] Remove Awaitility --- pom.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pom.xml b/pom.xml index 431fbbbc199..6e2b0390610 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,6 @@ 4.11.0 3.24.2 2.35.1 - 4.2.0 9.4.53.v20231009 4.4.0 2.2.220 @@ -424,12 +423,6 @@ ${assertj.version} test - - org.awaitility - awaitility - ${awaitility.version} - test - org.springframework.boot spring-boot-starter-test From f7506d0c156c5c64f8262c73c18295ee828f682f Mon Sep 17 00:00:00 2001 From: osulzhenko <125548596+osulzhenko@users.noreply.github.com> Date: Thu, 2 May 2024 15:13:35 +0300 Subject: [PATCH 4/5] Split jacoco for jUnit tests (#3116) --- pom.xml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index f88a9b24cb1..4f9386eb530 100644 --- a/pom.xml +++ b/pom.xml @@ -604,9 +604,10 @@ ${maven-surefire-plugin.version} - false + true ${skipUnitTests} + ${surefire.jacoco.args} @@ -776,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 @@ -905,7 +910,7 @@ ${mockserver.version} ${project.version} - 2 + 5 false From ca90e38f1a0f8ec6dcb7ed3bda63c86232372714 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Thu, 2 May 2024 15:25:46 +0300 Subject: [PATCH 5/5] Roll-back containers count and start data --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4f9386eb530..2496ff6a6bc 100644 --- a/pom.xml +++ b/pom.xml @@ -604,7 +604,7 @@ ${maven-surefire-plugin.version} - true + false ${skipUnitTests} ${surefire.jacoco.args} @@ -910,7 +910,7 @@ ${mockserver.version} ${project.version} - 5 + 2 false