Search in sources :

Example 1 with GqAbortSessionRequest

use of net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method isProxiableASR.

@Test
public void isProxiableASR() throws Exception {
    GqAbortSessionRequest rar = gqMessageFactory.createGqAbortSessionRequest();
    assertTrue("The 'P' bit is not set by default in Gq' Abort-Session-Request, it should.", rar.getHeader().isProxiable());
}
Also used : GqAbortSessionRequest(net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with GqAbortSessionRequest

use of net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method hasGqApplicationIdASR.

@Test
public void hasGqApplicationIdASR() throws Exception {
    GqAbortSessionRequest asr = gqMessageFactory.createGqAbortSessionRequest();
    assertTrue("Auth-Application-Id AVP in Gq ASR must be " + GqMessageFactory._GQ_AUTH_APP_ID + ", it is " + asr.getAuthApplicationId(), asr.getAuthApplicationId() == GqMessageFactory._GQ_AUTH_APP_ID);
}
Also used : GqAbortSessionRequest(net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with GqAbortSessionRequest

use of net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method hasTFlagSetASA.

@Test
public void hasTFlagSetASA() throws Exception {
    GqAbortSessionRequest asr = gqMessageFactory.createGqAbortSessionRequest();
    ((DiameterMessageImpl) asr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Abort-Session-Request", asr.getHeader().isPotentiallyRetransmitted());
    GqAbortSessionAnswer asa = gqMessageFactory.createGqAbortSessionAnswer(asr);
    assertFalse("The 'T' flag should not be set in Abort-Session-Answer", asa.getHeader().isPotentiallyRetransmitted());
}
Also used : GqAbortSessionAnswer(net.java.slee.resource.diameter.gq.events.GqAbortSessionAnswer) GqAbortSessionRequest(net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with GqAbortSessionRequest

use of net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method isRequestASR.

// Abort-Session-Request
@Test
public void isRequestASR() throws Exception {
    GqAbortSessionRequest asr = gqMessageFactory.createGqAbortSessionRequest();
    assertTrue("Request Flag in Abort-Session-Request is not set.", asr.getHeader().isRequest());
}
Also used : GqAbortSessionRequest(net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with GqAbortSessionRequest

use of net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeASR.

@Test
public void testMessageFactoryApplicationIdChangeASR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqAbortSessionRequest originalASR = gqMessageFactory.createGqAbortSessionRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASR);
    // now we switch..
    originalASR = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqAbortSessionRequest changedASR = gqMessageFactory.createGqAbortSessionRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASR);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqAbortSessionRequest(net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

GqAbortSessionRequest (net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest)9 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)2 GqAbortSessionAnswer (net.java.slee.resource.diameter.gq.events.GqAbortSessionAnswer)2 Message (org.jdiameter.api.Message)2 GqAbortSessionRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqAbortSessionRequestImpl)2 ApplicationId (org.jdiameter.api.ApplicationId)1 GqMessageFactoryImpl (org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl)1