forked from Netflix/ribbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements from PR Netflix#371 review
Also: * As had to change the mocking of DiscoveryClient and InstanceInfo in some tests, refactored out that mock code into 2 static methods on LoadBalancerTestUtils. * Upgraded eureka-client dependency version from 1.4.6 to 1.7.2 to get the EurekaClient.getEurekaClientConfig() interface.
- Loading branch information
Showing
10 changed files
with
72 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
ribbon-eureka/src/test/java/com/netflix/niws/loadbalancer/LoadBalancerTestUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.netflix.niws.loadbalancer; | ||
|
||
import com.netflix.appinfo.DataCenterInfo; | ||
import com.netflix.appinfo.InstanceInfo; | ||
import com.netflix.appinfo.MyDataCenterInfo; | ||
import com.netflix.discovery.DefaultEurekaClientConfig; | ||
import com.netflix.discovery.DiscoveryClient; | ||
import com.netflix.discovery.DiscoveryManager; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.easymock.EasyMock.expect; | ||
import static org.powermock.api.easymock.PowerMock.createMock; | ||
|
||
public class LoadBalancerTestUtils | ||
{ | ||
static List<InstanceInfo> getDummyInstanceInfo(String appName, String host, String ipAddr, int port){ | ||
List<InstanceInfo> list = new ArrayList<InstanceInfo>(); | ||
|
||
InstanceInfo info = InstanceInfo.Builder.newBuilder().setAppName(appName) | ||
.setHostName(host) | ||
.setIPAddr(ipAddr) | ||
.setPort(port) | ||
.setDataCenterInfo(new MyDataCenterInfo(DataCenterInfo.Name.MyOwn)) | ||
.build(); | ||
|
||
list.add(info); | ||
|
||
return list; | ||
} | ||
|
||
static DiscoveryClient mockDiscoveryClient() | ||
{ | ||
DiscoveryClient mockedDiscoveryClient = createMock(DiscoveryClient.class); | ||
expect(mockedDiscoveryClient.getEurekaClientConfig()).andReturn(new DefaultEurekaClientConfig()).anyTimes(); | ||
return mockedDiscoveryClient; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters