Search in sources :

Example 1 with HttpUsersManagement

use of org.mobicents.smsc.domain.HttpUsersManagement in project smscgateway by RestComm.

the class TxHttpServerSbbTest method setUpClass.

@BeforeMethod
public void setUpClass() throws Exception {
    System.out.println("setUpClass");
    this.pers = new PersistenceRAInterfaceProxy();
    this.cassandraDbInited = this.pers.testCassandraAccess();
    if (!this.cassandraDbInited)
        return;
    // if (!this.cassandraDbInited)
    // Assert.fail("Cassandra DB is not inited");
    this.pers.start();
    SmscPropertiesManagement.getInstance("Test");
    SmscPropertiesManagement.getInstance().setSmscStopped(false);
    SmscPropertiesManagement.getInstance().setStoreAndForwordMode(StoreAndForwordMode.normal);
    MProcManagement.getInstance("Test");
    HttpUsersManagement usersManagement = HttpUsersManagement.getInstance("Test");
    if (usersManagement.getHttpUserByName("user_4321") == null) {
        // add if not exists
        usersManagement.createHttpUser("user_4321", "password", 0);
    }
    this.sbb = new TxHttpServerSbbProxy(this.pers);
}
Also used : PersistenceRAInterfaceProxy(org.mobicents.smsc.slee.resources.persistence.PersistenceRAInterfaceProxy) HttpUsersManagement(org.mobicents.smsc.domain.HttpUsersManagement) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with HttpUsersManagement

use of org.mobicents.smsc.domain.HttpUsersManagement in project smscgateway by RestComm.

the class AutodecodingTest method autodecodingTest_A.

@Test
public void autodecodingTest_A() throws Exception {
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance("AutodecodingTest");
    smscPropertiesManagement.setHttpDefaultSourceNpi(-1);
    smscPropertiesManagement.setHttpDefaultSourceTon(-1);
    byte[] udh = { 0x06, 0x05, 0x04, 0x13, 0x01, 0x13, 0x01 };
    String udhStr = new String(udh, "iso-8859-1");
    // alphanumerical
    HttpUsersManagement httpUsersManagement = HttpUsersManagement.getInstance("AutodecodingTest");
    try {
        httpUsersManagement.destroyHttpUser("userId");
    } catch (Exception e) {
    }
    httpUsersManagement.createHttpUser("userId", "password", 0);
    HttpSendMessageIncomingData idata = new HttpSendMessageIncomingData("userId", "password", "msg", null, null, null, "wwwwww", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, "");
    assertEquals(idata.getSender(), "wwwwww");
    assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.ALFANUMERIC);
    assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.UNKNOWN);
    assertEquals(idata.getUdh(), null);
    // international
    idata = new HttpSendMessageIncomingData("userId", "password", "msg", null, null, null, "+33334444", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, "");
    assertEquals(idata.getSender(), "33334444");
    assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.INTERNATIONAL);
    assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.ISDN);
    // national
    idata = new HttpSendMessageIncomingData("userId", "password", "www", null, null, null, "33334444", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, udhStr);
    assertEquals(idata.getSender(), "33334444");
    assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.NATIONAL);
    assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.ISDN);
    assertEquals(idata.udhToString(idata.getUdh()), "06 05 04 13 01 13 01 ");
}
Also used : HttpSendMessageIncomingData(org.mobicents.smsc.slee.services.http.server.tx.data.HttpSendMessageIncomingData) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) HttpUsersManagement(org.mobicents.smsc.domain.HttpUsersManagement) Test(org.testng.annotations.Test)

Example 3 with HttpUsersManagement

use of org.mobicents.smsc.domain.HttpUsersManagement in project smscgateway by RestComm.

the class AutodecodingTest method autodecodingTest_B.

@Test
public void autodecodingTest_B() throws Exception {
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance("AutodecodingTest");
    smscPropertiesManagement.setHttpDefaultSourceNpi(-2);
    smscPropertiesManagement.setHttpDefaultSourceTon(-2);
    byte[] udh = { 0x06, 0x05, 0x04, 0x13, 0x01, 0x13, 0x01 };
    String udhStr = new String(udh, "iso-8859-1");
    // alphanumerical
    HttpUsersManagement httpUsersManagement = HttpUsersManagement.getInstance("AutodecodingTest");
    try {
        httpUsersManagement.destroyHttpUser("userId");
    } catch (Exception e) {
    }
    httpUsersManagement.createHttpUser("userId", "password", 0);
    HttpSendMessageIncomingData idata = new HttpSendMessageIncomingData("userId", "password", "msg", null, null, null, "wwwwww", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, "");
    assertEquals(idata.getSender(), "wwwwww");
    assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.ALFANUMERIC);
    assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.UNKNOWN);
    assertEquals(idata.getUdh(), null);
    // international
    idata = new HttpSendMessageIncomingData("userId", "password", "msg", null, null, null, "33334444", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, udhStr);
    assertEquals(idata.getSender(), "33334444");
    assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.INTERNATIONAL);
    assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.ISDN);
    assertEquals(idata.udhToString(idata.getUdh()), "06 05 04 13 01 13 01 ");
}
Also used : HttpSendMessageIncomingData(org.mobicents.smsc.slee.services.http.server.tx.data.HttpSendMessageIncomingData) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) HttpUsersManagement(org.mobicents.smsc.domain.HttpUsersManagement) Test(org.testng.annotations.Test)

Aggregations

HttpUsersManagement (org.mobicents.smsc.domain.HttpUsersManagement)3 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)2 HttpSendMessageIncomingData (org.mobicents.smsc.slee.services.http.server.tx.data.HttpSendMessageIncomingData)2 Test (org.testng.annotations.Test)2 PersistenceRAInterfaceProxy (org.mobicents.smsc.slee.resources.persistence.PersistenceRAInterfaceProxy)1 BeforeMethod (org.testng.annotations.BeforeMethod)1