use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testClientSessionApplicationIdChangePPA.
@Test
public void testClientSessionApplicationIdChangePPA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((CxDxMessageFactoryImpl) cxdxMessageFactory).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 CxDx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
clientSession.fetchSessionData(ppr);
PushProfileAnswer originalPPA = clientSession.createPushProfileAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalPPA);
// now we switch..
originalPPA = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
PushProfileAnswer changedPPA = clientSession.createPushProfileAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedPPA);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testGettersAndSettersPPA.
@Test
public void testGettersAndSettersPPA() throws Exception {
clientSession.fetchSessionData(cxdxMessageFactory.createPushProfileRequest());
PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
int nFailures = CxDxAvpAssistant.INSTANCE.testMethods(ppa, PushProfileAnswer.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxClientSessionImpl method sendPushProfileAnswer.
/* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#sendPushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)
*/
public void sendPushProfileAnswer(PushProfileAnswer pushProfileAnswer) throws IOException {
try {
DiameterMessageImpl msg = (DiameterMessageImpl) pushProfileAnswer;
appSession.sendPushProfileAnswer(new JPushProfileAnswerImpl((Answer) msg.getGenericData()));
} catch (org.jdiameter.api.validation.AvpNotAllowedException anae) {
throw new AvpNotAllowedException(anae.getMessage(), anae.getAvpCode(), anae.getVendorId());
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasDestinationHostPPA.
@Test
public void hasDestinationHostPPA() throws Exception {
clientSession.fetchSessionData(cxdxMessageFactory.createPushProfileRequest());
PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", ppa.getDestinationHost());
}
Aggregations