use of org.apache.servicecomb.loadbalance.CseServer in project incubator-servicecomb-java-chassis by apache.
the class SimpleTransactionControlFilter method getFilteredListOfServers.
@Override
public List<Server> getFilteredListOfServers(List<Server> servers) {
List<Server> filteredServers = new ArrayList<>();
Map<String, String> filterOptions = Configuration.INSTANCE.getFlowsplitFilterOptions(getInvocation().getMicroserviceName());
for (Server server : servers) {
if (allowVisit((CseServer) server, filterOptions)) {
filteredServers.add(server);
}
}
return filteredServers;
}
use of org.apache.servicecomb.loadbalance.CseServer in project incubator-servicecomb-java-chassis by apache.
the class TestCseServerDiscoveryFilter method createEndpoint_TransportNotExist.
@Test
public void createEndpoint_TransportNotExist() {
new Expectations() {
{
transportManager.findTransport(anyString);
result = null;
}
};
CseServer server = (CseServer) filter.createEndpoint(Const.RESTFUL, null, null);
Assert.assertNull(server);
}
use of org.apache.servicecomb.loadbalance.CseServer in project incubator-servicecomb-java-chassis by apache.
the class TestCseServerDiscoveryFilter method createEndpointNormal.
@Test
public void createEndpointNormal() {
new Expectations() {
{
transportManager.findTransport(anyString);
result = trasport;
}
};
MicroserviceInstance instance = new MicroserviceInstance();
CseServer server = (CseServer) filter.createEndpoint(Const.RESTFUL, "rest://localhost:8080", instance);
Assert.assertSame(instance, server.getInstance());
Assert.assertSame(trasport, server.getEndpoint().getTransport());
Assert.assertEquals("rest://localhost:8080", server.getEndpoint().getEndpoint());
}
Aggregations