Search in sources :

Example 6 with UserDataAnswer

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

the class ShServerSubscriptionActivityImpl method sendUserDataAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#sendUserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer)
   */
public void sendUserDataAnswer(UserDataAnswer message) throws IOException {
    try {
        DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
        this.serverSession.sendUserDataAnswer(new UserDataAnswerImpl((Answer) 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);
    }
}
Also used : UserDataAnswerImpl(org.jdiameter.common.impl.app.sh.UserDataAnswerImpl) Answer(org.jdiameter.api.Answer) SubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer) ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) IOException(java.io.IOException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException)

Example 7 with UserDataAnswer

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

the class ShServerFactoriesTest method hasDestinationRealmUDA.

@Test
public void hasDestinationRealmUDA() throws Exception {
    UserDataAnswer uda = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", uda.getDestinationRealm());
}
Also used : UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 8 with UserDataAnswer

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

the class ShServerFactoriesTest method hasTFlagSetUDA.

@Test
public void hasTFlagSetUDA() throws Exception {
    UserDataRequest udr = shClientFactory.createUserDataRequest();
    ((DiameterMessageImpl) udr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in User-Data-Request", udr.getHeader().isPotentiallyRetransmitted());
    UserDataAnswer uda = shServerFactory.createUserDataAnswer(udr);
    assertFalse("The 'T' flag should not be set in User-Data-Answer", uda.getHeader().isPotentiallyRetransmitted());
}
Also used : UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 9 with UserDataAnswer

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

the class ShServerFactoriesTest method hasDestinationHostUDA.

@Test
public void hasDestinationHostUDA() throws Exception {
    UserDataAnswer uda = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", uda.getDestinationHost());
}
Also used : UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 10 with UserDataAnswer

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

the class ShServerFactoriesTest method isExperimentalResultCorrectlySetUDA.

/**
 * Test for Issue #665 (Diameter Experimental Result AVP is Nested)
 * http://code.google.com/p/mobicents/issues/detail?id=655
 *
 * @throws Exception
 */
@Test
public void isExperimentalResultCorrectlySetUDA() throws Exception {
    long originalValue = 5001;
    UserDataAnswer uda = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest(), originalValue, true);
    long obtainedValue = uda.getExperimentalResult().getExperimentalResultCode();
    assertTrue("Experimental-Result-Code in UDA should be " + originalValue + " and is " + obtainedValue + ".", originalValue == obtainedValue);
}
Also used : UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

UserDataAnswer (net.java.slee.resource.diameter.sh.events.UserDataAnswer)18 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)9 Test (org.junit.Test)9 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)9 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)5 IOException (java.io.IOException)2 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)2 ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)2 SubscribeNotificationsAnswer (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)2 Answer (org.jdiameter.api.Answer)2 ApplicationId (org.jdiameter.api.ApplicationId)2 UserDataAnswerImpl (org.jdiameter.common.impl.app.sh.UserDataAnswerImpl)2 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)2 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)1