Search in sources :

Example 1 with InsertSubscriberDataAnswer

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

the class S6aFactoriesTest method isProxiableCopiedIDA.

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

Example 2 with InsertSubscriberDataAnswer

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

the class S6aFactoriesTest method hasDestinationHostIDA.

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

Example 3 with InsertSubscriberDataAnswer

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

the class S6aFactoriesTest method isAnswerIDA.

@Test
public void isAnswerIDA() throws Exception {
    InsertSubscriberDataRequest idr = s6aMessageFactory.createInsertSubscriberDataRequest();
    clientSession.fetchSessionData(idr);
    InsertSubscriberDataAnswer ida = clientSession.createInsertSubscriberDataAnswer();
    assertFalse("Request Flag in Insert-Subscriber-Data-Answer is set.", ida.getHeader().isRequest());
}
Also used : InsertSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswer) InsertSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with InsertSubscriberDataAnswer

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

the class S6aClientSessionImpl method createInsertSubscriberDataAnswer.

public InsertSubscriberDataAnswer createInsertSubscriberDataAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof InsertSubscriberDataRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        InsertSubscriberDataAnswer ida = (InsertSubscriberDataAnswer) this.s6aMessageFactory.createS6aMessage(lastRequest.getHeader(), new DiameterAvp[] {}, InsertSubscriberDataAnswer.COMMAND_CODE, s6aMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(ida);
        return ida;
    } catch (InternalException e) {
        logger.error("Failed to create Insert-Subscriber-Data-Answer.", e);
    }
    return null;
}
Also used : InsertSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswer) InsertSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) InternalException(org.jdiameter.api.InternalException)

Example 5 with InsertSubscriberDataAnswer

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

the class S6aFactoriesTest method testGettersAndSettersIDA.

@Test
public void testGettersAndSettersIDA() throws Exception {
    InsertSubscriberDataRequest idr = s6aMessageFactory.createInsertSubscriberDataRequest();
    clientSession.fetchSessionData(idr);
    InsertSubscriberDataAnswer ida = clientSession.createInsertSubscriberDataAnswer();
    int nFailures = S6aAvpAssistant.INSTANCE.testMethods(ida, InsertSubscriberDataAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : InsertSubscriberDataAnswer(net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswer) InsertSubscriberDataRequest(net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

InsertSubscriberDataAnswer (net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswer)8 InsertSubscriberDataRequest (net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest)8 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 ApplicationId (org.jdiameter.api.ApplicationId)1 InternalException (org.jdiameter.api.InternalException)1 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)1