Search in sources :

Example 6 with GqSessionTerminationRequest

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

the class GqMessageFactoryImpl method createGqSessionTerminationRequest.

@Override
public GqSessionTerminationRequest createGqSessionTerminationRequest() {
    Message raw = createRequest(GqSessionTerminationRequest.COMMAND_CODE, new DiameterAvp[] {});
    GqSessionTerminationRequest str = new GqSessionTerminationRequestImpl(raw);
    if (sessionId != null) {
        str.setSessionId(sessionId);
    }
    addOrigin(str);
    return str;
}
Also used : GqSessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl) GqSessionTerminationRequest(net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage)

Example 7 with GqSessionTerminationRequest

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

the class GqMessageFactoryImpl method createGqSessionTerminationRequest.

@Override
public GqSessionTerminationRequest createGqSessionTerminationRequest(String sessionId) {
    Message raw = createRequest(GqSessionTerminationRequest.COMMAND_CODE, new DiameterAvp[] {});
    GqSessionTerminationRequest str = new GqSessionTerminationRequestImpl(raw);
    str.setSessionId(sessionId);
    addOrigin(str);
    return str;
}
Also used : GqSessionTerminationRequestImpl(org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl) GqSessionTerminationRequest(net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest) Message(org.jdiameter.api.Message) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage)

Example 8 with GqSessionTerminationRequest

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeSTR.

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

Example 9 with GqSessionTerminationRequest

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

the class GqFactoriesTest method testGettersAndSettersSTR.

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

Aggregations

GqSessionTerminationRequest (net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest)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 GqSessionTerminationAnswer (net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer)2 Message (org.jdiameter.api.Message)2 GqSessionTerminationRequestImpl (org.mobicents.slee.resource.diameter.gq.events.GqSessionTerminationRequestImpl)2 ApplicationId (org.jdiameter.api.ApplicationId)1 GqMessageFactoryImpl (org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl)1