Search in sources :

Example 6 with SessionTerminationRequest

use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method hasRxApplicationIdSTR.

@Test
public void hasRxApplicationIdSTR() throws Exception {
    SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
    assertTrue("Auth-Application-Id AVP in Rx STR must be " + RxMessageFactory._Rx_AUTH_APP_ID + ", it is " + str.getAuthApplicationId(), str.getAuthApplicationId() == RxMessageFactory._Rx_AUTH_APP_ID);
}
Also used : SessionTerminationRequest(net.java.slee.resource.diameter.rx.events.SessionTerminationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with SessionTerminationRequest

use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testGettersAndSettersSTR.

@Test
public void testGettersAndSettersSTR() throws Exception {
    SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
    int nFailures = RxAvpAssistant.INSTANCE.testMethods(str, SessionTerminationRequest.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : SessionTerminationRequest(net.java.slee.resource.diameter.rx.events.SessionTerminationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 8 with SessionTerminationRequest

use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method isRequestSTR.

// Session-Termination-Request
@Test
public void isRequestSTR() throws Exception {
    SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
    assertTrue("Request Flag in Session-Termination-Request is not set.", str.getHeader().isRequest());
}
Also used : SessionTerminationRequest(net.java.slee.resource.diameter.rx.events.SessionTerminationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 9 with SessionTerminationRequest

use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testClientSessionApplicationIdChangeSTR.

@Test
public void testClientSessionApplicationIdChangeSTR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).getApplicationId();
    boolean isAuth = originalAppId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isAcct = originalAppId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isVendor = originalAppId.getVendorId() != 0L;
    assertTrue("Invalid Application-Id (" + originalAppId + "). Should only, and at least, contain either Auth or Acct value.", (isAuth && !isAcct) || (!isAuth && isAcct));
    System.out.println("Default VENDOR-ID for Rx is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    SessionTerminationRequest originalSTR = rxClientSession.createSessionTermRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTR);
    // now we switch..
    originalSTR = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    SessionTerminationRequest changedSTR = rxClientSession.createSessionTermRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTR);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RxMessageFactoryImpl(org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) SessionTerminationRequest(net.java.slee.resource.diameter.rx.events.SessionTerminationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

SessionTerminationRequest (net.java.slee.resource.diameter.rx.events.SessionTerminationRequest)9 Test (org.junit.Test)9 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)9 SessionTerminationAnswer (net.java.slee.resource.diameter.rx.events.SessionTerminationAnswer)3 ApplicationId (org.jdiameter.api.ApplicationId)3 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)3