Search in sources :

Example 11 with DeleteSubscriberDataRequest

use of net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method isProxiableCopiedDSA.

@Test
public void isProxiableCopiedDSA() throws Exception {
    DeleteSubscriberDataRequest dsr = s6aMessageFactory.createDeleteSubscriberDataRequest();
    clientSession.fetchSessionData(dsr);
    DeleteSubscriberDataAnswer dsa = clientSession.createDeleteSubscriberDataAnswer();
    assertEquals("The 'P' bit is not copied from request in Location-Info-Answer, it should. [RFC3588/6.2]", dsr.getHeader().isProxiable(), dsa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) dsr).getGenericData().setProxiable(!dsr.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Delete-Subscriber-Data-Request, it should.", dsr.getHeader().isProxiable() != dsa.getHeader().isProxiable());
    clientSession.fetchSessionData(dsr);
    dsa = clientSession.createDeleteSubscriberDataAnswer();
    assertEquals("The 'P' bit is not copied from request in Delete-Subscriber-Data-Answer, it should. [RFC3588/6.2]", dsr.getHeader().isProxiable(), dsa.getHeader().isProxiable());
}
Also used : DeleteSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswer) DeleteSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 12 with DeleteSubscriberDataRequest

use of net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method hasDestinationHostDSA.

@Test
public void hasDestinationHostDSA() throws Exception {
    DeleteSubscriberDataRequest dsr = s6aMessageFactory.createDeleteSubscriberDataRequest();
    clientSession.fetchSessionData(dsr);
    DeleteSubscriberDataAnswer dsa = clientSession.createDeleteSubscriberDataAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", dsa.getDestinationHost());
}
Also used : DeleteSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswer) DeleteSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 13 with DeleteSubscriberDataRequest

use of net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testClientSessionApplicationIdChangeDSA.

@Test
public void testClientSessionApplicationIdChangeDSA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((S6aMessageFactoryImpl) s6aMessageFactory).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 S6a is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    DeleteSubscriberDataRequest dsr = s6aMessageFactory.createDeleteSubscriberDataRequest();
    clientSession.fetchSessionData(dsr);
    DeleteSubscriberDataAnswer originalDSA = clientSession.createDeleteSubscriberDataAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalDSA);
    // now we switch..
    originalDSA = null;
    isVendor = !isVendor;
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    DeleteSubscriberDataAnswer changedDSA = clientSession.createDeleteSubscriberDataAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedDSA);
    // revert back to default
    ((S6aMessageFactoryImpl) s6aMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : S6aMessageFactoryImpl(org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl) DeleteSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswer) DeleteSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

DeleteSubscriberDataRequest (net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataRequest)13 Test (org.junit.Test)11 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)11 DeleteSubscriberDataAnswer (net.java.slee.resource.diameter.s6a.events.DeleteSubscriberDataAnswer)8 ApplicationId (org.jdiameter.api.ApplicationId)2 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)2 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 InternalException (org.jdiameter.api.InternalException)1