Search in sources :

Example 11 with AuthenticationInformationRequest

use of net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method hasTFlagSetAIA.

@Test
public void hasTFlagSetAIA() throws Exception {
    AuthenticationInformationRequest air = s6aMessageFactory.createAuthenticationInformationRequest();
    ((DiameterMessageImpl) air).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Authentication-Information-Request", air.getHeader().isPotentiallyRetransmitted());
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer aia = serverSession.createAuthenticationInformationAnswer();
    assertFalse("The 'T' flag should not be set in Authentication-Information-Answer", aia.getHeader().isPotentiallyRetransmitted());
}
Also used : AuthenticationInformationAnswer(net.java.slee.resource.diameter.s6a.events.AuthenticationInformationAnswer) AuthenticationInformationRequest(net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 12 with AuthenticationInformationRequest

use of net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testGettersAndSettersAIA.

@Test
public void testGettersAndSettersAIA() throws Exception {
    AuthenticationInformationRequest air = s6aMessageFactory.createAuthenticationInformationRequest();
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer aia = serverSession.createAuthenticationInformationAnswer();
    int nFailures = S6aAvpAssistant.INSTANCE.testMethods(aia, AuthenticationInformationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : AuthenticationInformationAnswer(net.java.slee.resource.diameter.s6a.events.AuthenticationInformationAnswer) AuthenticationInformationRequest(net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 13 with AuthenticationInformationRequest

use of net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testMessageFactoryApplicationIdChangeAIR.

@Test
public void testMessageFactoryApplicationIdChangeAIR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).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 S6a is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    AuthenticationInformationRequest originalAIR = s6aMessageFactory.createAuthenticationInformationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAIR);
    // now we switch..
    originalAIR = null;
    isVendor = !isVendor;
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    AuthenticationInformationRequest changedAIR = s6aMessageFactory.createAuthenticationInformationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAIR);
    // revert back to default
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : S6aMessageFactoryImpl(org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) AuthenticationInformationRequest(net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

AuthenticationInformationRequest (net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest)13 Test (org.junit.Test)11 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)11 AuthenticationInformationAnswer (net.java.slee.resource.diameter.s6a.events.AuthenticationInformationAnswer)8 ApplicationId (org.jdiameter.api.ApplicationId)2 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)2 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 InternalException (org.jdiameter.api.InternalException)1