Search in sources :

Example 1 with AAAnswer

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

the class RxFactoriesTest method hasDestinationRealmAAA.

@Test
public void hasDestinationRealmAAA() throws Exception {
    rxServerSession.fetchCurrentState(rxMessageFactory.createAARequest());
    AAAnswer aaa = rxServerSession.createAAAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", aaa.getDestinationRealm());
}
Also used : AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with AAAnswer

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

the class RxFactoriesTest method hasDestinationHostAAA.

@Test
public void hasDestinationHostAAA() throws Exception {
    rxServerSession.fetchCurrentState(rxMessageFactory.createAARequest());
    AAAnswer aaa = rxServerSession.createAAAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", aaa.getDestinationHost());
}
Also used : AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with AAAnswer

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

the class RxFactoriesTest method hasTFlagSetAAA.

@Test
public void hasTFlagSetAAA() throws Exception {
    AARequest aar = rxMessageFactory.createAARequest();
    ((DiameterMessageImpl) aar).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in AA-Request", aar.getHeader().isPotentiallyRetransmitted());
    AAAnswer aaa = rxMessageFactory.createAAAnswer(aar);
    assertFalse("The 'T' flag should not be set in AA-Answer", aaa.getHeader().isPotentiallyRetransmitted());
}
Also used : AARequest(net.java.slee.resource.diameter.rx.events.AARequest) AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with AAAnswer

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

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeAAA.

@Test
public void testMessageFactoryApplicationIdChangeAAA() 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...
    AAAnswer originalAAA = rxMessageFactory.createAAAnswer(rxMessageFactory.createAARequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAA);
    // now we switch..
    originalAAA = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    AAAnswer changedAAA = rxMessageFactory.createAAAnswer(rxMessageFactory.createAARequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAA);
    // 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) AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with AAAnswer

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

the class RxFactoriesTest method testServerSessionApplicationIdChangeAAA.

@Test
public void testServerSessionApplicationIdChangeAAA() 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...
    AARequest aar = rxMessageFactory.createAARequest();
    rxServerSession.fetchCurrentState(aar);
    AAAnswer originalAAA = rxServerSession.createAAAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAA);
    // now we switch..
    originalAAA = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    AAAnswer changedAAA = rxServerSession.createAAAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAA);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RxMessageFactoryImpl(org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl) AARequest(net.java.slee.resource.diameter.rx.events.AARequest) ApplicationId(org.jdiameter.api.ApplicationId) AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

AAAnswer (net.java.slee.resource.diameter.rx.events.AAAnswer)10 Test (org.junit.Test)9 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)9 AARequest (net.java.slee.resource.diameter.rx.events.AARequest)3 ApplicationId (org.jdiameter.api.ApplicationId)2 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 SessionTerminationAnswer (net.java.slee.resource.diameter.rx.events.SessionTerminationAnswer)1 Answer (org.jdiameter.api.Answer)1 RxAAAnswerImpl (org.jdiameter.common.impl.app.rx.RxAAAnswerImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1