Search in sources :

Example 6 with InsertSubscriberDataRequest

use of net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest 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 7 with InsertSubscriberDataRequest

use of net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest 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 8 with InsertSubscriberDataRequest

use of net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest 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)

Example 9 with InsertSubscriberDataRequest

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

the class S6aFactoriesTest method hasTFlagSetIDA.

@Test
public void hasTFlagSetIDA() throws Exception {
    InsertSubscriberDataRequest idr = s6aMessageFactory.createInsertSubscriberDataRequest();
    ((DiameterMessageImpl) idr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Insert-Subscriber-Data-Request", idr.getHeader().isPotentiallyRetransmitted());
    clientSession.fetchSessionData(idr);
    InsertSubscriberDataAnswer ida = clientSession.createInsertSubscriberDataAnswer();
    assertFalse("The 'T' flag should not be set in Insert-Subscriber-Data-Answer", ida.getHeader().isPotentiallyRetransmitted());
}
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 10 with InsertSubscriberDataRequest

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

the class S6aFactoriesTest method hasDestinationRealmIDA.

@Test
public void hasDestinationRealmIDA() 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.getDestinationRealm());
}
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

InsertSubscriberDataRequest (net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataRequest)13 Test (org.junit.Test)11 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)11 InsertSubscriberDataAnswer (net.java.slee.resource.diameter.s6a.events.InsertSubscriberDataAnswer)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