use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.
the class CxDxClientSessionImpl method sendRegistrationTerminationAnswer.
/* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#sendRegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest)
*/
public void sendRegistrationTerminationAnswer(RegistrationTerminationAnswer registrationTerminationAnswer) throws IOException {
try {
DiameterMessageImpl msg = (DiameterMessageImpl) registrationTerminationAnswer;
appSession.sendRegistrationTerminationAnswer(new JRegistrationTerminationAnswerImpl((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.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasDestinationRealmRTA.
@Test
public void hasDestinationRealmRTA() throws Exception {
clientSession.fetchSessionData(cxdxMessageFactory.createRegistrationTerminationRequest());
RegistrationTerminationAnswer rta = clientSession.createRegistrationTerminationAnswer();
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", rta.getDestinationRealm());
}
use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasDestinationHostRTA.
@Test
public void hasDestinationHostRTA() throws Exception {
clientSession.fetchSessionData(cxdxMessageFactory.createRegistrationTerminationRequest());
RegistrationTerminationAnswer rta = clientSession.createRegistrationTerminationAnswer();
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", rta.getDestinationHost());
}
use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasTFlagSetRTA.
@Test
public void hasTFlagSetRTA() throws Exception {
RegistrationTerminationRequest rtr = cxdxMessageFactory.createRegistrationTerminationRequest();
((DiameterMessageImpl) rtr).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Registration-Termination-Request", rtr.getHeader().isPotentiallyRetransmitted());
clientSession.fetchSessionData(rtr);
RegistrationTerminationAnswer rta = clientSession.createRegistrationTerminationAnswer();
assertFalse("The 'T' flag should not be set in Registration-Termination-Answer", rta.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testClientSessionApplicationIdChangeRTA.
@Test
public void testClientSessionApplicationIdChangeRTA() 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...
RegistrationTerminationRequest rtr = cxdxMessageFactory.createRegistrationTerminationRequest();
clientSession.fetchSessionData(rtr);
RegistrationTerminationAnswer originalRTA = clientSession.createRegistrationTerminationAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRTA);
// now we switch..
originalRTA = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
RegistrationTerminationAnswer changedRTA = clientSession.createRegistrationTerminationAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRTA);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations