Search in sources :

Example 6 with BalancerRunner

use of org.mobicents.tools.sip.balancer.BalancerRunner in project load-balancer by RestComm.

the class HttpsBalancerWithHttpsServerTest method initialization.

@BeforeClass
public static void initialization() {
    balancerRunner = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
    lbConfig.getHttpConfiguration().setHttpsPort(2081);
    lbConfig.getSslConfiguration().setKeyStore(HttpsBalancerWithHttpsServerTest.class.getClassLoader().getResource("keystore").getFile());
    lbConfig.getSslConfiguration().setKeyStorePassword("123456");
    lbConfig.getSslConfiguration().setTrustStore(HttpsBalancerWithHttpsServerTest.class.getClassLoader().getResource("keystore").getFile());
    lbConfig.getSslConfiguration().setTrustStorePassword("123456");
    balancerRunner.start(lbConfig);
    serverArray = new HttpServer[numberNodes];
    for (int i = 0; i < serverArray.length; i++) {
        serverArray[i] = new HttpServer(7080 + i, 4444 + i, 2222 + i);
        serverArray[i].start();
        Helper.sleep(1000);
    }
    Helper.sleep(5000);
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) BeforeClass(org.junit.BeforeClass)

Example 7 with BalancerRunner

use of org.mobicents.tools.sip.balancer.BalancerRunner in project load-balancer by RestComm.

the class InstanceIdAlgorithmTest method initialization.

@BeforeClass
public static void initialization() {
    balancerRunner = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
    balancerRunner.start(lbConfig);
    serverArray = new HttpServer[numberNodes];
    for (int i = 0; i < numberNodes; i++) {
        String id = null;
        if (i == 1)
            id = "ID1f2a2222772f4195948d040a2ccc648c";
        else
            id = "ID1f2a2222772f4195948d040a2ccc648" + i;
        serverArray[i] = new HttpServer(7080 + i, 4444 + i, id, 2222 + i);
        serverArray[i].start();
        Helper.sleep(1000);
    }
    Helper.sleep(5000);
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) BeforeClass(org.junit.BeforeClass)

Example 8 with BalancerRunner

use of org.mobicents.tools.sip.balancer.BalancerRunner in project load-balancer by RestComm.

the class UrlRewriteTest method initialization.

@BeforeClass
public static void initialization() {
    serverArray = new HttpServer[numberNodes];
    for (int i = 0; i < numberNodes; i++) {
        serverArray[i] = new HttpServer(8080 + i, 4444 + i, "ID1f2a2222772f4195948d040a2ccc648c", 2222);
        serverArray[i].start();
    }
    balancerRunner = new BalancerRunner();
    String pathToConfig = UrlRewriteTest.class.getClassLoader().getResource("lb-configuration.xml").getFile();
    balancerRunner.start(pathToConfig);
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) BeforeClass(org.junit.BeforeClass)

Example 9 with BalancerRunner

use of org.mobicents.tools.sip.balancer.BalancerRunner in project load-balancer by RestComm.

the class WithandWithoutInstanseIdTest method initialization.

@BeforeClass
public static void initialization() {
    serverArray = new HttpServer[numberNodes];
    for (int i = 0; i < numberNodes; i++) {
        serverArray[i] = new HttpServer(7080 + i, 4444 + i, instanceId, 2222);
        serverArray[i].start();
    }
    balancerRunner = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
    lbConfig.getSipConfiguration().getAlgorithmConfiguration().setAlgorithmClass(UserBasedAlgorithm.class.getName());
    lbConfig.getSipConfiguration().getAlgorithmConfiguration().setSipHeaderAffinityKey("From");
    balancerRunner.start(lbConfig);
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
Also used : BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) UserBasedAlgorithm(org.mobicents.tools.sip.balancer.UserBasedAlgorithm) BeforeClass(org.junit.BeforeClass)

Example 10 with BalancerRunner

use of org.mobicents.tools.sip.balancer.BalancerRunner in project load-balancer by RestComm.

the class HeaderConsistentHashAlgorithmTest method setUp.

@Before
public void setUp() throws Exception {
    shootist = new Shootist();
    balancer = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
    lbConfig.getSipConfiguration().getAlgorithmConfiguration().setAlgorithmClass(HeaderConsistentHashBalancerAlgorithm.class.getName());
    balancer.start(lbConfig);
    for (int q = 0; q < servers.length; q++) {
        servers[q] = new AppServer("node" + q, 4060 + q, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.UDP, 2222 + q);
        servers[q].start();
    }
    Thread.sleep(5000);
}
Also used : AppServer(org.mobicents.tools.sip.balancer.AppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) HeaderConsistentHashBalancerAlgorithm(org.mobicents.tools.sip.balancer.HeaderConsistentHashBalancerAlgorithm) Shootist(org.mobicents.tools.sip.balancer.operation.Shootist) ListeningPoint(javax.sip.ListeningPoint) Before(org.junit.Before)

Aggregations

BalancerRunner (org.mobicents.tools.sip.balancer.BalancerRunner)75 LoadBalancerConfiguration (org.mobicents.tools.configuration.LoadBalancerConfiguration)50 BeforeClass (org.junit.BeforeClass)34 ListeningPoint (javax.sip.ListeningPoint)30 Before (org.junit.Before)26 AppServer (org.mobicents.tools.sip.balancer.AppServer)26 Shootist (org.mobicents.tools.sip.balancer.operation.Shootist)25 SmppChannelException (com.cloudhopper.smpp.type.SmppChannelException)21 DefaultSmppServer (com.cloudhopper.smpp.impl.DefaultSmppServer)19 WorstCaseUdpTestAffinityAlgorithm (org.mobicents.tools.sip.balancer.WorstCaseUdpTestAffinityAlgorithm)8 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)6 UserBasedAlgorithm (org.mobicents.tools.sip.balancer.UserBasedAlgorithm)6 HeartbeatConfigHttp (org.mobicents.tools.heartbeat.impl.HeartbeatConfigHttp)5 HeaderConsistentHashBalancerAlgorithm (org.mobicents.tools.sip.balancer.HeaderConsistentHashBalancerAlgorithm)5 SinglePointTest (org.mobicents.tools.sip.balancer.SinglePointTest)4 SipException (javax.sip.SipException)3 HeartbeatConfig (org.mobicents.tools.heartbeat.api.HeartbeatConfig)2 HeartbeatConfigRmi (org.mobicents.tools.heartbeat.rmi.HeartbeatConfigRmi)2 ActiveStandbyAlgorithm (org.mobicents.tools.sip.balancer.ActiveStandbyAlgorithm)2