Search in sources :

Example 1 with S6aMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testMessageFactoryApplicationIdChangeNOR.

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

Example 2 with S6aMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testClientSessionApplicationIdChangeRSA.

@Test
public void testClientSessionApplicationIdChangeRSA() 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...
    ResetRequest rsr = s6aMessageFactory.createResetRequest();
    clientSession.fetchSessionData(rsr);
    ResetAnswer originalRSA = clientSession.createResetAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRSA);
    // now we switch..
    originalRSA = null;
    isVendor = !isVendor;
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    ResetAnswer changedRSA = clientSession.createResetAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRSA);
    // 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) ResetAnswer(net.java.slee.resource.diameter.s6a.events.ResetAnswer) ResetRequest(net.java.slee.resource.diameter.s6a.events.ResetRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with S6aMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testMessageFactoryApplicationIdChangeDSR.

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

Example 4 with S6aMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testServerSessionApplicationIdChangeNOA.

@Test
public void testServerSessionApplicationIdChangeNOA() 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...
    NotifyRequest nor = s6aMessageFactory.createNotifyRequest();
    serverSession.fetchSessionData(nor);
    NotifyAnswer originalNOA = serverSession.createNotifyAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalNOA);
    // now we switch..
    originalNOA = null;
    isVendor = !isVendor;
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    NotifyAnswer changedNOA = serverSession.createNotifyAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedNOA);
    // revert back to default
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : S6aMessageFactoryImpl(org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl) NotifyRequest(net.java.slee.resource.diameter.s6a.events.NotifyRequest) ApplicationId(org.jdiameter.api.ApplicationId) NotifyAnswer(net.java.slee.resource.diameter.s6a.events.NotifyAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with S6aMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl 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)

Aggregations

ApplicationId (org.jdiameter.api.ApplicationId)16 Test (org.junit.Test)16 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)16 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)16 AuthenticationInformationRequest (net.java.slee.resource.diameter.s6a.events.AuthenticationInformationRequest)2 CancelLocationRequest (net.java.slee.resource.diameter.s6a.events.CancelLocationRequest)2 DeleteSubscriberDataRequest (net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest)2 InsertSubscriberDataRequest (net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest)2 NotifyRequest (net.java.slee.resource.diameter.s6a.events.NotifyRequest)2 PurgeUERequest (net.java.slee.resource.diameter.s6a.events.PurgeUERequest)2 ResetRequest (net.java.slee.resource.diameter.s6a.events.ResetRequest)2 UpdateLocationRequest (net.java.slee.resource.diameter.s6a.events.UpdateLocationRequest)2 AuthenticationInformationAnswer (net.java.slee.resource.diameter.s6a.events.AuthenticationInformationAnswer)1 CancelLocationAnswer (net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer)1 DeleteSubscriberDataAnswer (net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswer)1 InsertSubscriberDataAnswer (net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswer)1 NotifyAnswer (net.java.slee.resource.diameter.s6a.events.NotifyAnswer)1 PurgeUEAnswer (net.java.slee.resource.diameter.s6a.events.PurgeUEAnswer)1 ResetAnswer (net.java.slee.resource.diameter.s6a.events.ResetAnswer)1 UpdateLocationAnswer (net.java.slee.resource.diameter.s6a.events.UpdateLocationAnswer)1