Search in sources :

Example 6 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method testGettersAndSettersPUR.

@Test
public void testGettersAndSettersPUR() throws Exception {
    ProfileUpdateRequest pur = shClientFactory.createProfileUpdateRequest();
    int nFailures = ShClientAvpAssistant.INSTANCE.testMethods(pur, ProfileUpdateRequest.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest 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 8 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShServerFactoriesTest method hasTFlagSetPUA.

@Test
public void hasTFlagSetPUA() throws Exception {
    ProfileUpdateRequest pur = shClientFactory.createProfileUpdateRequest();
    ((DiameterMessageImpl) pur).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Profile-Update-Request", pur.getHeader().isPotentiallyRetransmitted());
    ProfileUpdateAnswer pua = shServerFactory.createProfileUpdateAnswer(pur);
    assertFalse("The 'T' flag should not be set in Profile-Update-Answer", pua.getHeader().isPotentiallyRetransmitted());
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 9 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShServerFactoriesTest method isProxiableCopiedPUA.

@Test
public void isProxiableCopiedPUA() throws Exception {
    ProfileUpdateRequest pur = shClientFactory.createProfileUpdateRequest();
    ProfileUpdateAnswer pua = shServerFactory.createProfileUpdateAnswer(pur);
    assertEquals("The 'P' bit is not copied from request in Profile-Update-Answer, it should. [RFC3588/6.2]", pur.getHeader().isProxiable(), pua.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) pur).getGenericData().setProxiable(!pur.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Profile-Update-Request, it should.", pur.getHeader().isProxiable() != pua.getHeader().isProxiable());
    pua = shServerFactory.createProfileUpdateAnswer(pur);
    assertEquals("The 'P' bit is not copied from request in Profile-Update-Answer, it should. [RFC3588/6.2]", pur.getHeader().isProxiable(), pua.getHeader().isProxiable());
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 10 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class HSSClientChildSbb method getUserIdentityValues.

private String[] getUserIdentityValues(DiameterShMessage shMessage) {
    UserIdentityAvp uIdAvp = null;
    if (shMessage instanceof UserDataRequest) {
        uIdAvp = ((UserDataRequest) shMessage).getUserIdentity();
    } else if (shMessage instanceof ProfileUpdateRequest) {
        uIdAvp = ((ProfileUpdateRequest) shMessage).getUserIdentity();
    } else if (shMessage instanceof SubscribeNotificationsRequest) {
        uIdAvp = ((SubscribeNotificationsRequest) shMessage).getUserIdentity();
    } else if (shMessage instanceof PushNotificationRequest) {
        uIdAvp = ((PushNotificationRequest) shMessage).getUserIdentity();
    }
    String publicIdentity = null;
    String msisdn = null;
    if (uIdAvp != null) {
        publicIdentity = uIdAvp.getPublicIdentity();
        msisdn = uIdAvp.getMsisdn();
        if (publicIdentity == null && msisdn == null) {
            tracer.warning("Unable to retrieve Public User/Service Identity OR MSISDN. At least one of them should be present.");
        }
    } else {
        tracer.warning("User-Identity AVP missing in Diameter Sh Message.");
    }
    return new String[] { publicIdentity, msisdn };
}
Also used : UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) UserIdentityAvp(net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)

Aggregations

ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)17 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)7 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)4 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)2 ShClientActivity (net.java.slee.resource.diameter.sh.client.ShClientActivity)2 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)2 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)1 Request (org.jdiameter.api.Request)1 ProfileUpdateRequestImpl (org.jdiameter.common.impl.app.sh.ProfileUpdateRequestImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)1 UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)1 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)1