use of net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp in project jain-slee.diameter by RestComm.
the class HSSClientChildSbb method getIMSUserState.
public String getIMSUserState(String publicIdentity, String destinationRealm, String destinationHost) throws IOException {
UserIdentityAvp publicIdentityAvp = createUserIdentityAvp(publicIdentity, null);
UserDataRequest udr = diameterShClientMessageFactory.createUserDataRequest(publicIdentityAvp, DataReferenceType.IMS_USER_STATE);
udr.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
// Set destination -- Realm is mandatory, host is optional
udr.setDestinationRealm(new DiameterIdentity(destinationRealm));
if (destinationHost != null) {
udr.setDestinationHost(new DiameterIdentity(destinationHost));
}
ShClientActivity activity = getShClientActivity();
activity.sendUserDataRequest(udr);
// Store request for future matching
storeRequestInACI(activity, udr);
// Return Session-Id, may be used as identifier
return activity.getSessionId();
}
use of net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method testServerSessionApplicationIdChangePUA.
@Test
public void testServerSessionApplicationIdChangePUA() 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...
ProfileUpdateRequest pur = shClientFactory.createProfileUpdateRequest();
UserIdentityAvp uiAvp = shAvpFactory.createUserIdentity();
uiAvp.setPublicIdentity("alexandre@mobicents.org");
pur.setUserIdentity(uiAvp);
pur.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
serverSession.fetchSessionData(pur, true);
ProfileUpdateAnswer originalPUA = serverSession.createProfileUpdateAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalPUA);
// now we switch..
originalPUA = null;
isVendor = !isVendor;
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
ProfileUpdateAnswer changedPUA = serverSession.createProfileUpdateAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedPUA);
// revert back to default
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method testServerSessionApplicationIdChangeSNA.
@Test
public void testServerSessionApplicationIdChangeSNA() 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...
SubscribeNotificationsRequest snr = shClientFactory.createSubscribeNotificationsRequest();
UserIdentityAvp uiAvp = shAvpFactory.createUserIdentity();
uiAvp.setPublicIdentity("alexandre@mobicents.org");
snr.setUserIdentity(uiAvp);
snr.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
serverSession.fetchSessionData(snr, true);
SubscribeNotificationsAnswer originalSNA = serverSession.createSubscribeNotificationsAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSNA);
// now we switch..
originalSNA = null;
isVendor = !isVendor;
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
SubscribeNotificationsAnswer changedSNA = serverSession.createSubscribeNotificationsAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSNA);
// revert back to default
((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations