Search in sources :

Example 1 with UserIdentityAvpImpl

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));
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with UserIdentityAvpImpl

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));
}
Also used : UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with UserIdentityAvpImpl

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));
}
Also used : ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with UserIdentityAvpImpl

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));
}
Also used : PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with UserIdentityAvpImpl

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 :)
        }
    }
}
Also used : AvpRepresentation(org.mobicents.diameter.dictionary.AvpRepresentation) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)

Aggregations

UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)6 Test (org.junit.Test)4 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)4 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)2 AvpRepresentation (org.mobicents.diameter.dictionary.AvpRepresentation)2 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)2 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)1 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)1 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)1