use of com.netflix.loadbalancer.Server in project ribbon by Netflix.
the class MyLoadBalancerContext method testEncodedPath.
@Test
public void testEncodedPath() throws Exception {
String uri = "http://localhost:8080/resources/abc%2Fxyz";
URI request = new URI(uri);
Server server = context.getServerFromLoadBalancer(request, null);
URI newURI = context.reconstructURIWithServer(server, request);
assertEquals(uri, newURI.toString());
}
use of com.netflix.loadbalancer.Server in project ribbon by Netflix.
the class MyLoadBalancerContext method testPreservesUserInfo.
@Test
public void testPreservesUserInfo() throws Exception {
// %3A == ":" -- ensure user info is not decoded
String uri = "http://us%3Aer:pass@localhost:8080?foo=bar";
URI requestedURI = new URI(uri);
Server server = context.getServerFromLoadBalancer(requestedURI, null);
URI newURI = context.reconstructURIWithServer(server, requestedURI);
assertEquals(uri, newURI.toString());
}
use of com.netflix.loadbalancer.Server in project ribbon by Netflix.
the class MyLoadBalancerContext method testEncodedPathAndHostChange.
@Test
public void testEncodedPathAndHostChange() throws Exception {
String uri = "/abc%2Fxyz";
URI request = new URI(uri);
Server server = context.getServerFromLoadBalancer(request, null);
URI newURI = context.reconstructURIWithServer(server, request);
assertEquals("http://www.example.com:8080" + uri, newURI.toString());
}
use of com.netflix.loadbalancer.Server in project ribbon by Netflix.
the class ServerListLoabBalancerTest method init.
@BeforeClass
public static void init() {
Configuration config = ConfigurationManager.getConfigInstance();
config.setProperty("ServerListLoabBalancerTest.ribbon.NFLoadBalancerClassName", com.netflix.loadbalancer.DynamicServerListLoadBalancer.class.getName());
config.setProperty("ServerListLoabBalancerTest.ribbon.NIWSServerListClassName", FixedServerList.class.getName());
lb = (DynamicServerListLoadBalancer<Server>) ClientFactory.getNamedLoadBalancer("ServerListLoabBalancerTest");
}
use of com.netflix.loadbalancer.Server in project ribbon by Netflix.
the class PrimeConnectionsTest method testPrimeConnectionsSmallPool.
@Test
public void testPrimeConnectionsSmallPool() throws Exception {
Configuration config = ConfigurationManager.getConfigInstance();
config.setProperty("PrimeConnectionsTest1.ribbon.NFLoadBalancerClassName", com.netflix.loadbalancer.DynamicServerListLoadBalancer.class.getName());
config.setProperty("PrimeConnectionsTest1.ribbon.NIWSServerListClassName", SmallFixedServerList.class.getName());
config.setProperty("PrimeConnectionsTest1.ribbon.EnablePrimeConnections", "true");
DynamicServerListLoadBalancer<Server> lb = (DynamicServerListLoadBalancer<Server>) ClientFactory.getNamedLoadBalancer("PrimeConnectionsTest1");
PrimeConnectionEndStats stats = lb.getPrimeConnections().getEndStats();
assertEquals(stats.success, SMALL_FIXED_SERVER_LIST_SIZE);
}
Aggregations