use of org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl in project jain-slee.diameter by RestComm.
the class ShClientFactoriesTest method isSNRPublicIdentityAccessibleTwice.
@Test
public void isSNRPublicIdentityAccessibleTwice() throws Exception {
String originalValue = "sip:alexandre@diameter.mobicents.org";
UserIdentityAvpImpl uiAvp = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, 10415L, 1, 0, new byte[] {});
uiAvp.setPublicIdentity(originalValue);
SubscribeNotificationsRequest udr = shClientFactory.createSubscribeNotificationsRequest(uiAvp, DataReferenceType.IMS_PUBLIC_IDENTITY, SubsReqType.SUBSCRIBE);
String obtainedValue1 = udr.getUserIdentity().getPublicIdentity();
String obtainedValue2 = udr.getUserIdentity().getPublicIdentity();
assertTrue("Obtained value for Public-Identity AVP differs from original.", obtainedValue1.equals(originalValue));
assertTrue("Obtained #1 value for Public-Identity AVP differs from Obtained #2.", obtainedValue1.equals(obtainedValue2));
}
use of org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl in project jain-slee.diameter by RestComm.
the class ShClientFactoriesTest method isUDRPublicIdentityAccessibleTwice.
@Test
public void isUDRPublicIdentityAccessibleTwice() throws Exception {
String originalValue = "sip:alexandre@diameter.mobicents.org";
UserIdentityAvpImpl uiAvp = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, 10415L, 1, 0, new byte[] {});
uiAvp.setPublicIdentity(originalValue);
UserDataRequest udr = shClientFactory.createUserDataRequest(uiAvp, DataReferenceType.IMS_PUBLIC_IDENTITY);
String obtainedValue1 = udr.getUserIdentity().getPublicIdentity();
String obtainedValue2 = udr.getUserIdentity().getPublicIdentity();
assertTrue("Obtained value for Public-Identity AVP differs from original.", obtainedValue1.equals(originalValue));
assertTrue("Obtained #1 value for Public-Identity AVP differs from Obtained #2.", obtainedValue1.equals(obtainedValue2));
}
use of org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl in project jain-slee.diameter by RestComm.
the class ShClientFactoriesTest method isPURPublicIdentityAccessibleTwice.
@Test
public void isPURPublicIdentityAccessibleTwice() throws Exception {
String originalValue = "sip:alexandre@diameter.mobicents.org";
UserIdentityAvpImpl uiAvp = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, 10415L, 1, 0, new byte[] {});
uiAvp.setPublicIdentity(originalValue);
ProfileUpdateRequest udr = shClientFactory.createProfileUpdateRequest(uiAvp, DataReferenceType.IMS_PUBLIC_IDENTITY, new byte[1]);
String obtainedValue1 = udr.getUserIdentity().getPublicIdentity();
String obtainedValue2 = udr.getUserIdentity().getPublicIdentity();
assertTrue("Obtained value for Public-Identity AVP differs from original.", obtainedValue1.equals(originalValue));
assertTrue("Obtained #1 value for Public-Identity AVP differs from Obtained #2.", obtainedValue1.equals(obtainedValue2));
}
use of org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method isPNRPublicIdentityAccessibleTwice.
@Test
public void isPNRPublicIdentityAccessibleTwice() throws Exception {
String originalValue = "sip:alexandre@diameter.mobicents.org";
UserIdentityAvpImpl uiAvp = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, 10415L, 1, 0, new byte[] {});
uiAvp.setPublicIdentity(originalValue);
PushNotificationRequest udr = shServerFactory.createPushNotificationRequest(uiAvp, new byte[1]);
String obtainedValue1 = udr.getUserIdentity().getPublicIdentity();
String obtainedValue2 = udr.getUserIdentity().getPublicIdentity();
assertTrue("Obtained value for Public-Identity AVP differs from original.", obtainedValue1.equals(originalValue));
assertTrue("Obtained #1 value for Public-Identity AVP differs from Obtained #2.", obtainedValue1.equals(obtainedValue2));
}
use of org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl in project jain-slee.diameter by RestComm.
the class ShServerActivityImpl method fetchSessionData.
// #########################
// # DiameterActivityImpl
// #########################
public void fetchSessionData(DiameterMessage msg, boolean incoming) {
if (msg.getHeader().isRequest()) {
// Well it should always be getting this on request and only once ?
if (incoming) {
boolean changed = false;
if (remoteRealm == null) {
remoteRealm = msg.getOriginRealm();
changed = true;
}
if (remoteHost == null) {
changed = true;
remoteHost = msg.getOriginHost();
}
if (this.userIdentity == null) {
changed = true;
AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(DiameterShAvpCodes.USER_IDENTITY, DiameterShAvpCodes.SH_VENDOR_ID);
this.userIdentity = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, DiameterShAvpCodes.SH_VENDOR_ID, rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), AvpUtilities.getAvpAsGrouped(DiameterShAvpCodes.USER_IDENTITY, DiameterShAvpCodes.SH_VENDOR_ID, ((DiameterMessageImpl) msg).getGenericData().getAvps()));
}
// FIXME: is this true?
if (this.authSessionState == null) {
changed = true;
this.authSessionState = AuthSessionStateType.fromInt(AvpUtilities.getAvpAsInteger32(277, ((DiameterMessageImpl) msg).getGenericData().getAvps()));
}
stateMessages.add((DiameterMessageImpl) msg);
if (changed) {
super.baseListener.update(getActivityHandle(), this);
}
} else {
// FIXME, do more :)
}
}
}
Aggregations