use of net.java.slee.resource.diameter.sh.events.PushNotificationRequest in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method isProxiableRAR.
@Test
public void isProxiableRAR() throws Exception {
PushNotificationRequest pnr = shServerFactory.createPushNotificationRequest();
assertTrue("The 'P' bit is not set by default in Push-Notification-Request, it should.", pnr.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.sh.events.PushNotificationRequest 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 net.java.slee.resource.diameter.sh.events.PushNotificationRequest 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 };
}
use of net.java.slee.resource.diameter.sh.events.PushNotificationRequest in project jain-slee.diameter by RestComm.
the class ShServerSubscriptionActivityImpl method sendPushNotificationRequest.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#sendPushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest)
*/
public void sendPushNotificationRequest(PushNotificationRequest message) throws IOException {
try {
DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
fetchSessionData(msg, false);
this.serverSession.sendPushNotificationRequest(new PushNotificationRequestImpl((Request) msg.getGenericData()));
clean(msg);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to send message.", e);
}
throw new IOException("Failed to send message, due to: " + e);
}
}
use of net.java.slee.resource.diameter.sh.events.PushNotificationRequest in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method isRequestPNR.
@Test
public void isRequestPNR() throws Exception {
PushNotificationRequest pnr = shServerFactory.createPushNotificationRequest();
assertTrue("Request Flag in Push-Notification-Request is not set.", pnr.getHeader().isRequest());
}
Aggregations