Search in sources :

Example 1 with BalancerDispatcher

use of org.mobicents.tools.smpp.balancer.core.BalancerDispatcher in project load-balancer by RestComm.

the class SpliterTwoNicTest method testTransfer.

@Test
public void testTransfer() {
    int clientNumbers = 9;
    clientHandlerArray = new DefaultSmppClientHandler[clientNumbers];
    int sms = 99;
    Locker locker = new Locker(clientNumbers);
    ArrayList<Load> processors = new ArrayList<Load>(clientNumbers);
    for (int i = 0; i < clientNumbers; i++) processors.add(new Load(i, sms, locker));
    for (int i = 0; i < clientNumbers; i++) processors.get(i).start();
    locker.waitForClients();
    for (DefaultSmppServerHandler serverHandler : serverHandlerArray) assertEquals(sms, serverHandler.smsNumber);
    for (DefaultSmppServer server : serverArray) assertEquals(clientNumbers / serverNumbers, server.getBindRequested());
    for (DefaultSmppClientHandler clientHandler : clientHandlerArray) assertEquals(sms, clientHandler.getReponsesNumber().get());
    assertTrue(((BalancerDispatcher) balancer.smppBalancerRunner.getBalancerDispatcher()).getClientSessions().isEmpty());
    assertTrue(((BalancerDispatcher) balancer.smppBalancerRunner.getBalancerDispatcher()).getServerSessions().isEmpty());
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerDispatcher(org.mobicents.tools.smpp.balancer.core.BalancerDispatcher) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with BalancerDispatcher

use of org.mobicents.tools.smpp.balancer.core.BalancerDispatcher in project load-balancer by RestComm.

the class SpliterModeTest method testTransfer.

@Test
public void testTransfer() {
    int clientNumbers = 9;
    clientHandlerArray = new DefaultSmppClientHandler[clientNumbers];
    int sms = 99;
    Locker locker = new Locker(clientNumbers);
    ArrayList<Load> processors = new ArrayList<Load>(clientNumbers);
    for (int i = 0; i < clientNumbers; i++) processors.add(new Load(i, sms, locker));
    for (int i = 0; i < clientNumbers; i++) processors.get(i).start();
    locker.waitForClients();
    for (DefaultSmppServerHandler serverHandler : serverHandlerArray) assertEquals(sms, serverHandler.smsNumber);
    for (DefaultSmppServer server : serverArray) assertEquals(clientNumbers / serverNumbers, server.getBindRequested());
    for (DefaultSmppClientHandler clientHandler : clientHandlerArray) assertEquals(sms, clientHandler.getReponsesNumber().get());
    assertTrue(((BalancerDispatcher) balancer.smppBalancerRunner.getBalancerDispatcher()).getClientSessions().isEmpty());
    assertTrue(((BalancerDispatcher) balancer.smppBalancerRunner.getBalancerDispatcher()).getServerSessions().isEmpty());
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerDispatcher(org.mobicents.tools.smpp.balancer.core.BalancerDispatcher) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

DefaultSmppServer (com.cloudhopper.smpp.impl.DefaultSmppServer)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 BalancerDispatcher (org.mobicents.tools.smpp.balancer.core.BalancerDispatcher)2