Search in sources :

Example 1 with AuthenticationInformationAnswer

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

the class S6aFactoriesTest method isAnswerAIA.

@Test
public void isAnswerAIA() throws Exception {
    AuthenticationInformationRequest air = s6aMessageFactory.createAuthenticationInformationRequest();
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer aia = serverSession.createAuthenticationInformationAnswer();
    assertFalse("Request Flag in Authentication-Information-Answer is set.", aia.getHeader().isRequest());
}
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 2 with AuthenticationInformationAnswer

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

the class S6aFactoriesTest method isProxiableCopiedAIA.

@Test
public void isProxiableCopiedAIA() throws Exception {
    AuthenticationInformationRequest air = s6aMessageFactory.createAuthenticationInformationRequest();
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer aia = serverSession.createAuthenticationInformationAnswer();
    assertEquals("The 'P' bit is not copied from request in Location-Info-Answer, it should. [RFC3588/6.2]", air.getHeader().isProxiable(), aia.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) air).getGenericData().setProxiable(!air.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Authentication-Information-Request, it should.", air.getHeader().isProxiable() != aia.getHeader().isProxiable());
    serverSession.fetchSessionData(air);
    aia = serverSession.createAuthenticationInformationAnswer();
    assertEquals("The 'P' bit is not copied from request in Authentication-Information-Answer, it should. [RFC3588/6.2]", air.getHeader().isProxiable(), aia.getHeader().isProxiable());
}
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 3 with AuthenticationInformationAnswer

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

the class S6aFactoriesTest method testServerSessionApplicationIdChangeAIA.

@Test
public void testServerSessionApplicationIdChangeAIA() 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 air = s6aMessageFactory.createAuthenticationInformationRequest();
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer originalAIA = serverSession.createAuthenticationInformationAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAIA);
    // now we switch..
    originalAIA = null;
    isVendor = !isVendor;
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    AuthenticationInformationAnswer changedAIA = serverSession.createAuthenticationInformationAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAIA);
    // revert back to default
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : S6aMessageFactoryImpl(org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl) AuthenticationInformationAnswer(net.java.slee.resource.diameter.s6a.events.AuthenticationInformationAnswer) 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)

Example 4 with AuthenticationInformationAnswer

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

the class S6aFactoriesTest method hasDestinationRealmAIA.

@Test
public void hasDestinationRealmAIA() throws Exception {
    AuthenticationInformationRequest air = s6aMessageFactory.createAuthenticationInformationRequest();
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer aia = serverSession.createAuthenticationInformationAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", aia.getDestinationRealm());
}
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 5 with AuthenticationInformationAnswer

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

the class S6aFactoriesTest method hasDestinationHostAIA.

@Test
public void hasDestinationHostAIA() throws Exception {
    AuthenticationInformationRequest air = s6aMessageFactory.createAuthenticationInformationRequest();
    serverSession.fetchSessionData(air);
    AuthenticationInformationAnswer aia = serverSession.createAuthenticationInformationAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", aia.getDestinationHost());
}
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)

Aggregations

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