|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
/*
|
|
|
|
|
* Tencent is pleased to support the open source community by making spring-cloud-tencent available.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
|
|
|
* Copyright (C) 2021 Tencent. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the BSD 3-Clause License (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
@ -144,8 +144,8 @@ public class PolarisLeastConnectionLoadBalancerTest {
|
|
|
|
|
when(routerAPI.processLoadBalance(any())).thenThrow(new PolarisException(ErrorCode.API_TIMEOUT));
|
|
|
|
|
|
|
|
|
|
// request construct and execute invoke
|
|
|
|
|
PolarisShortestResponseTimeLoadBalancer polarisShortestResponseTimeLoadBalancer = new PolarisShortestResponseTimeLoadBalancer(LOCAL_SERVICE, supplierObjectProvider, routerAPI);
|
|
|
|
|
Mono<Response<ServiceInstance>> responseMono = polarisShortestResponseTimeLoadBalancer.choose(request);
|
|
|
|
|
PolarisLeastConnectionLoadBalancer polarisLeastConnectionLoadBalancer = new PolarisLeastConnectionLoadBalancer(LOCAL_SERVICE, supplierObjectProvider, routerAPI);
|
|
|
|
|
Mono<Response<ServiceInstance>> responseMono = polarisLeastConnectionLoadBalancer.choose(request);
|
|
|
|
|
ServiceInstance serviceInstance = responseMono.block().getServer();
|
|
|
|
|
|
|
|
|
|
// verify method has invoked
|
|
|
|
@ -161,8 +161,8 @@ public class PolarisLeastConnectionLoadBalancerTest {
|
|
|
|
|
when(supplierObjectProvider.getIfAvailable(any())).thenReturn(noopSupplier);
|
|
|
|
|
|
|
|
|
|
// request construct and execute invoke
|
|
|
|
|
PolarisShortestResponseTimeLoadBalancer polarisShortestResponseTimeLoadBalancer = new PolarisShortestResponseTimeLoadBalancer(LOCAL_SERVICE, supplierObjectProvider, routerAPI);
|
|
|
|
|
Mono<Response<ServiceInstance>> responseMono = polarisShortestResponseTimeLoadBalancer.choose();
|
|
|
|
|
PolarisLeastConnectionLoadBalancer polarisLeastConnectionLoadBalancer = new PolarisLeastConnectionLoadBalancer(LOCAL_SERVICE, supplierObjectProvider, routerAPI);
|
|
|
|
|
Mono<Response<ServiceInstance>> responseMono = polarisLeastConnectionLoadBalancer.choose();
|
|
|
|
|
ServiceInstance serviceInstance = responseMono.block().getServer();
|
|
|
|
|
|
|
|
|
|
//result assert
|
|
|
|
|