use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method testServerSessionApplicationIdChangeUDA.
@Test
public void testServerSessionApplicationIdChangeUDA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((ShServerMessageFactoryImpl) shServerFactory).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 Sh is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
UserDataRequest udr = shClientFactory.createUserDataRequest();
UserIdentityAvp uiAvp = shAvpFactory.createUserIdentity();
uiAvp.setPublicIdentity("alexandre@mobicents.org");
udr.setUserIdentity(uiAvp);
udr.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
serverSession.fetchSessionData(udr, true);
UserDataAnswer originalUDA = serverSession.createUserDataAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalUDA);
// now we switch..
originalUDA = null;
isVendor = !isVendor;
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
UserDataAnswer changedUDA = serverSession.createUserDataAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedUDA);
// revert back to default
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method testMessageFactoryApplicationIdChangePNR.
@Test
public void testMessageFactoryApplicationIdChangePNR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((ShServerMessageFactoryImpl) shServerFactory).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 Sh is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
PushNotificationRequest originalPNR = shServerFactory.createPushNotificationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalPNR);
// now we switch..
originalPNR = null;
isVendor = !isVendor;
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
PushNotificationRequest changedPNR = shServerFactory.createPushNotificationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedPNR);
// revert back to default
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class DiameterS6aResourceAdaptor method sessionCreated.
public void sessionCreated(ClientS6aSession session) {
S6aMessageFactoryImpl sessionMsgFactory = new S6aMessageFactoryImpl(session.getSessions().get(0), stack, new DiameterIdentity[] {});
// Set the first configured Application-Id as default for message factory
ApplicationId firstAppId = authApplicationIds.get(0);
sessionMsgFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
S6aClientSessionImpl clientActivity = new S6aClientSessionImpl(sessionMsgFactory, s6aAvpFactory, session, this, null, null, stack);
// session.addStateChangeNotification(serverActivity);
// addActivity(serverActivity);
clientActivity.setSessionListener(this);
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class DiameterS6aResourceAdaptor method sessionCreated.
// S6a Session Creation Listener --------------------------------------
public void sessionCreated(ServerS6aSession session) {
S6aMessageFactoryImpl sessionMsgFactory = new S6aMessageFactoryImpl(session.getSessions().get(0), stack, new DiameterIdentity[] {});
// Set the first configured Application-Id as default for message factory
ApplicationId firstAppId = authApplicationIds.get(0);
sessionMsgFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
S6aServerSessionImpl serverActivity = new S6aServerSessionImpl(sessionMsgFactory, s6aAvpFactory, session, this, null, null, stack);
// session.addStateChangeNotification(serverActivity);
// addActivity(serverActivity);
serverActivity.setSessionListener(this);
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class S6aFactoriesTest method testMessageFactoryApplicationIdChangeRSR.
@Test
public void testMessageFactoryApplicationIdChangeRSR() 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 originalRSR = s6aMessageFactory.createResetRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRSR);
// now we switch..
originalRSR = null;
isVendor = !isVendor;
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
ResetRequest changedRSR = s6aMessageFactory.createResetRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRSR);
// revert back to default
((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations