Merge branch 'master' into 2.0.x
This commit is contained in:
@@ -1194,7 +1194,7 @@ class FooController {
|
||||
|
||||
private FooClient adminClient;
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
public FooController(
|
||||
Decoder decoder, Encoder encoder, Client client) {
|
||||
this.fooClient = Feign.builder().client(client)
|
||||
@@ -1227,7 +1227,7 @@ To disable Hystrix support on a per-client basis create a vanilla `Feign.Builder
|
||||
----
|
||||
@Configuration
|
||||
public class FooConfiguration {
|
||||
@Bean
|
||||
@Bean
|
||||
@Scope("prototype")
|
||||
public Feign.Builder feignBuilder() {
|
||||
return Feign.builder();
|
||||
|
||||
@@ -49,6 +49,7 @@ import com.netflix.eureka.util.StatusInfo;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
* @author Gang Li
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${eureka.dashboard.path:/}")
|
||||
@@ -287,12 +288,12 @@ public class EurekaController {
|
||||
|
||||
private String scrubBasicAuth(String urlList){
|
||||
String[] urls=urlList.split(",");
|
||||
String filteredUrls="";
|
||||
StringBuilder filteredUrls = new StringBuilder();
|
||||
for(String u : urls){
|
||||
if(u.contains("@")){
|
||||
filteredUrls+=u.substring(0,u.indexOf("//")+2)+u.substring(u.indexOf("@")+1,u.length())+",";
|
||||
filteredUrls.append(u.substring(0,u.indexOf("//")+2)).append(u.substring(u.indexOf("@")+1,u.length())).append(",");
|
||||
}else{
|
||||
filteredUrls+=u+",";
|
||||
filteredUrls.append(u).append(",");
|
||||
}
|
||||
}
|
||||
return filteredUrls.substring(0,filteredUrls.length()-1);
|
||||
|
||||
@@ -23,6 +23,15 @@ public class EurekaControllerReplicasTests {
|
||||
String authList1 = "http://user:pwd@test1.com";
|
||||
String authList2 = authList1 + ",http://user2:pwd2@test2.com";
|
||||
|
||||
String combinationAuthList1 = "http://test1.com,http://user2:pwd2@test2.com";
|
||||
String combinationAuthList2 = "http://test3.com,http://user4:pwd4@test4.com";
|
||||
|
||||
String combinationNoAuthList1 = "http://test1.com,http://test2.com";
|
||||
String combinationNoAuthList2 = "http://test3.com,http://test4.com";
|
||||
|
||||
String totalAutoList = combinationAuthList1 + "," + combinationAuthList2;
|
||||
String totalNoAutoList = combinationNoAuthList1 + "," + combinationNoAuthList2;
|
||||
|
||||
String empty = new String();
|
||||
|
||||
private ApplicationInfoManager original;
|
||||
@@ -81,4 +90,24 @@ public class EurekaControllerReplicasTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterReplicasAuthWithCombinationList() throws Exception {
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
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);
|
||||
|
||||
controller.filterReplicas(model, statusInfo);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> results = (Map<String, String>) model.get("applicationStats");
|
||||
assertEquals(totalNoAutoList, results.get("registered-replicas"));
|
||||
assertEquals(combinationNoAuthList1, results.get("available-replicas"));
|
||||
assertEquals(combinationNoAuthList2, results.get("unavailable-replicas"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user