From 0f43ba11e27460dba8b0f6e743c65a0ed30dd474 Mon Sep 17 00:00:00 2001 From: Tom Sisso Date: Wed, 25 Nov 2020 10:10:04 +0200 Subject: [PATCH 1/2] fix tests location --- .../api/facade/AsyncProfilerCommandsFactoryTest.java | 0 .../async_profiler/api/facade/AsyncProfilerFacadeTest.java | 0 .../com/taboola/async_profiler/api/facade/ProfileRequestTest.java | 0 .../api/facade/profiler/AsyncProfilerSupplierTest.java | 0 .../api/facade/profiler/EmptyAsyncProfilerTest.java | 0 .../taboola/async_profiler/spring/AsyncProfilerEndPointTest.java | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename src/{main => }/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerCommandsFactoryTest.java (100%) rename src/{main => }/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerFacadeTest.java (100%) rename src/{main => }/test/java/com/taboola/async_profiler/api/facade/ProfileRequestTest.java (100%) rename src/{main => }/test/java/com/taboola/async_profiler/api/facade/profiler/AsyncProfilerSupplierTest.java (100%) rename src/{main => }/test/java/com/taboola/async_profiler/api/facade/profiler/EmptyAsyncProfilerTest.java (100%) rename src/{main => }/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java (100%) diff --git a/src/main/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerCommandsFactoryTest.java b/src/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerCommandsFactoryTest.java similarity index 100% rename from src/main/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerCommandsFactoryTest.java rename to src/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerCommandsFactoryTest.java diff --git a/src/main/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerFacadeTest.java b/src/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerFacadeTest.java similarity index 100% rename from src/main/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerFacadeTest.java rename to src/test/java/com/taboola/async_profiler/api/facade/AsyncProfilerFacadeTest.java diff --git a/src/main/test/java/com/taboola/async_profiler/api/facade/ProfileRequestTest.java b/src/test/java/com/taboola/async_profiler/api/facade/ProfileRequestTest.java similarity index 100% rename from src/main/test/java/com/taboola/async_profiler/api/facade/ProfileRequestTest.java rename to src/test/java/com/taboola/async_profiler/api/facade/ProfileRequestTest.java diff --git a/src/main/test/java/com/taboola/async_profiler/api/facade/profiler/AsyncProfilerSupplierTest.java b/src/test/java/com/taboola/async_profiler/api/facade/profiler/AsyncProfilerSupplierTest.java similarity index 100% rename from src/main/test/java/com/taboola/async_profiler/api/facade/profiler/AsyncProfilerSupplierTest.java rename to src/test/java/com/taboola/async_profiler/api/facade/profiler/AsyncProfilerSupplierTest.java diff --git a/src/main/test/java/com/taboola/async_profiler/api/facade/profiler/EmptyAsyncProfilerTest.java b/src/test/java/com/taboola/async_profiler/api/facade/profiler/EmptyAsyncProfilerTest.java similarity index 100% rename from src/main/test/java/com/taboola/async_profiler/api/facade/profiler/EmptyAsyncProfilerTest.java rename to src/test/java/com/taboola/async_profiler/api/facade/profiler/EmptyAsyncProfilerTest.java diff --git a/src/main/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java b/src/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java similarity index 100% rename from src/main/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java rename to src/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java From b9e9db2f4a3beb5a4adc9a913c59bcfefd4abe25 Mon Sep 17 00:00:00 2001 From: Tom Sisso Date: Wed, 25 Nov 2020 10:13:30 +0200 Subject: [PATCH 2/2] control isSensitive via property --- .../async_profiler/spring/AsyncProfilerEndPoint.java | 6 ++++-- .../spring/AsyncProfilerEndpointConfig.java | 5 +++-- .../async_profiler/spring/AsyncProfilerEndPointTest.java | 9 ++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndPoint.java b/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndPoint.java index 431cc2e..d520301 100644 --- a/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndPoint.java +++ b/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndPoint.java @@ -14,9 +14,11 @@ public class AsyncProfilerEndPoint implements MvcEndpoint { private final AsyncProfilerFacade asyncProfilerFacade; + private final boolean isSensitive; - public AsyncProfilerEndPoint(AsyncProfilerFacade asyncProfilerFacade) { + public AsyncProfilerEndPoint(AsyncProfilerFacade asyncProfilerFacade, boolean isSensitive) { this.asyncProfilerFacade = asyncProfilerFacade; + this.isSensitive = isSensitive; } @Override @@ -26,7 +28,7 @@ public String getPath() { @Override public boolean isSensitive() { - return false; + return isSensitive; } @Override diff --git a/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndpointConfig.java b/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndpointConfig.java index 0ca4930..c0d63a6 100644 --- a/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndpointConfig.java +++ b/src/main/java/com/taboola/async_profiler/spring/AsyncProfilerEndpointConfig.java @@ -55,7 +55,8 @@ public AsyncProfilerFacade asyncProfilerFacade(AsyncProfilerSupplier asyncProfil } @Bean - public AsyncProfilerEndPoint asyncProfilerEndPoint(AsyncProfilerFacade asyncProfilerFacade) { - return new AsyncProfilerEndPoint(asyncProfilerFacade); + public AsyncProfilerEndPoint asyncProfilerEndPoint(AsyncProfilerFacade asyncProfilerFacade, + @Value("${com.taboola.asyncprofiler.endpoint.sensitive:false}") boolean isSensitive) { + return new AsyncProfilerEndPoint(asyncProfilerFacade, isSensitive); } } diff --git a/src/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java b/src/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java index a907781..3a055bc 100644 --- a/src/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java +++ b/src/test/java/com/taboola/async_profiler/spring/AsyncProfilerEndPointTest.java @@ -1,6 +1,8 @@ package com.taboola.async_profiler.spring; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.same; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -27,7 +29,7 @@ public class AsyncProfilerEndPointTest { @Before public void setup() { MockitoAnnotations.initMocks(this); - asyncProfilerEndPoint = new AsyncProfilerEndPoint(asyncProfilerFacade); + asyncProfilerEndPoint = new AsyncProfilerEndPoint(asyncProfilerFacade, false); } @Test @@ -59,4 +61,9 @@ public void testGetVersion() { assertEquals("1", asyncProfilerEndPoint.getVersion()); } + @Test + public void testIsSensitive() { + assertFalse(new AsyncProfilerEndPoint(asyncProfilerFacade, false).isSensitive()); + assertTrue(new AsyncProfilerEndPoint(asyncProfilerFacade, true).isSensitive()); + } } \ No newline at end of file