Search in sources :

Example 6 with GqAARequest

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

the class GqFactoriesTest method isProxiableCopiedAAA.

@Test
public void isProxiableCopiedAAA() throws Exception {
    GqAARequest aar = gqMessageFactory.createGqAARequest();
    GqAAAnswer aaa = gqMessageFactory.createGqAAAnswer(aar);
    assertEquals("The 'P' bit is not copied from request in Gq' AA-Answer, it should. [RFC3588/6.2]", aar.getHeader().isProxiable(), aaa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) aar).getGenericData().setProxiable(!aar.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Gq' AA-Request, it should.", aar.getHeader().isProxiable() != aaa.getHeader().isProxiable());
    aaa = gqMessageFactory.createGqAAAnswer(aar);
    assertEquals("The 'P' bit is not copied from request in Gq' AA-Answer, it should. [RFC3588/6.2]", aar.getHeader().isProxiable(), aaa.getHeader().isProxiable());
}
Also used : GqAARequest(net.java.slee.resource.diameter.gq.events.GqAARequest) GqAAAnswer(net.java.slee.resource.diameter.gq.events.GqAAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with GqAARequest

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeAAR.

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

Example 8 with GqAARequest

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

the class GqMessageFactoryImpl method createGqAARequest.

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

Example 9 with GqAARequest

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

the class GqMessageFactoryImpl method createGqAARequest.

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

Aggregations

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