Search in sources :

Example 1 with ReAuthAnswer

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

the class RxFactoriesTest method hasDestinationRealmRAA.

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

Example 2 with ReAuthAnswer

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

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeRAA.

// @Test
// public void testServerSessionApplicationIdChangeRAR() 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...
// ReAuthRequest originalRAR = rxServerSession.createReAuthRequest();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
// 
// // now we switch..
// originalRAR = null;
// isVendor = !isVendor;
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// 
// // create a new message and see how it comes...
// ReAuthRequest changedRAR = rxServerSession.createReAuthRequest();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
// 
// // revert back to default
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// }
@Test
public void testMessageFactoryApplicationIdChangeRAA() 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...
    ReAuthAnswer originalRAA = rxMessageFactory.createReAuthAnswer(rxMessageFactory.createReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
    // now we switch..
    originalRAA = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    ReAuthAnswer changedRAA = rxMessageFactory.createReAuthAnswer(rxMessageFactory.createReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : ReAuthAnswer(net.java.slee.resource.diameter.rx.events.ReAuthAnswer) RxMessageFactoryImpl(org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with ReAuthAnswer

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

the class RxFactoriesTest method testGettersAndSettersRAA.

@Test
public void testGettersAndSettersRAA() throws Exception {
    ReAuthAnswer raa = rxMessageFactory.createReAuthAnswer(rxMessageFactory.createReAuthRequest());
    int nFailures = RxAvpAssistant.INSTANCE.testMethods(raa, ReAuthAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : ReAuthAnswer(net.java.slee.resource.diameter.rx.events.ReAuthAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with ReAuthAnswer

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

the class RxFactoriesTest method isAnswerRAA.

// Re-Auth-Answer
@Test
public void isAnswerRAA() throws Exception {
    ReAuthAnswer raa = rxMessageFactory.createReAuthAnswer(rxMessageFactory.createReAuthRequest());
    assertFalse("Request Flag in Re-Auth-Answer is set.", raa.getHeader().isRequest());
}
Also used : ReAuthAnswer(net.java.slee.resource.diameter.rx.events.ReAuthAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with ReAuthAnswer

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

the class RxFactoriesTest method isProxiableCopiedRAA.

@Test
public void isProxiableCopiedRAA() throws Exception {
    ReAuthRequest rar = rxMessageFactory.createReAuthRequest();
    ReAuthAnswer raa = rxMessageFactory.createReAuthAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Rx' Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) rar).getGenericData().setProxiable(!rar.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Rx' Re-Auth-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
    raa = rxMessageFactory.createReAuthAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Rx' Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
Also used : ReAuthRequest(net.java.slee.resource.diameter.rx.events.ReAuthRequest) ReAuthAnswer(net.java.slee.resource.diameter.rx.events.ReAuthAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

ReAuthAnswer (net.java.slee.resource.diameter.rx.events.ReAuthAnswer)7 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 ReAuthRequest (net.java.slee.resource.diameter.rx.events.ReAuthRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)1 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)1