Examples of GatewayMock


Examples of org.smslib.mocks.GatewayMock

public class DefaultRouterTest {

  @Test
  public void testNoRoute() throws TimeoutException, GatewayException, IOException, InterruptedException {
    List<AGateway> gateways=new ArrayList<AGateway>();
    AGateway gateway=new GatewayMock("G1");
    gateways.add(gateway);
    gateway=new GatewayMock("G2");
    gateways.add(gateway);
    gateway=new GatewayMock("G3");
    gateways.add(gateway);
   
    ARouter router=new DefaultRouter();
    OutboundMessage message=new OutboundMessage("77374847", "test");
   
    Collection<AGateway> candidates= router.route(message, gateways);
    Assert.assertEquals("No route expected. No started gateways and no outbound gateways.", 0, candidates.size());
   
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
    message.setGatewayId("G3");
   
    gateway=gateways.get(0);
    gateway.startGateway();
     
    candidates= router.route(message, gateways);
    Assert.assertEquals("No route expected. No outbound gateways started.", 0, candidates.size());
   
  }
View Full Code Here

Examples of org.smslib.mocks.GatewayMock

  }
 
  @Test
  public void testOneRoute() throws TimeoutException, GatewayException, IOException, InterruptedException {
    List<AGateway> gateways=new ArrayList<AGateway>();
    AGateway gateway=new GatewayMock("G1");
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
    gateway.startGateway();
   
    gateways.add(gateway);
   
    gateway=new GatewayMock("G2");
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
    gateway.startGateway();
   
    gateways.add(gateway);
   
    gateway=new GatewayMock("G3");
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
    gateway.startGateway();
   
    gateways.add(gateway);
   
    ARouter router=new DefaultRouter();
    OutboundMessage message=new OutboundMessage("77374847", "test");
View Full Code Here

Examples of org.smslib.mocks.GatewayMock

  }
 
  @Test
  public void testMultiRoute() throws TimeoutException, GatewayException, IOException, InterruptedException {
    List<AGateway> gateways=new ArrayList<AGateway>();
    AGateway gateway=new GatewayMock("G1");
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
    gateway.startGateway();
   
    gateways.add(gateway);
   
    gateway=new GatewayMock("G2");
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
    gateway.startGateway();
   
    gateways.add(gateway);
   
    gateway=new GatewayMock("G3");
    gateway.setAttributes(AGateway.GatewayAttributes.SEND);
    gateway.setOutbound(true);
   
    //this gateway is not started, therefore should not be returned by Router
    //gateway.startGateway();
   
    gateways.add(gateway);
View Full Code Here

Examples of org.smslib.mocks.GatewayMock

   */
  @Test
  public void testBalance() {
    List<AGateway> gateways=new ArrayList<AGateway>();
   
    gateways.add(new GatewayMock("G1"))
    gateways.add(new GatewayMock("G2"));
    gateways.add(new GatewayMock("G3"));
   
    RoundRobinLoadBalancer balancer = new RoundRobinLoadBalancer();
    OutboundMessage message=new OutboundMessage("77374847", "test");
   
    Assert.assertEquals("Wrong gateway returned by balancer. G1 was expected.", balancer.balance(message, gateways),gateways.get(0));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.