Examples of AGateway


Examples of org.smslib.AGateway

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.AGateway

  }
 
  @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.AGateway

  }
 
  @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.smsserver.gateways.AGateway

          String gtwClass = tokens.nextToken().trim();
          Object[] args = new Object[] { gtwId, getProperties(), this };
          Class<?>[] argsClass = new Class[] { String.class, Properties.class, SMSServer.class };
          Class<?> c = Class.forName((gtwClass.indexOf('.') == -1 ? "org.smslib.smsserver.gateways." : "") + gtwClass);
          Constructor<?> constructor = c.getConstructor(argsClass);
          AGateway gtw = (AGateway) constructor.newInstance(args);
          gtw.create();
          Service.getInstance().addGateway(gtw.getGateway());
          Logger.getInstance().logInfo("SMSServer: added gateway " + gtwId + " / " + gtw.getDescription(), null, null);
        }
        catch (Exception e)
        {
          Logger.getInstance().logError("SMSServer: Unknown Gateway in configuration file!", null, null);
        }
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.