From 27ac3379f6b391ccd605d212512f15c439825ecb Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Wed, 13 Apr 2022 14:02:52 +0200 Subject: [PATCH] Remove deprecated constructor. --- .../eureka/server/EurekaController.java | 25 +++++-------------- .../server/EurekaControllerReplicasTests.java | 6 ++--- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaController.java b/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaController.java index 4b40e7eebf..9bde471b0a 100644 --- a/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaController.java +++ b/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaController.java @@ -60,15 +60,6 @@ public class EurekaController { private final EurekaProperties eurekaProperties; - /** - * @deprecated in favour of - * {@link EurekaController#EurekaController(ApplicationInfoManager, EurekaProperties)} - */ - @Deprecated - public EurekaController(ApplicationInfoManager applicationInfoManager) { - this(applicationInfoManager, null); - } - public EurekaController(ApplicationInfoManager applicationInfoManager, EurekaProperties eurekaProperties) { this.applicationInfoManager = applicationInfoManager; this.eurekaProperties = eurekaProperties; @@ -128,14 +119,8 @@ protected void populateBase(HttpServletRequest request, Map mode private void populateHeader(Map model) { model.put("currentTime", StatusResource.getCurrentTimeAsString()); model.put("upTime", StatusInfo.getUpTime()); - if (eurekaProperties != null) { - model.put("environment", eurekaProperties.getEnvironment()); - model.put("datacenter", eurekaProperties.getDatacenter()); - } - else { - model.put("environment", "N/A"); - model.put("datacenter", "N/A"); - } + model.put("environment", eurekaProperties.getEnvironment()); + model.put("datacenter", eurekaProperties.getDatacenter()); PeerAwareInstanceRegistry registry = getRegistry(); model.put("registry", registry); model.put("isBelowRenewThreshold", registry.isBelowRenewThresold() == 1); @@ -159,7 +144,8 @@ private EurekaServerContext getServerContext() { private void populateNavbar(HttpServletRequest request, Map model) { Map replicas = new LinkedHashMap<>(); - List list = getServerContext().getPeerEurekaNodes().getPeerNodesView(); + List list = getServerContext().getPeerEurekaNodes() + .getPeerNodesView(); for (PeerEurekaNode node : list) { try { URI uri = new URI(node.getServiceUrl()); @@ -295,7 +281,8 @@ private String scrubBasicAuth(String urlList) { StringBuilder filteredUrls = new StringBuilder(); for (String u : urls) { if (u.contains("@")) { - filteredUrls.append(u, 0, u.indexOf("//") + 2).append(u.substring(u.indexOf("@") + 1)).append(","); + filteredUrls.append(u, 0, u.indexOf("//") + 2) + .append(u.substring(u.indexOf("@") + 1)).append(","); } else { filteredUrls.append(u).append(","); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java index d697cd1385..f4e6044a1d 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java @@ -77,7 +77,7 @@ void testFilterReplicasNoAuth() throws Exception { StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", empty) .add("available-replicas", noAuthList1).add("unavailable-replicas", noAuthList2) .withInstanceInfo(this.instanceInfo).build(); - EurekaController controller = new EurekaController(null); + EurekaController controller = new EurekaController(null, new EurekaProperties()); controller.filterReplicas(model, statusInfo); @@ -95,7 +95,7 @@ void testFilterReplicasAuth() throws Exception { StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", authList2) .add("available-replicas", authList1).add("unavailable-replicas", empty).withInstanceInfo(instanceInfo) .build(); - EurekaController controller = new EurekaController(null); + EurekaController controller = new EurekaController(null, new EurekaProperties()); controller.filterReplicas(model, statusInfo); @@ -113,7 +113,7 @@ void testFilterReplicasAuthWithCombinationList() throws Exception { StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", totalAutoList) .add("available-replicas", combinationAuthList1).add("unavailable-replicas", combinationAuthList2) .withInstanceInfo(instanceInfo).build(); - EurekaController controller = new EurekaController(null); + EurekaController controller = new EurekaController(null, new EurekaProperties()); controller.filterReplicas(model, statusInfo);