Search in sources :

Example 1 with RegistrationTerminationAnswer

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());
    }
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) Answer(org.jdiameter.api.Answer) PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) JRegistrationTerminationAnswerImpl(org.jdiameter.common.impl.app.cxdx.JRegistrationTerminationAnswerImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) InternalException(org.jdiameter.api.InternalException) IOException(java.io.IOException)

Example 2 with RegistrationTerminationAnswer

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

Example 3 with RegistrationTerminationAnswer

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

Example 4 with RegistrationTerminationAnswer

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

Example 5 with RegistrationTerminationAnswer

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());
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) RegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest) CxDxMessageFactoryImpl(org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

RegistrationTerminationAnswer (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer)9 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 RegistrationTerminationRequest (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest)4 InternalException (org.jdiameter.api.InternalException)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 PushProfileAnswer (net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)1 Answer (org.jdiameter.api.Answer)1 ApplicationId (org.jdiameter.api.ApplicationId)1 JRegistrationTerminationAnswerImpl (org.jdiameter.common.impl.app.cxdx.JRegistrationTerminationAnswerImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)1