use of com.netflix.loadbalancer.Server in project java-chassis by ServiceComb.
the class TestServerListCache method testCreateEndpointTransportString.
@Test
public void testCreateEndpointTransportString() {
Server server = instance.createEndpoint(transport, new CacheEndpoint("stringAddress", null));
Assert.assertNotNull(server);
}
use of com.netflix.loadbalancer.Server in project java-chassis by ServiceComb.
the class TestLoadBalancer method testMarkServerDownException.
@Test
public void testMarkServerDownException() {
boolean status = true;
List<Server> newServers = new ArrayList<Server>();
Server server = Mockito.mock(Server.class);
newServers.add(server);
try {
loadBalancer.markServerDown(server);
} catch (Exception e) {
status = false;
Assert.assertEquals("Not implemented.", e.getMessage());
}
Assert.assertFalse(status);
}
use of com.netflix.loadbalancer.Server in project java-chassis by ServiceComb.
the class TestLoadBalancer method testAddServerException.
@Test
public void testAddServerException() {
boolean status = true;
List<Server> newServers = new ArrayList<Server>();
Server server = Mockito.mock(Server.class);
newServers.add(server);
try {
loadBalancer.addServers(newServers);
} catch (Exception e) {
status = false;
Assert.assertEquals("Not implemented.", e.getMessage());
}
Assert.assertFalse(status);
}
use of com.netflix.loadbalancer.Server in project java-chassis by ServiceComb.
the class TestLoadBalancer method testServerListException.
@Test
public void testServerListException() {
boolean status = true;
List<Server> newServers = new ArrayList<Server>();
Server server = Mockito.mock(Server.class);
newServers.add(server);
try {
loadBalancer.getServerList(ServerGroup.ALL);
} catch (Exception e) {
status = false;
Assert.assertEquals("Not implemented.", e.getMessage());
}
Assert.assertFalse(status);
}
use of com.netflix.loadbalancer.Server in project java-chassis by ServiceComb.
the class TestSessionSticknessRule method testServerWithoutTimeoutException.
@Test
public void testServerWithoutTimeoutException() {
boolean status = true;
SessionStickinessRule ss = new SessionStickinessRule();
Object key = new Object();
Server s = new Server("test");
Deencapsulation.setField(ss, "lastServer", s);
new MockUp<SessionStickinessRule>() {
@Mock
private boolean isTimeOut() {
return false;
}
};
try {
ss.choose(key);
} catch (Exception e) {
status = false;
}
Assert.assertFalse(status);
}
Aggregations