Search in sources :

Example 16 with UserDataAnswer

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

the class ShServerFactoriesTest method testGettersAndSettersUDA.

@Test
public void testGettersAndSettersUDA() throws Exception {
    UserDataAnswer uda = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest());
    int nFailures = ShServerAvpAssistant.INSTANCE.testMethods(uda, UserDataAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
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 17 with UserDataAnswer

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

the class ShServerFactoriesTest method isAnswerUDA.

@Test
public void isAnswerUDA() throws Exception {
    UserDataAnswer uda = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest());
    assertFalse("Request Flag in User-Data-Answer is set.", uda.getHeader().isRequest());
}
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 18 with UserDataAnswer

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

the class ShServerFactoriesTest method testMessageFactoryApplicationIdChangeUDA.

@Test
public void testMessageFactoryApplicationIdChangeUDA() 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...
    UserDataAnswer originalUDA = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalUDA);
    // now we switch..
    originalUDA = null;
    isVendor = !isVendor;
    ((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    UserDataAnswer changedUDA = shServerFactory.createUserDataAnswer(shClientFactory.createUserDataRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedUDA);
    // revert back to default
    ((ShServerMessageFactoryImpl) shServerFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : UserDataAnswer(net.java.slee.resource.diameter.sh.events.UserDataAnswer) ApplicationId(org.jdiameter.api.ApplicationId) ShServerMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl) 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