Search in sources :

Example 1 with GqSessionTerminationAnswer

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

the class GqFactoriesTest method isProxiableCopiedSTA.

@Test
public void isProxiableCopiedSTA() throws Exception {
    GqSessionTerminationRequest str = gqMessageFactory.createGqSessionTerminationRequest();
    GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(str);
    assertEquals("The 'P' bit is not copied from request in Session-Termination-Answer, it should. [RFC3588/6.2]", str.getHeader().isProxiable(), sta.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) str).getGenericData().setProxiable(!str.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Session-Termination-Request, it should.", str.getHeader().isProxiable() != sta.getHeader().isProxiable());
    sta = gqMessageFactory.createGqSessionTerminationAnswer(str);
    assertEquals("The 'P' bit is not copied from request in Session-Termination-Answer, it should. [RFC3588/6.2]", str.getHeader().isProxiable(), sta.getHeader().isProxiable());
}
Also used : GqSessionTerminationRequest(net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest) GqSessionTerminationAnswer(net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with GqSessionTerminationAnswer

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

the class GqFactoriesTest method testGettersAndSettersSTA.

@Test
public void testGettersAndSettersSTA() throws Exception {
    GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
    int nFailures = GqAvpAssistant.INSTANCE.testMethods(sta, GqSessionTerminationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : GqSessionTerminationAnswer(net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with GqSessionTerminationAnswer

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

the class GqFactoriesTest method hasTFlagSetSTA.

@Test
public void hasTFlagSetSTA() throws Exception {
    GqSessionTerminationRequest str = gqMessageFactory.createGqSessionTerminationRequest();
    ((DiameterMessageImpl) str).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Session-Termination-Request", str.getHeader().isPotentiallyRetransmitted());
    GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(str);
    assertFalse("The 'T' flag should not be set in Session-Termination-Answer", sta.getHeader().isPotentiallyRetransmitted());
}
Also used : GqSessionTerminationRequest(net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest) GqSessionTerminationAnswer(net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with GqSessionTerminationAnswer

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeSTA.

@Test
public void testMessageFactoryApplicationIdChangeSTA() 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...
    GqSessionTerminationAnswer originalSTA = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTA);
    // now we switch..
    originalSTA = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqSessionTerminationAnswer changedSTA = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTA);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqSessionTerminationAnswer(net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with GqSessionTerminationAnswer

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

the class GqFactoriesTest method isAnswerSTA.

// Session-Termination-Answer
@Test
public void isAnswerSTA() throws Exception {
    GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
    assertFalse("Request Flag in Re-Auth-Answer is set.", sta.getHeader().isRequest());
}
Also used : GqSessionTerminationAnswer(net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

GqSessionTerminationAnswer (net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer)7 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 GqSessionTerminationRequest (net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)1 GqMessageFactoryImpl (org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl)1